Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Writing to FLASH from RAM

Writing to FLASH from RAM

2004-11-23 by firegenie1980

Hi,

Im trying to write a value, actually a large array of 8-bit 
integers, from RAM to FLASH so that I can access this array after 
the power has been removed and re-applied at a later date.

The values from the array will be either:

A: Wrote to RAM then copied straight into FLASH during each pass. 
This will require the process to take less than 0.05ms as the 
function that produces the values is called every 0.1ms.

B: Totally filled up, then copied over to FLASH some other way if a 
speed of 0.05ms is unobtainable. Probably over-running my tick 
interval.

If anyone has any useful information on this it would be very much 
appreciated. This is my first time using the FLASH memory directly 
and so I'm very much in the dark on this one! I know I need to set 
up an area of FLASH for this array, but how to do this and how to 
access it is a mystery to me, and I am finding it hard to find 
examples on the internet that might help me.

Thanks,

FG

Re: Writing to FLASH from RAM

2004-11-23 by Gus

a quick comment! You are saving to flash 10 times every second; 
therefore, you can do 10,000 seconds (FLASH life is 100,000 erases, 
I think). 10,000 seconds = about 3 hours!!!

Is that right or I didn't really understand it?

--- In lpc2000@yahoogroups.com, "firegenie1980" <firegenie1980@y...> 
wrote:
> 
> Hi,
> 
> Im trying to write a value, actually a large array of 8-bit 
> integers, from RAM to FLASH so that I can access this array after 
> the power has been removed and re-applied at a later date.
> 
> The values from the array will be either:
> 
> A: Wrote to RAM then copied straight into FLASH during each pass. 
> This will require the process to take less than 0.05ms as the 
> function that produces the values is called every 0.1ms.
> 
> B: Totally filled up, then copied over to FLASH some other way if 
a 
Show quoted textHide quoted text
> speed of 0.05ms is unobtainable. Probably over-running my tick 
> interval.
> 
> If anyone has any useful information on this it would be very much 
> appreciated. This is my first time using the FLASH memory directly 
> and so I'm very much in the dark on this one! I know I need to set 
> up an area of FLASH for this array, but how to do this and how to 
> access it is a mystery to me, and I am finding it hard to find 
> examples on the internet that might help me.
> 
> Thanks,
> 
> FG

Re: Writing to FLASH from RAM

2004-11-23 by firegenie1980

I take 10000 readings a seconds... therefore writing time for each 
int has to be <0.1ms, hopefully <0.05ms.

--- In lpc2000@yahoogroups.com, "Gus" <gus_is_working@y...> wrote:
> 
> a quick comment! You are saving to flash 10 times every second; 
> therefore, you can do 10,000 seconds (FLASH life is 100,000 
erases, 
> I think). 10,000 seconds = about 3 hours!!!
> 
> Is that right or I didn't really understand it?
> 
> --- In lpc2000@yahoogroups.com, "firegenie1980" 
<firegenie1980@y...> 
> wrote:
> > 
> > Hi,
> > 
> > Im trying to write a value, actually a large array of 8-bit 
> > integers, from RAM to FLASH so that I can access this array 
after 
> > the power has been removed and re-applied at a later date.
> > 
> > The values from the array will be either:
> > 
> > A: Wrote to RAM then copied straight into FLASH during each 
pass. 
> > This will require the process to take less than 0.05ms as the 
> > function that produces the values is called every 0.1ms.
> > 
> > B: Totally filled up, then copied over to FLASH some other way 
if 
> a 
> > speed of 0.05ms is unobtainable. Probably over-running my tick 
> > interval.
> > 
> > If anyone has any useful information on this it would be very 
much 
> > appreciated. This is my first time using the FLASH memory 
directly 
> > and so I'm very much in the dark on this one! I know I need to 
set 
> > up an area of FLASH for this array, but how to do this and how 
to 
Show quoted textHide quoted text
> > access it is a mystery to me, and I am finding it hard to find 
> > examples on the internet that might help me.
> > 
> > Thanks,
> > 
> > FG

Re: [lpc2000] Re: Writing to FLASH from RAM

2004-11-23 by Robert Adsett

At 08:42 PM 11/23/04 +0000, you wrote:
>I take 10000 readings a seconds... therefore writing time for each
>int has to be <0.1ms, hopefully <0.05ms.

Well flash won't do it, too slow and as Gus pointed out it wears out too 
quickly.

A couple of options

- Don't store everything, either detect power down and just save then or 
save periodically at a slower rate.
- Use an external non-volatile memory.  Three I can think of that might 
meet you speed and endurance requirements
     + eeprom backed SRAM (Xicor I think), Acts as sram until power down 
and then writes the RAM contents to ee
     + battery backed SRAM (A number of suppliers of integrated (tophat) 
and support chips)
     + FRAM (Ramtron)

