LPC824M201JDH20,we want to save some data into flash ,and how to read and write flash?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC824M201JDH20,we want to save some data into flash ,and how to read and write flash?

722 次查看
wensinnywen
Contributor I

we are using LPC824M201JDH20, the demo "flashiap" has no read method,  we want to save some data into flash ,and how to read and write flash? 

标记 (1)
0 项奖励
回复
1 回复

645 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Wen sinnywen,

    flashiap demo already have the write flash function, just the program flash function.

   Flash program and erase need to use the IAP function to realize it, but the read is very simple, just read the address directly.

   Read operation is:

variable= (uint32_t *)(address);

Take an example:

#define LONGWORD_COUNTER_ADDR 0x14000040
#define WORD_COUNTER_ADDR 0x14000044
#define BYTE_COUNTER_ADDR 0x14000046

                printf("\nlongword counter = 0x%08X", *(uint32 *)(LONGWORD_COUNTER_ADDR));
              printf("\nword counter = 0x%04X", *(uint16 *)(WORD_COUNTER_ADDR));
              printf("\nbyte counter = 0x%02X", *(uint8 *)(BYTE_COUNTER_ADDR));

Wish it helps you!

If you still have question about it, please kindly let me know.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复