From b09012621bafa58a66557a21a05a0bdf9d2c99bf Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Wed, 12 Jun 2019 12:22:07 +0200 Subject: [PATCH] Update default flash bulk-erase timeout and improve developer documentation regarding timeouts. --- src/main/drivers/flash_m25p16.c | 8 +++++--- src/main/drivers/flash_w25n01g.c | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/drivers/flash_m25p16.c b/src/main/drivers/flash_m25p16.c index 88d879af6f..8462a999d9 100644 --- a/src/main/drivers/flash_m25p16.c +++ b/src/main/drivers/flash_m25p16.c @@ -68,12 +68,14 @@ #define JEDEC_ID_CYPRESS_S25FL128L 0x016018 #define JEDEC_ID_BERGMICRO_W25Q32 0xE04016 +// IMPORTANT: Timeout values are currently required to be set to the highest value required by any of the supported flash chips by this driver. + // The timeout we expect between being able to issue page program instructions #define DEFAULT_TIMEOUT_MILLIS 6 - -// These take sooooo long: #define SECTOR_ERASE_TIMEOUT_MILLIS 5000 -#define BULK_ERASE_TIMEOUT_MILLIS 21000 + +// etracer65 notes: For bulk erase The 25Q16 takes about 3 seconds and the 25Q128 takes about 49 +#define BULK_ERASE_TIMEOUT_MILLIS 50000 #define M25P16_PAGESIZE 256 diff --git a/src/main/drivers/flash_w25n01g.c b/src/main/drivers/flash_w25n01g.c index 585402b496..01fd26b807 100644 --- a/src/main/drivers/flash_w25n01g.c +++ b/src/main/drivers/flash_w25n01g.c @@ -122,6 +122,8 @@ serialPort_t *debugSerialPort = NULL; #define W25N01G_BLOCK_TO_PAGE(block) ((block) * W25N01G_PAGES_PER_BLOCK) #define W25N01G_BLOCK_TO_LINEAR(block) (W25N01G_BLOCK_TO_PAGE(block) * W25N01G_PAGE_SIZE) +// IMPORTANT: Timeout values are currently required to be set to the highest value required by any of the supported flash chips by this driver + // The timeout values (2ms minimum to avoid 1 tick advance in consecutive calls to millis). #define W25N01G_TIMEOUT_PAGE_READ_MS 2 // tREmax = 60us (ECC enabled) #define W25N01G_TIMEOUT_PAGE_PROGRAM_MS 2 // tPPmax = 700us