Error F03013, verification failure / programmer writing random value

Technical questions regarding the XTC tools and programming with XMOS.
fletchryde2112
New User
Posts: 2
Joined: Tue Aug 20, 2024 4:19 pm

Error F03013, verification failure / programmer writing random value

Post by fletchryde2112 »

Hey all,

I was recently assigned to a project that involves flashing a custom board with an XE216-C20 chip and onboard flash memory, IS25LP080D.

However, upon following the given documentation and running the command xflash bin/<targetfile>.xe I am presented with the following error:

Code: Select all

.
.
.
XFlash_Builder_Binary::GetSearchLimitPadding : current size (f000) 0
XFlash_Builder_Binary::CalculateBufferSize_Data
XFlash_Builder_Binary::BuildBinary : Allocating buffer - f000
XFlash_Builder_Binary::GetSearchLimitPadding : current size (f000) 0
XFlash_Builder_Binary::WriteBufferToBinary : flash_bin_node0
XFlash_Builder_Storage_PPB::BuildStorage
XFlash_Programmer_Write::DoWrite
XFlash_Programmer_Write::IssueCompileCommand
xcc -w -fxscope -x xn "target-xn-v0-f535c753" -O2 -lquadflash -D xnPORT_SQI_CS0=PORT_SQI_CS -D xnPORT_SQI_SCLK0=PORT_SQI_SCLK -D xnPORT_SQI_SIO0=PORT_SQI_SIO -x xc "fw-f21db6d0" -o "fw-0f76a135" 
XFlash_Utils::BuildRunCommand : xrun --xscope fw-0f76a135 
Site 0 has started.         
Site 0 has ID   0x9d6014.   
Site 0 erase    0x00000000. 
Site 0 write    0x00000000. 
Verify failed for page 0x00000000, offset 0x0000 (read 0x00, expected 0x37).
Error: F03013 Failed to run : 0x7ffc445bae80.
It seems here that, if I understand this correctly, the programmer tries to write a 0 to a location where a 0x37 should be written. Then when it tries to verify the value it gets confused and shuts down. What could be the problem here?
I've tried declaring different options in my environment but all to no avail (such as specifying the partition size, i have yet to change the spi settings), partially due to my current lack of experience with the XMOS architecture.

The board is a verified design and has worked in the past. We recently sourced production from a different company though and the board I am using is a part of that batch. Running the .xe with xrun --xscope bin/<targetfile>.xe is successful.

For reference, the .xn file entry regarding the flash device is is as follows:

Code: Select all

 .
 .
 .
 69   <ExternalDevices>
 70     <Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="ISSI_IS25LP080D" PageSize="256" SectorSize="4096" NumPages="4096">
 71       <Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
 72       <Attribute Name="PORT_SQI_SCLK"   Value="PORT_SQI_SCLK"/>
 73       <Attribute Name="PORT_SQI_SIO"  Value="PORT_SQI_SIO"/>
 74     </Device>
 75   </ExternalDevices>
Any suggestions regarding this issue are much appreciated. Thank you!
fletchryde2112
New User
Posts: 2
Joined: Tue Aug 20, 2024 4:19 pm

Post by fletchryde2112 »

Has anyone experienced a similar issue in their custom builds? I have been unable to solve the problem as of yet.

On certain boards in the batch, running the following commands worked:

Code: Select all

xflash -v bin/<path> -o outfile.bin
xflash -v --target-file src/<path> --erase-all
xflash -v --target-file src/<path> --write-all
but the results of this were inconsistent, i.e. many of the boards did not flash at all. And on the boards that flashed, I get USB ERROR -71 upon plugging the device in (fit for a different topic).
Last edited by fletchryde2112 on Wed Aug 21, 2024 3:29 pm, edited 1 time in total.
Joe
Verified
Experienced Member
Posts: 80
Joined: Sun Dec 13, 2009 1:12 am

Post by Joe »

Site 0 has ID 0x9d6014: So the program read the correct device ID from the flash: This corresponds to the IS25LP080D part.

It then programmed one page and read it back to compare and found the first byte of the page was 00 and it should have been 0x37.

Could be a problem with the quad enable bit not being set in flash? This would stop the read working.

What version of tools are you using, and the full xmos device part number?

Cheers,
Joe
XMOS hardware grey beard.
fletchryde2112
New User
Posts: 2
Joined: Tue Aug 20, 2024 4:19 pm

Post by fletchryde2112 »

