LPC11U24 Flash re-program using IAP

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

LPC11U24 Flash re-program using IAP

984 Views
lpcware
NXP Employee
NXP Employee
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.

Labels (1)
0 Kudos
4 Replies

726 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rama krishna deekshitulu on Thu Feb 25 04:45:42 MST 2016

I'm developed application for FOTA by using lpc1225. I would like to clarify my current situation, my code is split into two parts. The boot loader flashes an OTA upgrade using IAP and then jumps to the newly flashed code. My issue starts at this point where jumping to the new code sector using assembly to load the appropriate registers (SP & PC) with address to the values at the new application SP and PC locations.

New application code without SysTick runs fine and works normal but code that includes it tends to freeze.Do i need to do something specific to use SysTick timer with the secondary boot loader.

Does the application code need a specific sequence of code to use SysTick after jumping from bootloader or is this something that needs to be done before jumping to application in the bootloader. please anyone can help me..
0 Kudos

726 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by romanleonov on Thu Jun 25 03:11:38 MST 2015
Hmm...
I did not try to copy the vector table to SRAM, before erasing the FLASH sector 0.

But I do not TRY, I should READ the documentation! :) In this doc AN11511 everything write so clear and accessibly. Wow, why did I not find this doc before.

Thank you so much, nerd herd!!

Now it's working well: I write everything to sector 0 of FLASH successfull. Indeed if I copyed and remapped Interrupt Vector Table to SRAM before erasing the sector 0 of FLASH.
Copy part execute like described in AN11511 on page 10, figure 7.
Remap part execute with write to register SYSMEMREMAP value 0x01, like described in the user manual for my processor.

Thanks again! Best regards!

0 Kudos

726 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Wed Jun 24 08:37:14 MST 2015
Hi romanleonov,

I have not done what you are trying to do before -- that is, rewriting flash sector 0. In general you should erase the flash sector before rewriting it with IAP commands. You should definitely also copy the vector table into SRAM when you do IAP commands because the flash becomes unavailable while the actual erase/write commands are executing. There is an AN explaining IAP in greater detail for the LPC11U68 that you can use for reference, but it will not tell you how to do exactly what you are trying to do.

http://www.lpcware.com/content/nxpfile/an11511-lpc11u6x-application-programming

Let me know if you run into more issues.
0 Kudos

726 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Tue Jun 23 05:19:30 MST 2015
If i'm not mistaken you should erase the flash before writing to it since only the 0's are written to it. Flash contents is &FFH after erasing.
0 Kudos