gowin: fix GW5A external flash writes being erased by hardware auto-erase
The Reinit command (0x3F) sent in gw5a_enable_spi() triggers a hardware-initiated bulk erase of the external SPI flash (status register bit 31 'auto_erase'). The code previously proceeded immediately to flash programming, creating a race condition where the ongoing background erase would corrupt or wipe written data. Fix by polling the status register after Reinit until the auto_erase bit clears before continuing with SPI bridge setup and flash operations. Also reset the SPI flash chip in programExtFlash() before releasing the JTAG-SPI bridge, ensuring the flash is in standard SPI mode for the hardware boot loader. Tested on GW5AT-15 (idcode 0x0001681b) with XTX XT25F128B flash.
This commit is contained in:
parent
816d6558fe
commit
18c37faeda
1412
src/gowin.cpp
1412
src/gowin.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue