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

cancel
Showing results for 
Search instead for 
Did you mean: 

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

79 Views
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? 

Tags (1)
0 Kudos
1 Reply

2 Views
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 Kudos