From a113d4da0dfcf5b065e329a3e3df9bef43b607ad Mon Sep 17 00:00:00 2001 From: Doug Brown Date: Wed, 2 Aug 2023 21:01:30 -0700 Subject: [PATCH] Don't restrict to erasing the first 2 MB of a "2 MB" SIMM The problem is that over time, the meaning of curChipType has changed. It was originally meant to exactly map to chips (four SST39SF040 chips or four M29F160FB5AN6E2 chips) but over time its meaning has shifted to simply indicating whether the unlock address needs to be shifted or not. When curChipType is ParallelFlash_SST39SF040_x4, sometimes the programming size is 4 MB or 8 MB. So don't restrict it to 2 MB. Note that the erase sector sizes are just plain wrong in this case. In the future I should read the chip ID and keep a table of sector sizes for each known chip ID. --- simm_programmer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simm_programmer.c b/simm_programmer.c index b79fbea..450817f 100644 --- a/simm_programmer.c +++ b/simm_programmer.c @@ -536,9 +536,9 @@ static void SIMMProgrammer_HandleErasePortionReadPosLengthByte(uint8_t byte) // Ensure they are within the limits of the chip size too if (chipType == ParallelFlash_SST39SF040_x4) { - if (boundary <= (2 * 1024UL * 1024UL)) + if (boundary <= (8 * 1024UL * 1024UL)) { - // OK! We're erasing certain sectors of a 2 MB SIMM. + // OK! We're erasing certain sectors of a SIMM. USBCDC_SendByte(ProgrammerErasePortionOK); // Send the response immediately, it could take a while. USBCDC_Flush(); @@ -553,7 +553,7 @@ static void SIMMProgrammer_HandleErasePortionReadPosLengthByte(uint8_t byte) { if (boundary <= (8 * 1024UL * 1024UL)) { - // OK! We're erasing certain sectors of an 8 MB SIMM. + // OK! We're erasing certain sectors of a SIMM. USBCDC_SendByte(ProgrammerErasePortionOK); // Send the response immediately, it could take a while. USBCDC_Flush();