lpcware

LPC11U24 Flash re-program using IAP

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by romanleonov on Wed Jun 17 06:53:51 MST 2015
Hello everybody! Have a nice day to all.

I'm try to write an application with using the IAP mode. Description is the following: I try to rewrite some blocks of FLASH memory, for example, starting from 0x00000000 and ending by 0x000000F (indeed I reprogram the whole sector of FLASH, and it's need me to copy the FLASH sector to the RAM buf, rewrite some bytes in the RAM buf and then, with using of IAP_Copy_RAM_To_FLASH function copy the whole pre-saved RAM buffer with changes to flash). But after doing this, I have some strange result in the FLASH memory: the data in unexpectable. If I do something like this not in the sector0 (0x00000000 - 0x00001000) - everything is ok and the saved data in FLASH is expectable.

I suppose the following results:
1) IAP-code, which is placed in the RAM, using the Interrupt Vector Table placed in the bottom of FLASH (start adress 0x00000000). Thus, if we rewrite the vector table everything is very-very bad.
2) If no, is it a correct way to replace some bytes in FLASH, not whole sector? Yes, it is not so reasonably, but I think there is only one way to do it. Am I correct?
3) Must I erase the sector before writing new data? I know that the ECC (Error Correction Code) is rewrite only after erase. But if I erase the sector0, I can't then copy ram to flash. Do I something wrong or not?

I tryed to write my problem very closely and in detail.
Is there some ideas?
Many thanks!

Roman.

Outcomes