Hi there and thank you for the response!
Joe wrote: Wed Aug 21, 2024 3:38 pm Could be a problem with the quad enable bit not being set in flash? This would stop the read working.
I modified my .xn file to look like this:

Code: Select all

<ExternalDevices>
 70     <Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="ISSI_IS25LP080D" PageSize="256" SectorSize="4096" NumPages="4096">
 71       <Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
 72       <Attribute Name="PORT_SQI_SCLK"   Value="PORT_SQI_SCLK"/>
 73       <Attribute Name="PORT_SQI_SIO"  Value="PORT_SQI_SIO"/>
 74       <Attribute Name="QE_REGISTER" Value="quad_spi_qe_location_status_reg_0"/>
 75       <Attribute Name="QE_BIT" Value="quad_spi_qe_bit_6"/>
 76     </Device>
 77   </ExternalDevices>
but I'm still getting the same error.

For reference, my entire .xn file is as follows:

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>xMainboard_v2.0</Name>
  <Declarations>
    <Declaration>tileref tile[2]</Declaration>
    <Declaration>tileref usb_tile</Declaration>
  </Declarations>
  <Packages>
    <Package id="0" Type="XS2-UnA-512-TQ128">
      <Nodes>
        <Node Id="0" InPackageId="0" Type="XS2-L16A-512" OscillatorSrc="1" 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_1M" Name="PORT_MCLK_IN"/>
            <Port Location="XS1_PORT_1N" Name="PORT_PPS_IN"/>
            <Port Location="XS1_PORT_1E" Name="PORT_FSYNC_OUT0"/>
            <Port Location="XS1_PORT_1G" Name="PORT_FSYNC_OUT1"/>
            <Port Location="XS1_PORT_1I" Name="PORT_FSYNC_OUT2"/>
            <Port Location="XS1_PORT_1K" Name="PORT_FSYNC_OUT3"/>
            <Port Location="XS1_PORT_1F" Name="PORT_BCLK_OUT0"/>
            <Port Location="XS1_PORT_1H" Name="PORT_BCLK_OUT1"/>
            <Port Location="XS1_PORT_1J" Name="PORT_BCLK_OUT2"/>
            <Port Location="XS1_PORT_1L" Name="PORT_BCLK_OUT3"/>
            <Port Location="XS1_PORT_4C" Name="PORT_DATA_IN0"/>
            <Port Location="XS1_PORT_4D" Name="PORT_DATA_IN1"/>
            <Port Location="XS1_PORT_4E" Name="PORT_DATA_IN2"/>
            <Port Location="XS1_PORT_4F" Name="PORT_DATA_IN3"/>

          </Tile>
          <Tile Number="1" Reference="tile[1]">
            <Port Location="XS1_PORT_4C" Name="PORT_LEDS"/>
            <Port Location="XS1_PORT_1P" Name="PORT_GPS_RX"/>
            <Port Location="XS1_PORT_1O" Name="PORT_GPS_TX"/>
            <Port Location="XS1_PORT_1D" Name="PORT_GPS_RX_2"/>
            <Port Location="XS1_PORT_1C" Name="PORT_GPS_TX_2"/>
          </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="ISSI_IS25LP080D" PageSize="256" SectorSize="4096" NumPages="4096">
      <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"/>
      <Attribute Name="QE_REGISTER" Value="quad_spi_qe_location_status_reg_0"/>
      <Attribute Name="QE_BIT" Value="quad_spi_qe_bit_6"/>
    </Device>
  </ExternalDevices>
  <JTAGChain>
    <JTAGDevice NodeId="0"/>
    <JTAGDevice NodeId="1"/>
  </JTAGChain>
</Network>
Joe wrote: Wed Aug 21, 2024 3:38 pm What version of tools are you using, and the full xmos device part number?
Back when the project was originally built, the developer was using XTC 15.2.1. I tried building with that version but I was still getting the same errors. I am now currently running XTC 15.3.0.
The chip I'm using is the XE216-512-TQ128-C20.

Thanks again!
Last edited by fletchryde2112 on Wed Aug 21, 2024 4:14 pm, edited 2 times in total.
fletchryde2112
New User
Posts: 2
Joined: Tue Aug 20, 2024 4:19 pm

Post by fletchryde2112 »

As an update, I was actually able to flash one of the other boards (by sheer luck, I suppose, as it only worked after trying over and over again... maybe a hardware bug has popped up) and plugged it into a Mac, where the device enumerated. Although I'm not too sure that the problem is solved here as the rest of the boards supposed functions do not work. So maybe back to the drawing board here.
michaelf
Member++
Posts: 20
Joined: Thu Mar 14, 2024 7:44 pm

