src/gowin: GW5A/SPI flash: adding delay after erase flash and after SPI mode instruction. Seems fixed write error.

This commit is contained in:
Gwenhael Goavec-Merou 2024-01-09 18:48:21 +01:00
parent 62ad3a3003
commit 0b59efcb42
1 changed files with 8 additions and 2 deletions

View File

@ -1144,18 +1144,22 @@ bool Gowin::dumpFlash(uint32_t base_addr, uint32_t len)
bool Gowin::prepare_flash_access()
{
_jtag->setClkFreq(10000000);
if (!eraseSRAM()) {
printError("Error: fail to erase SRAM");
return false;
}
if (is_gw5a) {
if (!eraseSRAM()) {
printError("Error: fail to erase SRAM");
return false;
}
usleep(100000);
if (!gw5a_enable_spi()) {
printError("Error: fail to switch GW5A to SPI mode");
return false;
}
usleep(100000);
} else if (!is_gw2a) {
if (!enableCfg()) {
return false;
@ -1163,6 +1167,8 @@ bool Gowin::prepare_flash_access()
send_command(0x3D);
}
_jtag->setClkFreq(10000000);
return true;
}