Custom board with XUF216-512-TQ128-C20A - xrun works, xflash doesn't

Technical discussions around xCORE processors (e.g. xcore-200 & xcore.ai).
dtns
Member++
Posts: 16
Joined: Sun Sep 01, 2024 6:05 pm

Custom board with XUF216-512-TQ128-C20A - xrun works, xflash doesn't

Post by dtns »

If I run the firmware via xrun, it is working successfully.

If I am trying to flash the integrated flash, it fails.

Site 0 has started.
Site 0 has ID 0x9d6015.
Site 0 erase 0x00000000.
Site 0 write 0x00000000.
Verify failed for page 0x00000000, offset 0x0000 (read 0x00, expected 0x37).

This happens on both test boards.
mmar
XCore Addict
Posts: 133
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

XFLASH version ? External pullup for internal flash placed ?
Joe
Verified
Experienced Member
Posts: 80
Joined: Sun Dec 13, 2009 1:12 am

Post by Joe »

Site 0 has ID 0x9d6015

This means the xcore has read the device ID from the flash correctly. This read is via serial SPI. It's possible the QE bit in the flash has not been set which would stop the Quad read working in the verify stage. I would check the XN to see the qe bit location is defined correctly and/or check the build in general is for the correct device etc.

Joe
XMOS hardware grey beard.
dtns
Member++
Posts: 16
Joined: Sun Sep 01, 2024 6:05 pm

Post by dtns »

xflash version: Build 61-0e6d8350, Jul-04-2024
Pullup on X0D01 is present (1k).

