IAP flash erase not working

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

IAP flash erase not working

642件の閲覧回数
lpcware
NXP Employee
NXP Employee
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.
ラベル(1)
0 件の賞賛
3 返答(返信)

578件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by laser_scientist on Sat Dec 05 10:41:19 MST 2015
Thanks for the reply, I just discovered that. It was missing in the periph_flashiap_flashsig example I had pulled from.
0 件の賞賛

578件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by laser_scientist on Sat Dec 05 10:39:35 MST 2015
Okay, thanks to this post, I figured it out. The LPC flash write example was missing a key line in the erase call:

command[3] = SystemCoreClock / 1000;


So that block should be:

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

0 件の賞賛

578件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by DF9DQ on Sat Dec 05 10:37:58 MST 2015
The erase command requires the clock frequency in kHz specified as a parameter.
0 件の賞賛