LPC1857, Chip_IAP_ErasePage(addr_start, addr_start) fail!

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1857, Chip_IAP_ErasePage(addr_start, addr_start) fail!

1,362 Views
KellyZou
Contributor I

Hi Guys,

I want to use the internal flash for saving some data in BANK B with Sector_64KB.

I only succeeded in writing data to the fronter pages(1024B) of this sector a few times. 

But now it is no possible to erase the page anymore, the code is stucked in Chip_IAP_ErasePage().

Here is my steps:

1. Chip_IAP_PreSectorForReadWrite(sector, bankB)

    -- ret_code = IAP_CMD_SUCCESS;

2. Chip_IAP_ErasePage(addr_start, addr_start)

    -- stucked. (But it successed for a few times)

 

Please help what I can do.

Thanks.

 

 

Labels (1)
0 Kudos
5 Replies

1,349 Views
KellyZou
Contributor I

Thank you Mr.Zhang

 

I did do the same step as you did, but it didn't work.

Is there any misunderstanding about the erase process?

 

__disable_irq();
ret_code = Chip_IAP_PreSectorForReadWrite(sector, sector, bank);
/* Error checking */
if (ret_code != IAP_CMD_SUCCESS) {
return ret_code;
}


/* Only erase a page */
ret_code = Chip_IAP_ErasePage(addr_page_start, addr_page_start);

/* Error checking */
if (ret_code != IAP_CMD_SUCCESS) {
}
__enable_irq();

0 Kudos

1,345 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Did you check the error code?

0 Kudos

1,343 Views
KellyZou
Contributor I

No, just stucked in the function Chip_IAP_ErasePage().

0 Kudos

1,339 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Can I reproduce your issue with NXP demo code? Please let me know the the demo link and name. Thanks.

0 Kudos

1,351 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

In order to erase a page , please make sure you prepare that particular sector beforehand.
Following code will erase first page in Bank B.

/* Prepare sector 0 in Bank B*/

ret_code = Chip_IAP_PreSectorForReadWrite(0, 0, IAP_FLASH_BANK_B);
 
/* Error checking */
if (ret_code != IAP_CMD_SUCCESS) {
while(1);
DEBUGOUT("Command failed to execute, return code is: %x\r\n", ret_code);
}
/* Erase Page */
Chip_IAP_ErasePage(START_PAGE_ADDR,END_PAGE_ADDR);
 
Thanks,
Jun Zhang
0 Kudos