EmbeddedRelated.com
Forums

Reading data from Internal Flash memory of LPC21xx (Internal Flash as an EEPROM)

Started by Rahul Raj August 17, 2011
Dear friends,

I would like to know how i can read data or block of data from internal flash memory of LPC21xx? I can write and erase using IAP but reading of data i dont know. Means how i can use Internal Flash as an EEPROM for read and write data? Can ayn one help me?

I think Saurabh Pandya had done this so he can reply me.

Thanks in advance.
Ramesh Khokhani

An Engineer's Guide to the LPC2100 Series

--- In l..., "Rahul Raj" wrote:
>
> Dear friends,
>
> I would like to know how i can read data or block of data from internal flash memory of LPC21xx? I can write and erase using IAP but reading of data i dont know. Means how i can use Internal Flash as an EEPROM for read and write data? Can ayn one help me?
>
> I think Saurabh Pandya had done this so he can reply me.
>
> Thanks in advance.
> Ramesh Khokhani
>

I haven't done this, but it should be possible to read it in a number of ways.

What you should always do is change the link-file to make a new memory segment for your storage. This would also make sure that your program can not be in that part of the flash memory.

To read the memory you can simply use a pointer and have it point to wherever your data is, there is no difference between a pointer to flash or ram (except that you cant write to flash).

a second way to read it is to define a constant (most likely a char array) and have it reside in the segment you created earlier.

If I am not mistaken the flash of the LPC21xx is sector based, therefore it is not possible to clear/change a single byte. Setting a byte should be possible.

Hope this helps,
Kevin