Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 4 months ago.
NXP LPC812 IAP Flash Page Writing
I am trying the Library and the program for IAP writing on LPC812 which works fine. I used Page Erase command which also worked well as shown in the example, however I didn't find Page Write command. LPC812 supports the Page Erase & Write both. Can you please guide to write pages of 64 bytes instead of writing the complete sector? By using Sector write I can write only the first page of 64 bytes by limiting the MEM_SIZE to 64. But I can't write the subsequent pages in the sector.
2 Answers
6 years, 4 months ago.
Is “the library” here?
https://os.mbed.com/users/okano/notebook/iap-in-application-programming-internal-flash-eras/
If yes, I am going to contact Okano-san (library author).
Yes, the library and the sample code is released by Tedd OKANO. The Library is here https://os.mbed.com/users/okano/code/IAP/ and the sample code is here https://os.mbed.com/users/okano/code/IAP_internal_flash_write/
posted by 14 Aug 20186 years, 4 months ago.
Hi John,
Sorry for my response so slow / Thank you for using the IAP library.
I confirmed writing size can be the sector size (=1024 bytes).
Please find a program link below and give it a try.
Import programIAP_internal_flash_write_LPC812_sector_size_write
LPC812 sector size flash write sample code
This sample code is doing ...
- Blank check for sectors from 12 to 15
- If those are not blank, erase
- 1K byte writing for each sector 12, 13, 14 and 15.
- Memory dump of sector 12, 13, 14 and 15 on serial terminal.
Give me a shout if you have any problem or any question :)
Hi Watarai-san,
Thank you for letting me know the library got a question.
Thank you for the support. Frankly I haven't tried the program because what I expect is different.
I just want to erase and write page which is only 64 bytes in case of LPC812. Your library has a Page Erase command which erases only 64 bytes by supplying an absolute address. However there is no Page Write command available which will only write a page of 64 bytes by supplying an absolute address.
LPC812 supports the Page Erase & Write both. Can you please guide to write pages of 64 bytes instead of writing the complete sector?
posted by 16 Aug 2018Oh, I'm sorry. I was completely misunderstanding your question. I add "write_page()" function in IAP. Please find updated code.
https://os.mbed.com/users/okano/code/IAP_internal_flash_write/
NOTE: The chip itself has "erase page" command but no "write page". The user need to use same command as "Copy RAM to flash". It can be done by call of "iap.write()" with appropriate memory addresses after "iap.prepare()".
posted by 16 Aug 2018