That all assumes you are doing this continually.  The original post implies 
that but it's not entirely clear.  If this is some sort of calibration 
setup then the obvious thing to do is collect the data and store it as 
separate steps.

The real keys to this is how often do you need to do it and how much are 
you storing, not how long does it take.  The how long feeds into other, 
more subtle, considerations like how long must you have power after it has 
been switched off.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Re: Writing to FLASH from RAM

2004-11-23 by Gus

ops I was thinking .1S... you mean .1mS!!! therefore (even if flash 
was fast enough. IT IS NOT) you will basically kill the chip in 10 
seconds.

How much data are you saving? you can use 512 MB MMC card and save 
the new data without deleting the old ones till needed! Again, it 
depends on how much data is going there.

--- In lpc2000@yahoogroups.com, "firegenie1980" <firegenie1980@y...> 
wrote:
Show quoted textHide quoted text
> 
> I take 10000 readings a seconds... therefore writing time for each 
> int has to be <0.1ms, hopefully <0.05ms.
> 
> --- In lpc2000@yahoogroups.com, "Gus" <gus_is_working@y...> wrote:
> > 
> > a quick comment! You are saving to flash 10 times every second; 
> > therefore, you can do 10,000 seconds (FLASH life is 100,000 
> erases, 
> > I think). 10,000 seconds = about 3 hours!!!
> > 
> > Is that right or I didn't really understand it?
> > 
> > --- In lpc2000@yahoogroups.com, "firegenie1980" 
> <firegenie1980@y...> 
> > wrote:
> > > 
> > > Hi,
> > > 
> > > Im trying to write a value, actually a large array of 8-bit 
> > > integers, from RAM to FLASH so that I can access this array 
> after 
> > > the power has been removed and re-applied at a later date.
> > > 
> > > The values from the array will be either:
> > > 
> > > A: Wrote to RAM then copied straight into FLASH during each 
> pass. 
> > > This will require the process to take less than 0.05ms as the 
> > > function that produces the values is called every 0.1ms.
> > > 
> > > B: Totally filled up, then copied over to FLASH some other way 
> if 
> > a 
> > > speed of 0.05ms is unobtainable. Probably over-running my tick 
> > > interval.
> > > 
> > > If anyone has any useful information on this it would be very 
> much 
> > > appreciated. This is my first time using the FLASH memory 
> directly 
> > > and so I'm very much in the dark on this one! I know I need to 
> set 
> > > up an area of FLASH for this array, but how to do this and how 
> to 
> > > access it is a mystery to me, and I am finding it hard to find 
> > > examples on the internet that might help me.
> > > 
> > > Thanks,
> > > 
> > > FG

Re: [lpc2000] Re: Writing to FLASH from RAM

2004-11-23 by Robert Adsett

At 09:14 PM 11/23/04 +0000, you wrote:
>ops I was thinking .1S... you mean .1mS!!! therefore (even if flash
>was fast enough. IT IS NOT) you will basically kill the chip in 10
>seconds.

Presumably he's not saving it all in a single byte :) So 100000/sec if he's 
storing 1000 readings works out to 0.1S and your endurance calcs are 
right.  The size of the data set is rather important.


>How much data are you saving? you can use 512 MB MMC card and save
>the new data without deleting the old ones till needed! Again, it
>depends on how much data is going there.

Well he was planning on storing in internal flash so that suggests a few 
10's of K at the most.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Re: [lpc2000] Re: Writing to FLASH from RAM

2004-11-23 by roucheux@aol.com

The FRAM (RAMTRON) solution is very efficient, and the new chips have now  
unlimited read and write life duration.
Previously they were limited to 10 billion read or write accesses.
More, they have no write programming time, and don't need  any backup power. 


[Non-text portions of this message have been removed]

RE: [lpc2000] Re: Writing to FLASH from RAM

2004-11-23 by Raymond Keefe

Hi,

The RAMTRON devices has 10^12 endurance but every READ is also included in
that count.  This can be an issue if you are regularly reading the device.

On the plus side, the write speed is wonderful.

Ray
Show quoted textHide quoted text
-----Original Message-----
From: roucheux@... [mailto:roucheux@...]
Sent: Wednesday, 24 November 2004 8:52 AM
To: lpc2000@yahoogroups.com
Subject: Re: [lpc2000] Re: Writing to FLASH from RAM



The FRAM (RAMTRON) solution is very efficient, and the new chips have now
unlimited read and write life duration.
Previously they were limited to 10 billion read or write accesses.
More, they have no write programming time, and don't need  any backup power.


[Non-text portions of this message have been removed]





Yahoo! Groups Links

[lpc2000] Re: Writing to FLASH from RAM

2004-11-23 by roucheux@aol.com

IN my message i said read or write so reads must be counted. But new  devices 
have unlimited endurance.
 
