diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 8db64cf70..8d17d7115 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1564,15 +1564,16 @@ void __attribute__((noreturn)) AppMain(void) { usart_init(); #endif -#ifdef WITH_FLASH - loadT55xxConfig(); -#endif - // This is made as late as possible to ensure enumeration without timeout // against device such as http://www.hobbytronics.co.uk/usb-host-board-v2 usb_disable(); usb_enable(); +#ifdef WITH_FLASH + // If flash is not present, BUSY_TIMEOUT kicks in, let's do it after USB + loadT55xxConfig(); +#endif + for (;;) { WDT_HIT(); diff --git a/armsrc/flashmem.c b/armsrc/flashmem.c index 47a9b8c97..3ec746074 100644 --- a/armsrc/flashmem.c +++ b/armsrc/flashmem.c @@ -521,10 +521,10 @@ void Flashmem_print_status(void) { Dbprintf(" Baudrate................%dMHz", FLASHMEM_SPIBAUDRATE / 1000000); if (!FlashInit()) { - DbpString(" Init....................FAIL"); + DbpString(" Init...................." _RED_("FAILED")); return; } - DbpString(" Init....................OK"); + DbpString(" Init...................." _GREEN_("OK")); uint8_t dev_id = Flash_ReadID(); switch (dev_id) { @@ -538,7 +538,7 @@ void Flashmem_print_status(void) { DbpString(" Memory size.............512 kbits / 64kb"); break; default : - DbpString(" Device ID............... --> Unknown <--"); + DbpString(" Device ID..............." _YELLOW_(" --> Unknown <--")); break; } diff --git a/armsrc/flashmem.h b/armsrc/flashmem.h index d899a4d31..db0c70790 100644 --- a/armsrc/flashmem.h +++ b/armsrc/flashmem.h @@ -61,7 +61,8 @@ #define SUSPEND 0x75 #define RESUME 0x7A -#define BUSY_TIMEOUT 1000000000L +// Flash busy timeout: 20ms is the strict minimum when writing 256kb +#define BUSY_TIMEOUT 50000L #define WINBOND_MANID 0xEF #define WINBOND_DEVID 0x11 diff --git a/common/i2c.c b/common/i2c.c index cf4614c18..0b26bb0dc 100644 --- a/common/i2c.c +++ b/common/i2c.c @@ -600,7 +600,7 @@ void I2C_print_status(void) { if (len > 0) Dbprintf(" version.................v%x.%02d", resp[0], resp[1]); else - DbpString(" version.................FAILED"); + DbpString(" version................." _RED_("FAILED")); } // Will read response from smart card module, retries 3 times to get the data.