openFPGALoader: Cannot program Tang Nano 20k: CRC Error / ID Verify Failed

I’m trying to program a blink example on my Tang Nano 20k, however the sketch won’t load. During the process of flashing to SRAM, I get the following errors CRC Error and ID Verify Failed when using the following command: openFPGALoader -b tangnano20k Blink.fs --verbose-level 2 --freq 2500000

The full output of the command is

empty
Jtag frequency : requested 2.50MHz   -> real 2.50MHz  
Raw IDCODE:
- 0 -> 0x0000081b
- 1 -> 0xffffffff
Fetched TDI, end-of-chain
found 1 devices
index 0:
        idcode 0x81b
        manufacturer Gowin
        family GW2A
        model  GW2A(R)-18(C)
        irlength 8
File type : fs
Parse file Parse Blink.fs: 
checksum 0x94cb
Done
DONE
bitstream header infos
CRCCheck: ON
Compress: OFF
ConfDataLength: 1342
LoadingRate: 2500000
ProgramDoneBypass: OFF
SPIAddr: 00000000
SecurityBit: ON
idcode: 0000081b
before program sram: displayReadReg 002005fa
        Bad Command
        Timeout
        Reserved4
        Memory Erase
        Preamble
        System Edit Mode
        Program SPI FLASH directly
        Non-JTAG configuration is active
Erase SRAM before erase sram: displayReadReg 02fa0000
        FLASH lock
pollFlag: 80000000 (0)
pollFlag: 1005fa05 (0)
pollFlag: 7d000000 (0)
pollFlag: 20 (0)
pollFlag: 2005fa (80)
pollFlag: 2fa0000 (0)
pollFlag: 80000000 (0)
pollFlag: 2005 (0)
pollFlag: 7d05fa00 (0)
pollFlag: 2005fa (20)
after erase sram: displayReadReg 02fa0000
        FLASH lock
pollFlag: 80000000 (0)
Load SRAM before write sram: displayReadReg 00002005
        CRC Error
        ID Verify Failed
        Done Final
Load SRAM: [==================================================] 100.00%
Done
after write sram: displayReadReg 1005fa00
        Reserved9
        Bypass
        Gowin VLD
        Done Final
        Security Final
        Ready
        POR
        FLASH2 lock
DONE
after program sram: displayReadReg 7d000000

I’m using openFPGALoader version 0.13.1 on Debian. I’ve tried:

  • multiple bitstreams, both generated with the open-source toolchain apicula and the Gowin Eda;
  • flashing with Gowin Programmer on Windows, this works, so the both bitstreams are verified to be working;

Can somebody give me some guidance to solve this error and/or to flash the Tang Nano 20K, so I can move the whole process to the open source toolchain on Linux?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 16 (13 by maintainers)

Most upvoted comments

I just upgraded the Tang Nano 20k to the new firmware by following the steps here. I think the steps to follow are really clear.

Then I tried flashing my project

write to flash
Jtag frequency : requested 6.00MHz   -> real 6.00MHz  
Parse file Parse platform_tangnano20k.fs: 
Done
DONE
after program flash: displayReadReg 00006020
        Memory Erase
        Done Final
        Security Final
Erase SRAM DONE
Jtag probe limited to %d MHz6000000
Jtag frequency : requested 10.00MHz  -> real 6.00MHz  
JEDEC ID: 0xef4017
Detected: Winbond W25Q64 128 sectors size: 64Mb
JEDEC ID: 0xef4017
Detected: Winbond W25Q64 128 sectors size: 64Mb
RDSR : 0x00
WIP  : 0
WEL  : 0
BP   : 0
TB   : 0
SRWD : 0
00000000 00000000 00000000 00
start addr: 00000000, end_addr: 00090000
Erasing: [==================================================] 100.00%
Done
Writing: [==================================================] 100.00%
Done

It works flawlessly. The error was thus in the firmware of the debugger and not in openFPGALoader.

Many thanks for the support from this community!

Thank you very much!

I’ve the time to try this out tonight.

I see there is now a sipeed wiki page with instructions and links to “debugger firmware”. I haven’t tried an update yet. https://wiki.sipeed.com/hardware/en/tang/common-doc/update_debugger.html

I see also a download area on sipeed’s site: https://api.dl.sipeed.com/TANG/Debugger/onboard/BL616/

Right now there’s a subdirectory called 202501231x with firmware for the BL616 on the Tang Nano 20k. I’m told by sipeed support that this should fix the problem - but again, I haven’t tried it.

I don’t know about re-downgrading in case of a problem, but there are two unofficial saved versions of the debugger firmware at https://github.com/harbaum/MiSTeryNano/tree/main/firmware/friend_20k

@hoglet67 thanks! True I have already seen this issue too (but unfortunately not with one off boards I have). Some contribs have been done to add work around for this firmware’s version but it look like not enough.

I have to ask @sipeed where to find the firmware to update BL616 and/or if firmware has been updated fixed since this version.