lpcware

IAP flash erase not working

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by laser_scientist on Sat Dec 05 09:09:44 MST 2015
Hello. I am working with an LPC11E14 using the IAP routines to clear the last sector of flash, like this:


__disable_irq();

// Prepare to write/erase
command[0] = IAP_PREWRRITE_CMD;// Prepare to write/erase command code
command[1] = DATA_SECTOR_START;
command[2] = DATA_SECTOR_END;
iap_entry(command, result);

if(result[0] != IAP_CMD_SUCCESS)
return ERROR_SETUP;

// Erase
command[0] = IAP_ERSSECTOR_CMD;// Erase command code
command[1] = DATA_SECTOR_START;
command[2] = DATA_SECTOR_END;
iap_entry(command, result);

if(result[0] != IAP_CMD_SUCCESS)
return ERROR_ERASE;

// Re-enable interrupt mode
__enable_irq();


I expect the sectors from DATA_SECTOR_START to DATA_SECTOR_END to be clear (0xFF), but it's not getting erased, even though the result from both operations is successful. Has anyone seen this behavior, or have an idea of what might be happening? Thanks in advance for any assistance.

Outcomes