EmbeddedRelated.com
Forums

flash data storage on lpc

Started by zhli...@yahoo.com September 13, 2008
Hello,

I also have to store variables in Flash, but it's because I ran out of RAM memory. I have one variable which is a struct and already occupies 16 Kb. So, I have a lot of free flash memory to allocate this variable, but I can't allocate it in RAM. So, I've already created a memory section in Flash and I have allocated it. The application has compiled and linked without any problem. But I have a lot of questions. What can happen doing this? The time needed for writing into flash is different from the time writing into RAM? Does this variable will still contain their value, although I power off my device ? In that case, if I initiliaze the its value each time to 0 is enough? To do this, is it better to use IAP functions, or is it enough doing what I did of allocating a memory section? I have read that a big problem can be that the times I write in flash memory is a limited number (~100.000 times).

Thanks for any help.
Hi,
>Has anyone used the flash on a LPC2468 as application data storage? I have a file system and wish to store files on the unused part of the flash. What are the ways of gaining access?
>
>Thanks for your help.
>
>Regards,
>
>Zhao
>

An Engineer's Guide to the LPC2100 Series

--- In l..., tapenot@... wrote:
>
> Hello,
>
> I also have to store variables in Flash, but it's because I ran out
of RAM memory. I have one variable which is a struct and already
occupies 16 Kb. So, I have a lot of free flash memory to allocate this
variable, but I can't allocate it in RAM. So, I've already created a
memory section in Flash and I have allocated it. The application has
compiled and linked without any problem. But I have a lot of
questions. What can happen doing this?
It's a really bad idea...
>The time needed for writing into flash is different from the time
writing into RAM?
By orders of magnitude. And you have to disable interrupts and run
the IAP code out of RAM which means you need to compile it for a RAM
address (but you are out of RAM) but place it in flash and then move
it when you want to execute it.

>Does this variable will still contain their value, although I power
off my device ?
Yes, it's flash.
>In that case, if I initiliaze the its value each time to 0 is enough?
Sure, but you have to use IAP to do it. And your code needs to run
from RAM and the interrupts have to be disabled and you don't have any
RAM. And so on...
>To do this, is it better to use IAP functions, or is it enough doing
what I did of allocating a memory section?
It will only be 0 the very first time the CPU starts. After that it
will always contain what you previously wrote. And you will always
have to use IAP functions to write the flash.
> I have read that a big problem can be that the times I write in
flash memory is a limited number (~100.000 times).
Yes, that is a problem for your application.

This is such a bad idea. Why don't you use an external EEPROM (SPI or
I2C) or some kind of external SRAM? Or just get a uC with enough SRAM
to do the job correctly?

Richard

Normally Constant data is stored in flash and its not reccomended for
keeping read/write data in flash

On Fri, Sep 26, 2008 at 9:51 PM, wrote:

> Hello,
>
> I also have to store variables in Flash, but it's because I ran out of RAM
> memory. I have one variable which is a struct and already occupies 16 Kb.
> So, I have a lot of free flash memory to allocate this variable, but I can't
> allocate it in RAM. So, I've already created a memory section in Flash and I
> have allocated it. The application has compiled and linked without any
> problem. But I have a lot of questions. What can happen doing this? The time
> needed for writing into flash is different from the time writing into RAM?
> Does this variable will still contain their value, although I power off my
> device ? In that case, if I initiliaze the its value each time to 0 is
> enough? To do this, is it better to use IAP functions, or is it enough doing
> what I did of allocating a memory section? I have read that a big problem
> can be that the times I write in flash memory is a limited number (~100.000
> times).
>
> Thanks for any help.
>
> Hi,
> >Has anyone used the flash on a LPC2468 as application data storage? I have
> a file system and wish to store files on the unused part of the flash. What
> are the ways of gaining access?
> >
> >Thanks for your help.
> >
> >Regards,
> >
> >Zhao
> >
>
>