Sorry for the stupid question, but how to I set the QE bit? This is my first custom XMOS board bringup.
Before that, I was using a board from DIYINHK with the same XUF216 and things were working with the same target definition (and the board was also using a XUF216-512-TQ128.

Current XN file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Network xmlns="http://www.xmos.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xmos.com http://www.xmos.com" ManuallySpecifiedRouting="true">
  <Type>Board</Type>
  <Name>XS2 Audio</Name>
  <Declarations>
    <Declaration>tileref tile[2]</Declaration>
    <Declaration>tileref usb_tile</Declaration>
  </Declarations>
  <Packages>
    <Package id="0" Type="XS2-UnA-512-FB236">
      <Nodes>
        <Node Id="0" InPackageId="0" Type="XS2-L16A-512" Oscillator="24MHz" SystemFrequency="500MHz" referencefrequency="100MHz">
          <Boot>
            <Source Location="SPI:bootFlash"/>
          </Boot>
          <Tile Number="0" Reference="tile[0]">
            <Port Location="XS1_PORT_1B" Name="PORT_SQI_CS"/>
            <Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK"/>
            <Port Location="XS1_PORT_4B" Name="PORT_SQI_SIO"/>
        
            <!-- Audio Ports -->         
            <!-- Port Location="XS1_PORT_1A"  Name="PORT_PLL_REF"/>
            <Port Location="XS1_PORT_1F"  Name="PORT_MCLK_IN"/>
            <Port Location="XS1_PORT_1G"  Name="PORT_I2S_LRCLK"/>
            <Port Location="XS1_PORT_1H"  Name="PORT_I2S_BCLK"/>

            <Port Location="XS1_PORT_1M"  Name="PORT_I2S_DAC0"/>
            <port Location="XS1_PORT_1N"  Name="PORT_I2S_DAC1"/>
            <port Location="XS1_PORT_1O"  Name="PORT_I2S_DAC2"/>
            <port Location="XS1_PORT_1P"  Name="PORT_I2S_DAC3"/>

            <Port Location="XS1_PORT_1I"  Name="PORT_I2S_ADC0"/>
            <Port Location="XS1_PORT_1J"  Name="PORT_I2S_ADC1"/>
            <Port Location="XS1_PORT_1K"  Name="PORT_I2S_ADC2"/>
            <Port Location="XS1_PORT_1L"  Name="PORT_I2S_ADC3"/>

            <Port Location="XS1_PORT_4A"  Name="PORT_I2C"/>

            <Port Location="XS1_PORT_1M"  Name="PORT_DSD_DAC0"/>
            <port Location="XS1_PORT_1N"  Name="PORT_DSD_DAC1"/>
            <Port Location="XS1_PORT_1G"  Name="PORT_DSD_CLK"/>
            
            <Port Location="XS1_PORT_1E"  Name="PORT_ADAT_OUT"/>
            <Port Location="XS1_PORT_1D"  Name="PORT_SPDIF_OUT"/>-->

            <!-- Audio Ports -->         
<Port Location="XS1_PORT_1A"  Name="PORT_PLL_REF"/>
<Port Location="XS1_PORT_1F"  Name="PORT_MCLK_IN"/>
<Port Location="XS1_PORT_1G"  Name="PORT_I2S_LRCLK"/>
<Port Location="XS1_PORT_1H"  Name="PORT_I2S_BCLK"/>
<Port Location="XS1_PORT_1M"  Name="PORT_I2S_DAC0"/>
<port Location="XS1_PORT_1N"  Name="PORT_I2S_DAC1"/>
<port Location="XS1_PORT_1O"  Name="PORT_I2S_DAC2"/>
<port Location="XS1_PORT_1P"  Name="PORT_I2S_DAC3"/>


<Port Location="XS1_PORT_1I"  Name="PORT_I2S_ADC3"/>
<Port Location="XS1_PORT_1J"  Name="PORT_I2S_ADC2"/>
<Port Location="XS1_PORT_1K"  Name="PORT_I2S_ADC1"/>
<Port Location="XS1_PORT_1L"  Name="PORT_I2S_ADC0"/>

<Port Location="XS1_PORT_4A"  Name="PORT_I2C"/>
<Port Location="XS1_PORT_1G"  Name="PORT_DSD_DAC0"/>
<port Location="XS1_PORT_1M"  Name="PORT_DSD_DAC1"/>
<Port Location="XS1_PORT_1H"  Name="PORT_DSD_CLK"/>
<Port Location="XS1_PORT_1D"  Name="PORT_ADAT_OUT"/>-->  <!-- D: COAX E: OPT -->
<Port Location="XS1_PORT_1E"  Name="PORT_SPDIF_OUT"/>--> <!-- D: COAX E: OPT -->
            
          </Tile>
          <Tile Number="1" Reference="tile[1]">
            <Port Location="XS1_PORT_1H"  Name="PORT_USB_TX_READYIN"/>
            <Port Location="XS1_PORT_1J"  Name="PORT_USB_CLK"/>
            <Port Location="XS1_PORT_1K"  Name="PORT_USB_TX_READYOUT"/>
            <Port Location="XS1_PORT_1I"  Name="PORT_USB_RX_READY"/>
            <Port Location="XS1_PORT_1E"  Name="PORT_USB_FLAG0"/>
            <Port Location="XS1_PORT_1F"  Name="PORT_USB_FLAG1"/>
            <Port Location="XS1_PORT_1G"  Name="PORT_USB_FLAG2"/>
            <Port Location="XS1_PORT_8A"  Name="PORT_USB_TXD"/>
            <Port Location="XS1_PORT_8B"  Name="PORT_USB_RXD"/>

            <!-- Ports for USB feedback calculation --> 
            <Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>              
            <Port Location="XS1_PORT_1L"  Name="PORT_MCLK_IN_USB"/>
            <!-- Audio Ports -->
            <Port Location="XS1_PORT_1M"  Name="PORT_MIDI_IN"/>
            <Port Location="XS1_PORT_1N"  Name="PORT_MIDI_OUT"/>
            <Port Location="XS1_PORT_1O"  Name="PORT_ADAT_IN"/>-->  <!-- P: COAX O: OPT --> 
            <Port Location="XS1_PORT_1P"  Name="PORT_SPDIF_IN"/>--> <!-- P: COAX O: OPT --> 
          </Tile>
        </Node>
        <Node Id="1" InPackageId="1" Type="periph:XS1-SU" Reference="usb_tile" Oscillator="24MHz">
        </Node>
      </Nodes>
      <Links>
        <Link Encoding="5wire">
          <LinkEndpoint NodeId="0" Link="8" Delays="52clk,52clk"/>
          <LinkEndpoint NodeId="1" Link="XL0" Delays="1clk,1clk"/>
        </Link>
      </Links>
    </Package>
  </Packages>
  <Nodes>
    <Node Id="2" Type="device:" RoutingId="0x8000">
      <Service Id="0" Proto="xscope_host_data(chanend c);">
        <Chanend Identifier="c" end="3"/>
      </Service>
    </Node>
  </Nodes>
  <Links>
    <Link Encoding="2wire" Delays="4,4" Flags="XSCOPE">
      <LinkEndpoint NodeId="0" Link="XL0"/>
      <LinkEndpoint NodeId="2" Chanend="1"/>
    </Link>
  </Links>
  <ExternalDevices>
    <Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K" PageSize="256" SectorSize="4096" NumPages="8192">
      <Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
      <Attribute Name="PORT_SQI_SCLK"   Value="PORT_SQI_SCLK"/>
      <Attribute Name="PORT_SQI_SIO"  Value="PORT_SQI_SIO"/>
    </Device>
  </ExternalDevices>
  <JTAGChain>
    <JTAGDevice NodeId="0"/>
    <JTAGDevice NodeId="1"/>
  </JTAGChain>
</Network>

dtns
Member++
Posts: 16
Joined: Sun Sep 01, 2024 6:05 pm

Post by dtns »

I've just spotted another error. The Package was defined XS2-UnA-512-FB236 (but worked), but apparently should be set to XS2-UFnA-512-TQ128 (note the F).
Will check if this resolves the issue as soon as I am back in the office.

Edit: Unfortunately this didn't fix it.
xflash bin/UMAXTDM/uma_UMAXTDM.xe 
Site 0 write    0x00000000. Verify failed for page 0x00000000, offset 0x0000 (read 0x00, expected 0x37).
Error: F03013 Failed to run : xrun --io fw-b25e6f25 
Schematic (part) attached:
Screenshot 2024-12-03 at 08.42.46.png
You do not have the required permissions to view the files attached to this post.
michaelf
Member++
Posts: 19
Joined: Thu Mar 14, 2024 7:44 pm

Post by michaelf »

dtns wrote: Tue Dec 03, 2024 7:00 am I've just spotted another error. The Package was defined XS2-UnA-512-FB236 (but worked), but apparently should be set to XS2-UFnA-512-TQ128 (note the F).
Will check if this resolves the issue as soon as I am back in the office.

Edit: Unfortunately this didn't fix it.
xflash bin/UMAXTDM/uma_UMAXTDM.xe 
Site 0 write    0x00000000. Verify failed for page 0x00000000, offset 0x0000 (read 0x00, expected 0x37).
Error: F03013 Failed to run : xrun --io fw-b25e6f25 
Schematic (part) attached:
Screenshot 2024-12-03 at 08.42.46.png
Did you see the recent answers in this thread? https://www.xcore.com/viewtopic.php?t=8830

It goes into details regarding the QE bit.
dtns
Member++
Posts: 16
Joined: Sun Sep 01, 2024 6:05 pm

Post by dtns »

Still same problem

Code: Select all

app_usb_aud_custom % xflash --spi-cmd 0x06 --spi-cmd 0x31 0x00 0x02 --target-file src/core/brd.xn
Executed SPI command 0x06 on tile[0].
Executed SPI command 0x31 on tile[0].
app_usb_aud_custom % xflash --target-file src/core/brd.xn bin/UMA/uma_UMA.xe 
Site 0 write    0x00000000. Verify failed for page 0x00000000, offset 0x0000 (read 0x00, expected 0x37).
Weirdly enough the flash read reads 0x00 from the register even after the xflash write command.
mmar
XCore Addict
Posts: 133
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

Areyou sure your IC is XUF and not XU ? When yes show your schematics
Joe
Verified
Experienced Member
Posts: 80
Joined: Sun Dec 13, 2009 1:12 am

Post by Joe »

I don't think those flash commands are doing what you think they are.

Try some basics:
xflash --spi-read-id 0x9F
Should repeat the device Id read by the tools 0x9d6015.

xflash --spi-command 0x5A 256 0x00 0x00 0x00
Shold read the entire SFDP structure.

Maybe start by using the XN built into the tools.
C:\Program Files\XMOS\XTC\15.3.0\targets\XUF216-512-TQ128-C20

Cheers,
Joe
XMOS hardware grey beard.
dtns
Member++
Posts: 16
Joined: Sun Sep 01, 2024 6:05 pm

Post by dtns »

Joe wrote: Mon Dec 09, 2024 4:22 pm I don't think those flash commands are doing what you think they are.

Try some basics:
xflash --spi-read-id 0x9F
Should repeat the device Id read by the tools 0x9d6015.

xflash --spi-command 0x5A 256 0x00 0x00 0x00
Shold read the entire SFDP structure.

Maybe start by using the XN built into the tools.
C:\Program Files\XMOS\XTC\15.3.0\targets\XUF216-512-TQ128-C20

Cheers,
Joe

Code: Select all

xflash --spi-read-id 0x9F --target-file src/core/board.xn 

Response to SPI ID command on tile[0]: 0x9d, 0x60, 0x15, 0x0.

xflash --spi-command 0x5A 256 0x00 0x00 0x00 --target-file src/core/board.xn

Response to SPI command 0x5a on tile[0]: 0x00, 0x53, 0x46, 0x44, 0x50, 0x06, 0x01, 0x01, 0xff, 0x00, 0x06, 0x01, 0x10, 0x30, 0x00, 0x00, 0xff, 0x9d, 0x05, 0x01, 0x03, 0x80, 0x00, 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe5, 0x20, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x00, 0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x80, 0xbb, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x44, 0xeb, 0x0c, 0x20, 0x0f, 0x52, 0x10, 0xd8, 0x00, 0xff, 0x23, 0x4a, 0xc9, 0x00, 0x82, 0xd8, 0x11, 0xaf, 0xcc, 0xcd, 0x68, 0x46, 0x7a, 0x75, 0x7a, 0x75, 0xf7, 0xa2, 0xd5, 0x5c, 0x4a, 0x42, 0x2c, 0xff, 0xf0, 0x30, 0xc0, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x36, 0x00, 0x23, 0x9e, 0xf9, 0xc0, 0x64, 0x8f, 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff.