Error: F03013 SPI flash issues on XK-AUDIO-316-MC-AB and same on custom board

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
XmaCE
New User
Posts: 2
Joined: Fri Sep 19, 2025 1:17 pm

Error: F03013 SPI flash issues on XK-AUDIO-316-MC-AB and same on custom board

Post by XmaCE »

Hi XMOS gurus,

after working with the EVK for a while (XK-AUDIO-316-MC-AB) it stopped accepting SPI commands using xflash. I can still xrun, xgdb etc, but it seems the Xcore reads all 0 from the SPI flash.
next, the same happened on my custom board. I did flash various images and debug just fine, then it stopped working in the same manner.

I searched the forums and found out about the QE bit, and the toolchain issue WRT "--spi-div=8" but that doesn't seem to be my issue. one of the main problems seems to be that even the chip-id cannot be read, it always reports "Site 0 has ID 0x000000"

please help me unbrick the original EVK and my custom board.

In an attempt to do so, I had changed the 10k pull-up resistor to 1k as it's is documented, but that didn't change things.

here's the full log (they're identical for both boards):
% cat xmos_evk.log
% xflash -v --spi-div=8  bin/project/board.xe
XFlash_Options::ListDevices : xrun --list-devices devl-6e9b54cd 
XFlash_Application found _start :80000 on Node 0
XFlash_Application found _DoSyscall :88180 on Node 0
XFlash_Application found _DoException :800c4 on Node 0
XFlash_Application found _start :80000 on Node 0
XFlash_Application found _DoSyscall :822c4 on Node 0
XFlash_Application found _DoException :800c4 on Node 0
XFlash::DoXFlash
XFlash::DoImageProgramming
XFlash::GetDeviceInfo
XFlash_DeviceInfo::GetDeviceInfo_User
XFlash_DeviceInfo::PrintDeviceInfo
  Site 0 (bootFlash) info:
    _device_size 0x400000
    _device_page_size 0x100
    _regular_sector_sizes true
    _device_sector_size 0x1000
    _device_protection_available false
    _device_divider 8
    _device_first_user_sector 0x0
    _device_search_limit 0x400000
XFlash::BuildFlashBinaryFile
XFlash_Builder_S2L::BuildStage2Loaders Factory
Stage2_Loader::Compile : xcc -Wno-bidirectional-buffered-port -Wno-timing -Wno-unused-function -Xmapper --dontenablesodlinks -Xmapper --nochaninit -Xmapper --noinitialtidy -Xmapper --image-base -Xmapper 0x80080 -Xmapper --image-size -Xmapper 0x7ff80 -Xmapper --wno110 -Xmapper --wno226 -Xmapper --wnoXN -std=gnu99 -O2 -target=XU316-1024-FB265-C32 -x none "/home/name/CODE/XMOS/toolchain/XMOS/XTC/15.3.1/target/app/xs3a/stage2loader_SQI.o" -lstage2loader -lsqiaccess -lquadspi -llocks -o s2l-n0-4632bcfe
Stage2Loader found DEVICE_SECTOR_WORD_SIZE : 0x81650 on Node 0
Stage2Loader found pllConfig : 0x815f8 on Node 0
Stage2Loader found otp_disable : 0x81654 on Node 0
Stage2Loader found debug_stop : 0x81658 on Node 0
Stage2Loader found s2l_record_timings : 0x81644 on Node 0
Stage2Loader found s2l_search_by_address : 0x81648 on Node 0
Stage2Loader found s2l_num_addresses : 0x8164c on Node 0
Stage2Loader found s2l_search_addresses : 0x815b8 on Node 0
Stage2Loader found flash_ports : 0x815c8 on Node 0
Stage2Loader found clock_config : 0x815d8 on Node 0
Stage2Loader found qe_config : 0x815f0 on Node 0
Stage2Loader found spanning_routing_id : 0x8250c on Node 0
Stage2Loader found spanning_table : 0x81388 on Node 0
Stage2Loader found num_spanning_tables : 0x82510 on Node 0
Stage2Loader found routing_table : 0x81ab8 on Node 0
Stage2Loader found num_routing_tables : 0x82514 on Node 0
Stage2Loader found link_info : 0x81c48 on Node 0
Stage2Loader found links_table : 0x81e28 on Node 0
Stage2Loader found num_link_tables : 0x82518 on Node 0
Stage2Loader found galaxian_table : 0x82328 on Node 0
Stage2Loader found num_galaxian_tables : 0x8251c on Node 0
Stage2Loader found pll_table : 0x823a0 on Node 0
Stage2Loader found debug_stop : 0x82524 on Node 0
Stage2Loader found secondaryPllConfig : 0x823c0 on Node 0
Stage2Loader found ddrConfig : 0x823d0 on Node 0
Stage2Loader found ddrEnable : 0x82520 on Node 0
XFlash_Builder_Image::BuildImages Factory
XFlash_Builder_Image::BuildImageTable
  master node = 0
    node = 0
XFlash_Builder_Image::BuildImageTable num cores for image table = 2
XFlash_Builder_Image::CalculateBufferSize Starting calculation _total_image_size=0
XFlash_Builder_Image::CalculateBufferSize Add Image Header _total_image_size=38
XFlash_Builder_Image::CalculateBufferSize Add Switch Setup header _total_image_size=40
XFlash_Builder_Image::CalculateBufferSize Add Per Core header _total_image_size=80
XFlash_Builder_Image::CalculateBufferSize_SwitchSetup _total_image_size=25ac
XFlash_Builder_Image::CalculateBufferSize_Application application size = c9c0 _total_image_size = ef6c
XFlash_Builder_Image::CalculateBufferSize_Application application size = 4094 _total_image_size = 13000
XFlash_Builder_Image::BuildImageTable allocated image buffer size = 13000
XFlash_Builder_Image::WriteBuffer_ImageHeader
XFlash_Builder_Image::WriteBuffer_SwitchSetup current switch setup table offset : 38
XFlash_Builder_Image::WriteBuffer_SwitchSetup current application data offset : 80
XFlash_Builder_Image::WriteBuffer_SwitchSetup size : 2528
XFlash_Builder_Image::WriteBuffer_SwitchSetup aligned_size : 252c
XFlash_Builder_Image::WriteBuffer_SwitchSetup init_vec_shift : 0
XFlash_Builder_Image::WriteBuffer_Application
XFlash_Builder_Image::WriteBuffer_Application for node : 0
XFlash_Builder_Image::WriteBuffer_Application for core : 0
XFlash_Builder_Image::WriteBuffer_Application current core table offset : 40
XFlash_Builder_Image::WriteBuffer_Application current application data offset : 25ac
XFlash_Builder_Image::WriteBuffer_Application size : c9bc
XFlash_Builder_Image::WriteBuffer_Application aligned_size : c9c0
XFlash_Builder_Image::WriteBuffer_Application init_vec_shift : 0
XFlash_Builder_Image::WriteBuffer_Application chan end : 80020002
XFlash_Builder_Image::WriteBuffer_Application for core : 1
XFlash_Builder_Image::WriteBuffer_Application current core table offset : 60
XFlash_Builder_Image::WriteBuffer_Application current application data offset : ef6c
XFlash_Builder_Image::WriteBuffer_Application size : 4090
XFlash_Builder_Image::WriteBuffer_Application aligned_size : 4094
XFlash_Builder_Image::WriteBuffer_Application init_vec_shift : 0
XFlash_Builder_Image::WriteBuffer_Application chan end : 80030002
XFlash_Builder_Image::WriteBuffer_SwMem
XFlash_Builder_Image::WriteBuffer_SwMem for node : 0
XFlash_Builder_Image::WriteBuffer_SwMem for core : 0
XFlash_Builder_Image::WriteBuffer_SwMem current core table offset : 40
XFlash_Builder_Image::WriteBuffer_SwMem current application data offset : 13000
XFlash_Builder_Image::WriteBuffer_SwMem for core : 1
XFlash_Builder_Image::WriteBuffer_SwMem current core table offset : 60
XFlash_Builder_Image::WriteBuffer_SwMem current application data offset : 13000
XFlash_Builder_Image::WriteBuffer_ExtMem
XFlash_Builder_Image::WriteBuffer_ExtMem for node : 0
XFlash_Builder_Image::WriteBuffer_ExtMem for core : 0
XFlash_Builder_Image::WriteBuffer_ExtMem current core table offset : 40
XFlash_Builder_Image::WriteBuffer_ExtMem current application data offset : 13000
XFlash_Builder_Image::WriteBuffer_ExtMem for core : 1
XFlash_Builder_Image::WriteBuffer_ExtMem current core table offset : 60
XFlash_Builder_Image::WriteBuffer_ExtMem current application data offset : 13000
XFlash_Builder_Image::WriteBuffer_CRC
XFlash_Builder_Binary::BuildBinary
XFlash_Builder_Binary::CalculateBufferSize_Factory
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding s2l size word (4)4
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding s2l app (1668) 166c
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding s2l crc (4)1670
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding factory app (13000) 14670
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding sector padding (990) 15000
XFlash_Builder_Binary::CalculateBufferSize_Factory : First User Sector offset = 15000
XFlash_Builder_Binary::GetSearchLimitPadding : current size (15000) 0
XFlash_Builder_Binary::CalculateBufferSize_Data
XFlash_Builder_Binary::BuildBinary : Allocating buffer - 15000
XFlash_Builder_Binary::GetSearchLimitPadding : current size (15000) 0
XFlash_Builder_Binary::WriteBufferToBinary : flash_bin_node0
XFlash_Builder_Storage_PPB::BuildStorage
XFlash_Programmer_Write::DoWrite
XFlash_Programmer_Write::IssueCompileCommand
xcc -w -Xmapper --dontenablesodlinks -Xmapper --errdemote130 -Xmapper --errdemote131 -x xn "target-xn-v0-6b3fe8a9" -O2 -lquadflash -llocks -D xnPORT_SQI_CS0=PORT_SQI_CS -D xnPORT_SQI_SCLK0=PORT_SQI_SCLK -D xnPORT_SQI_SIO0=PORT_SQI_SIO -x xc "fw-b72a2060" -o "fw-2ad6d7da" 
XFlash_Utils::BuildRunCommand : xrun --io fw-2ad6d7da 
Site 0 has started.         
Site 0 has ID   0x000000.   
Site 0 erase    0x00000000. 
Site 0 write    0x00000000. 
Verify failed for page 0x00000000, offset 0x0000 (read 0x00, expected 0xa9).

[long timeout]

xrun: Error: Timed out. First stage multi-node boot failed, please check XN file and Xmos link connectivity.
Error: F03013 Failed to run : xrun --io fw-2ad6d7da 
xflash -v --spi-div=8 bin/project/board.xe  7.64s user 1.60s system 5% cpu 2:35.70 total

XmaCE
New User
Posts: 2
Joined: Fri Sep 19, 2025 1:17 pm

Post by XmaCE »

in the meantime I read the SPI flash fine using a SOIC8 clip, and a ch341a interface. the flash contents are there, and not all 0 (they also start with 0xa9).

now since I have a proper HW interface to the SPI chip, I also hacked up some python (AI did) to dump the status regs, and I could confirm e.g. the QE bit is correctly set:


% ./ch341a_status_reader.py 
W25Q32JV Status Register Reader (CH341a USB)
============================================
Scanning for CH341a devices...
Found CH341a device
✓ Connected to CH341a successfully
Initializing CH341a...
✓ CH341a initialized in SPI mode

Reading JEDEC ID...
JEDEC ID: EF 40 16
✓ W25Q32JV detected correctly

Reading all status registers...

=== Status Register 1 (0x05) ===
Raw value: 0x00 (0b00000000)
Bit breakdown:
  Bit 7 (SRP0): 0 - Status Register Protect 0
  Bit 6 (SEC):  0 - Sector Protect
  Bit 5 (TB):   0 - Top/Bottom Protect
  Bit 4 (BP2):  0 - Block Protect 2
  Bit 3 (BP1):  0 - Block Protect 1
  Bit 2 (BP0):  0 - Block Protect 0
  Bit 1 (WEL):  0 - Write Enable Latch
  Bit 0 (BUSY): 0 - Busy

=== Status Register 2 (0x35) ===
Raw value: 0x02 (0b00000010)
Bit breakdown:
  Bit 7 (SUS):  0 - Suspend Status
  Bit 6 (CMP):  0 - Complement Protect
  Bit 5 (LB3):  0 - Security Register Lock 3
  Bit 4 (LB2):  0 - Security Register Lock 2
  Bit 3 (LB1):  0 - Security Register Lock 1
  Bit 2 (Reserved): 0
  Bit 1 (QE):   1 - Quad Enable
  Bit 0 (SRP1): 0 - Status Register Protect 1

=== Status Register 3 (0x15) ===
Raw value: 0x60 (0b01100000)
Bit breakdown:
  Bit 7 (Reserved): 0
  Bit 6 (Reserved): 1
  Bit 5 (WPS):  1 - Write Protect Selection
  Bit 4 (Reserved): 0
  Bit 3 (Reserved): 0
  Bit 2 (DRV1): 0 - Output Driver Strength 1
  Bit 1 (DRV0): 0 - Output Driver Strength 0
  Bit 0 (Reserved): 0
  Driver Strength: 100%

=== SUMMARY ===
Status Register 1: 0x00
Status Register 2: 0x02
Status Register 3: 0x60

any way I can further debug this from here?