FM3104...FM31256 are nonvolatiles, unlimited endurance, but have an RTC so  
they need a power, but only for RTC and event counters. they have an I2C  
interface up to 1 mhz so they seems to be fast enough for this data logging  
purpose.
 
These chips are called Integrated Processor Companion with Memory, they  
include Watchdog, Low voltage Reset  Early Powerfail Warning, Serial  Number, 
RTC,... AND all in 14PIN SOIC package.
 
some other simple memory chips with unlimited endurance are available from  
RAMTRON.
 
About data logging, sometime, measurment can be well compressed for  storage, 
leading to a more limited storage bandwith.
 
I2C protocol is not secured, but writes are made byte by byte, as soon as a  
byte is completed, and in the case of a page transaction, it can assure of a  
full secured page write.
 
 


[Non-text portions of this message have been removed]

[lpc2000] Re: Writing to FLASH from RAM

2004-11-23 by roucheux@aol.com

RAMTRON have also SPI chips up to 25Mhz clock, unlimited endurance.
 
I2C chip FM24CL64 is a 8k*8 chip in 8pin soic footprint unlimited endurance  
1Mhz clock
SPI chip FM2L256  is a 32k*8 chip in 8pin soic footprint unlimited  endurance 
25Mhz clock
 
in both chips, data can be sequentially written or read, so for a "page"  
write, you can supply a a start address and then write all your  bytes.


[Non-text portions of this message have been removed]

Re: Writing to FLASH from RAM

2004-11-24 by firegenie1980

Thanks for all the suggestions, a little bit more information might 
help after reading some of the posts.

I am reading in an 8-bit int into an array (10000 ints long) and I 
was wanting to update the array one entry at a time as I went along. 
Anyway I can see this is not going to work due to the previous 
comments.

Therefore external memory seems to be the way to go. I would prefer 
non-powered memory as my project is already running off two power 
supplies, 3.3V, 5V.
I only need to write this one array, or parts of, to the memory. Its 
the only part of the program I am interested in keeping. Then I need 
the program to be able to referance that array. Either read each 
individual entry or just read the entire array into RAM when 
requested whichever the most appropriate.
As for the different types of external memory and how you use them I 
have no idea about the different types and the use of I2C and SPI. 
Never used these functions or external memory for any microp.

This is for my final year project at university and I have only been 
using this board for a few months and only on this project. All my 
previous experiance has been with 8051/2s.

I will search for information on the different type of external 
memory, FRAM seems like it could be the best.

Any extra information would be very helpful.

Thanks,

FG

--- In lpc2000@yahoogroups.com, Robert Adsett <subscriptions@a...> 
wrote:
> At 08:42 PM 11/23/04 +0000, you wrote:
> >I take 10000 readings a seconds... therefore writing time for each
> >int has to be <0.1ms, hopefully <0.05ms.
> 
> Well flash won't do it, too slow and as Gus pointed out it wears 
out too 
> quickly.
> 
> A couple of options
> 
> - Don't store everything, either detect power down and just save 
then or 
> save periodically at a slower rate.
> - Use an external non-volatile memory.  Three I can think of that 
might 
> meet you speed and endurance requirements
>      + eeprom backed SRAM (Xicor I think), Acts as sram until 
power down 
> and then writes the RAM contents to ee
>      + battery backed SRAM (A number of suppliers of integrated 
(tophat) 
> and support chips)
>      + FRAM (Ramtron)
> 
> That all assumes you are doing this continually.  The original 
post implies 
> that but it's not entirely clear.  If this is some sort of 
calibration 
> setup then the obvious thing to do is collect the data and store 
it as 
> separate steps.
> 
> The real keys to this is how often do you need to do it and how 
much are 
> you storing, not how long does it take.  The how long feeds into 
other, 
> more subtle, considerations like how long must you have power 
after it has 
> been switched off.
> 
> Robert
> 
> " 'Freedom' has no meaning of itself.  There are always 
restrictions,
> be they legal, genetic, or physical.  If you don't believe me, try 
to
Show quoted textHide quoted text
> chew a radio signal. "
> 
>                          Kelvin Throop, III

Re: [lpc2000] Re: Writing to FLASH from RAM

2004-11-24 by roucheux@aol.com

The fastest way is with spi FRAM like FM25L256 (up to 25 mhz clock) 
But in a lpc21xx if i'm right, SPI is limited to clk/8 or 7.5 mhz for an  
internal freq of 60Mhz.
For a FM25L256 (32k*8) 8 pins it's quite 750Ko/s storege in sequential  mode.
I apologize for a mistyping in my previous message about chip  reference.
 
SPI read write routine is as simple as that
 
unsigned char _getput_spi(unsigned char mydata)
{
rSP0DR =  mydata;                 // send mydata byte
    while ((rSP0SR&0x80) == 0); // wait for data  transfer complete
    return  rSP0DR;                      // return read byte  
}




[Non-text portions of this message have been removed]

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.