Program Flash Memory Swap in MK22FN1M0VLL12

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

Program Flash Memory Swap in MK22FN1M0VLL12

582 Views
anujtanksali
Contributor II

Hello, 

I will be using MK22FN1M0VLL12 device with OTA. I believe this device supports the program flash memory swap feature where lower half of flash is active and upper half is inactive area where OTA will download the new image. Please correct me if am wrong.

Eg. MK22FN1M0VLL12 has 1MB of flash then 0x0000 to 0x80000  is active area and 0x80000 to 0x100000 is inactive area where OTA will download the new image. 

on reboot the memory swap feature will take affect and below image at 0x80000 to 0x100000 will be mapped to 0x00 

Currently am using a serial bootloader which downloads the application from PC at address 0x6000 to end of flash memory and i plan to use swap memory feature for OTA.

Is there any sample code specific to MK22FN1M0VLL12 for program flash memory swap feature. I have a code which is specific to K64 series of microcontroller. 

also another question is currently i have a serial bootloader which downloads the image to location 0x6000 from PC.

But when i will be using the OTA code with memory swap feature will i be able to use the serial bootloader as it is from 0x000 to 5fff memory and memory swap feature will directly swap 0x0000 to 0x80000 area and 0x80000 to 0x100000 area.

Thanks

Regards,

Anuj

Labels (1)
0 Kudos
2 Replies

384 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Anuj,

MK22FN1M0VLL12 has flash SWAP function. So, it support OTA. Please search AN4533 in NXP website. It explained OTA function and it has demo code. If you has k64 swap demo, it can also use on K22 directly. There structure are same. There are many discussions on community about SWAP function. I believe they will give you many helps.

OTA exchange all the memory block. Your bootloader in block0 will also be swapped to 0x80000. So, you have to merge OTA code to the application code.

Regards,

Jing

0 Kudos

384 Views
anujtanksali
Contributor II

Hello Jing Pan,

Thanks for your reply. 

Can i change the start addresses of lower block and upper block and still use swap feature.

suppose i don't want to boot from 0x00 for lower block and dont want to use the start addess for upper block.

for E.g. if flash size is 1MB then lower block is 0x00 to 0x80000 after 0x80000 is the upper block.

suppose for lower block i want to use 0x1000 as start address and 0x81000 as start address for upper block and use swap feature

is it possible?

Regards,

Anuj

0 Kudos