Post by michaelf »

Exactly the same issue here. It has so far happened on every factory-fresh custom board, until "sometimes" it just decides to work. Usually it's a case of randomly reading/writing/erasing using xflash, as mentioned earlier in this thread, that gets it going.

I note that if one does a --read-all using xflash after failing to complete a write, I can see that it actually did write the correct data.

I will have another crack at this on the morning.
michaelf
Member++
Posts: 20
Joined: Thu Mar 14, 2024 7:44 pm

Post by michaelf »

Problem solved for me - it was the QE bit not being set out of the factory. The specific flash chip we are using is W25Q16JVSSIM - note the IM at the end means it comes out of the factory for the QE bit (located in status register 2, bit position 1) set to 0, whereas it does of course need to be set to 1 so that QSPI reads can be performed. Datasheet: https://www.mouser.co.uk/datasheet/2/94 ... 489664.pdf

I didn't get any joy from (very briefly) trying to adjust my target.xn file, instead I used xflash --spi-read-status 0x35 to read status register 2, showing that the value of the register was 0 (QE bit not set). I then used:

xflash --target-file target.xn --spi-cmd 0x06 --spi-cmd 0x31 0x00 0x02

to successfully set the QE bit to 1 (confirmed by reading back status register 2). --spi-cmd 0x06 is Write Enable, which is important for the write to actual take place. This took a bit of head-scratching (a.k.a. actually going to read the datasheet) because Xmos has done really quite a good job hiding the gnarly implementation details of raw QSPI flash instructions.

The chip now flashes just fine. So, as a general point to future readers who come across this, just be aware that some flash chips need a bit of extra configuration to get them working, which, to be clear, isn't an Xmos problem.
Last edited by michaelf on Tue Nov 12, 2024 9:30 pm, edited 1 time in total.
jseaber
Junior Member
Posts: 5
Joined: Thu Aug 05, 2021 4:35 pm

Post by jseaber »

michaelf wrote: Mon Nov 11, 2024 6:33 am Problem solved for me - it was the QE bit not being set out of the factory. The specific flash chip we are using is W25Q16JVSSIM - note the IM at the end means it comes out of the factory for the QE bit (located in status register 2, bit position 1) set to 0, whereas it does of course need to be set to 1 so that QSPI reads can be performed. Datasheet: https://www.mouser.co.uk/datasheet/2/94 ... 489664.pdf
Thanks for sharing! I'm using W25Q16JVSNIQ, so the QE bit should already be 1, but I'm seeing the same error on a batch of first-articles.

We've built several batches of prototype boards successfully with XU316, all using W25Q16JVSNIQ. On today's boards, the XU316 will not boot, despite no changes to layout or BOM. The W25Q16JVSNIQ chips were programmed by a third-party and tested successfully on prototype boards.

Attempting to write firmware via JTAG returns "Error F03013". All supply rails are okay. Worth noting, the XU316's `RST_N` line momentarily initializes to 0.4V, then reaches 1.8V nominal. On previous boards, the same pin transitions directly from 0 to 1.8V.


I tried your command in XTC 15.1.4, which returned "F03140 Unrecognised option --spi-cmd". "--read-status" is also unrecognized. What am I missing here?

Edit: Pleased to report this was not a firmware/flash issue. The XU316s are floating due to a missing GND pad cutout in the production stencil. No idea how this was avoided throughout the past year of prototypes. 🤦‍♂️
michaelf
Member++
Posts: 20
Joined: Thu Mar 14, 2024 7:44 pm

Post by michaelf »

jseaber wrote: Mon Nov 11, 2024 11:48 pm
michaelf wrote: Mon Nov 11, 2024 6:33 am Problem solved for me - it was the QE bit not being set out of the factory. The specific flash chip we are using is W25Q16JVSSIM - note the IM at the end means it comes out of the factory for the QE bit (located in status register 2, bit position 1) set to 0, whereas it does of course need to be set to 1 so that QSPI reads can be performed. Datasheet: https://www.mouser.co.uk/datasheet/2/94 ... 489664.pdf
I tried your command in XTC 15.1.4, which returned "F03140 Unrecognised option --spi-cmd". "--read-status" is also unrecognized. What am I missing here?
Apologies, I meant --spi-read-status as per the documentation. I've edited my post accordingly.