File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed
Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -394,13 +394,6 @@ void Gowin::programSRAM()
394394 if (!eraseSRAM ())
395395 return ;
396396
397- /* GW5AST-138k WA. Temporary until found correct solution/sequence */
398- if (is_gw5a && _idcode == 0x0001081b ) {
399- printf (" double eraseSRAM\n " );
400- if (!eraseSRAM ())
401- return ;
402- }
403-
404397 /* load bitstream in SRAM */
405398 if (!writeSRAM (_fs->getData (), _fs->getLength ()))
406399 return ;
@@ -912,13 +905,18 @@ bool Gowin::eraseSRAM()
912905 displayReadReg (" before erase sram" , status);
913906
914907 // If flash is invalid, send extra cmd 0x3F before SRAM erase
915- // This is required on GW5A-25
916- bool auto_boot_2nd_fail = (status & 0x8 ) >> 3 ;
917- if ((_idcode == 0x0001281B ) && auto_boot_2nd_fail)
918- {
919- disableCfg ();
908+ // This is required on GW5A-25 or GW5AST-138 when timeout bit
909+ // is set
910+ bool auto_boot_2nd_fail = (status & (1 << 4 )) == (1 << 4 );
911+ bool is_timeout = (status & (1 << 3 )) == (1 << 3 );
912+ if (is_gw5a && (is_timeout || auto_boot_2nd_fail)) {
913+ send_command (CONFIG_ENABLE);
920914 send_command (0x3F );
915+ send_command (CONFIG_DISABLE);
916+ send_command (NOOP);
917+ send_command (READ_IDCODE);
921918 send_command (NOOP);
919+ _jtag->toggleClk (125 * 8 );
922920 }
923921
924922 if (!enableCfg ()) {
You can’t perform that action at this time.
0 commit comments