I'm using flash routines downloaded from the Freescale website to erase / reprogram flash memory. My applications calls the flash erase command repeatedly in a loop incrementing the address pointer by 0x200 (the flash sector size) each time, so that the next secotr is erased until the entire region to be erased is erased. I get an error however when the erase flash routines are called.
On examining (taking care not to interrupt the actual flash procedure with the BDM) this with the debugger, I've noticed that there is always a breakdown on either the second or the third sector of flash that needs to be erased.
One thought was that this may be because a certain time is required for a flash erase command to complete and maybe we need to put in a delay between successive calls to erase flash sectors. Could this be a problem?
Any other suggestions what could cause such behaviour?