EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Datalogger with Flash

Started by peres March 14, 2006
Hi, I have a datalogger with an eeprom memory, and i want to upgrade it
to a serial flash memory.
the problem is that when the memory is full it will start writing at
the begining of the memory, and thats ok with the eeprom, but with the
flash i will have to erase the whole block, so that its not ok.
the message that im writing its 16 Bytes Long. anyone can help me with
that?

Thank you!

peres wrote:

> Hi, I have a datalogger with an eeprom memory, and i want to upgrade it > to a serial flash memory. > the problem is that when the memory is full it will start writing at > the begining of the memory, and thats ok with the eeprom, but with the > flash i will have to erase the whole block, so that its not ok. > the message that im writing its 16 Bytes Long. anyone can help me with > that?
For a flash you need a RAM buffer anyway. This because the flash is block oriented. A good path are the Atmel Dataflash, because they have buffers included. Rene -- Ing.Buero R.Tschaggelar - http://www.ibrtses.com & commercial newsgroups - http://www.talkto.net *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***
peres wrote:
> Hi, I have a datalogger with an eeprom memory, and i want to upgrade it > to a serial flash memory. > the problem is that when the memory is full it will start writing at > the begining of the memory, and thats ok with the eeprom, but with the > flash i will have to erase the whole block, so that its not ok. > the message that im writing its 16 Bytes Long. anyone can help me with > that? > > Thank you! >
If your moving up to a flash part, your increasing your memory size by leaps and bounds. 2 times, 8 times, 1,000,000 times. Write your code with the erase block size in mind. Keep two blocks available, and erase the oldest block. Which device are you looking at using. The Atmel devices have 256 to 1024 byte blocks. You are already over writting 16 bytes in a full eeprom. Good Luck donald
"peres" <beto.barba@gmail.com> skrev i meddelandet 
news:1142365844.016078.65940@j33g2000cwa.googlegroups.com...
> Hi, I have a datalogger with an eeprom memory, and i want to upgrade it > to a serial flash memory. > the problem is that when the memory is full it will start writing at > the begining of the memory, and thats ok with the eeprom, but with the > flash i will have to erase the whole block, so that its not ok. > the message that im writing its 16 Bytes Long. anyone can help me with > that? > > Thank you! >
With AT45 Dataflash you do: Read Page (256-1024 byte) into SRAM buffer inside the serial flash chip Update SRAM buffer with the new 16 bytes Write SRAM buffer to Flash -- Best Regards, Ulf Samuelsson This is intended to be my personal opinion which may, or may bot be shared by my employer Atmel Nordic AB
In article <MeSdnbvMS8UFOorZRVn-iA@forethought.net>, 
donald@dontdoithere.com says...
> peres wrote: > > Hi, I have a datalogger with an eeprom memory, and i want to upgrade it > > to a serial flash memory. > > the problem is that when the memory is full it will start writing at > > the begining of the memory, and thats ok with the eeprom, but with the > > flash i will have to erase the whole block, so that its not ok. > > the message that im writing its 16 Bytes Long. anyone can help me with > > that? > > > > Thank you! > > > If your moving up to a flash part, your increasing your memory size > by leaps and bounds. 2 times, 8 times, 1,000,000 times. > > Write your code with the erase block size in mind. > > Keep two blocks available, and erase the oldest block. > > Which device are you looking at using. > > The Atmel devices have 256 to 1024 byte blocks. > > You are already over writting 16 bytes in a full eeprom. > > Good Luck >
I handled a similar problem with a logging instrument using am 8 MByte Atmel data flash by: 1. using the onboard 1Kbyte+ (data block size) buffers. 2. Having the data storage wrap around at the end of flash. That way you lost the oldest data, but kept the most recent megabyte. 3. Using the extra bytes in the block (1024 data, about 32 'extra' bytes) to keep track of the date and time that the block was written, as well as some other session data. It was simpler than implementing a DOS-type directory system and wear leveling. (or so I thought at the time. With the availability of Lewin's DOSFS and cheap SD cards, I'm reconsidering for my next project). The problem with this scheme is that you will potentially lose data in the buffer if you lose power. I handled this with a backup battery and power supply switcher. If the main power dropped out, I wrote the data and went to sleep. Mark Borgerson
"Mark Borgerson" <mborgerson.at.comcast.net> wrote in message
news:MPG.1e81533d22b13be498a17b@newsgroups.comcast.net...
> In article <MeSdnbvMS8UFOorZRVn-iA@forethought.net>, > donald@dontdoithere.com says... > > peres wrote: > > > Hi, I have a datalogger with an eeprom memory, and i want to upgrade
it
> > > to a serial flash memory. > > > the problem is that when the memory is full it will start writing at > > > the begining of the memory, and thats ok with the eeprom, but with the > > > flash i will have to erase the whole block, so that its not ok. > > > the message that im writing its 16 Bytes Long. anyone can help me with > > > that? > > > > > > Thank you! > > > > > If your moving up to a flash part, your increasing your memory size > > by leaps and bounds. 2 times, 8 times, 1,000,000 times. > > > > Write your code with the erase block size in mind. > > > > Keep two blocks available, and erase the oldest block. > > > > Which device are you looking at using. > > > > The Atmel devices have 256 to 1024 byte blocks. > > > > You are already over writting 16 bytes in a full eeprom. > > > > Good Luck > > > > I handled a similar problem with a logging instrument using am > 8 MByte Atmel data flash by: > > 1. using the onboard 1Kbyte+ (data block size) buffers. > 2. Having the data storage wrap around at the end of flash. > That way you lost the oldest data, but kept the most > recent megabyte. > 3. Using the extra bytes in the block (1024 data, about 32 > 'extra' bytes) to keep track of the date and time that > the block was written, as well as some other session > data. It was simpler than implementing a DOS-type > directory system and wear leveling. (or so I thought > at the time. With the availability of Lewin's > DOSFS and cheap SD cards, I'm reconsidering for my > next project).
There aren't any 'extra' bytes! They are for error correction codes (ECC) to correct small numbers of bit errors in the sectors. The devices are not very reliable - sectors fail or go bad and this situation needs to be detected and allowed for.
> The problem with this scheme is that you will potentially lose > data in the buffer if you lose power. I handled this with > a backup battery and power supply switcher. If the > main power dropped out, I wrote the data and went to sleep.
Peter
In article <LwRRf.2417$Tv.2208@newsfe5-gui.ntli.net>, first{dot}
surname@ukonline.co.uk says...
> "Mark Borgerson" <mborgerson.at.comcast.net> wrote in message > news:MPG.1e81533d22b13be498a17b@newsgroups.comcast.net... > > In article <MeSdnbvMS8UFOorZRVn-iA@forethought.net>, > > donald@dontdoithere.com says... > > > peres wrote: > > > > Hi, I have a datalogger with an eeprom memory, and i want to upgrade > it > > > > to a serial flash memory. > > > > the problem is that when the memory is full it will start writing at > > > > the begining of the memory, and thats ok with the eeprom, but with the > > > > flash i will have to erase the whole block, so that its not ok. > > > > the message that im writing its 16 Bytes Long. anyone can help me with > > > > that? > > > > > > > > Thank you! > > > > > > > If your moving up to a flash part, your increasing your memory size > > > by leaps and bounds. 2 times, 8 times, 1,000,000 times. > > > > > > Write your code with the erase block size in mind. > > > > > > Keep two blocks available, and erase the oldest block. > > > > > > Which device are you looking at using. > > > > > > The Atmel devices have 256 to 1024 byte blocks. > > > > > > You are already over writting 16 bytes in a full eeprom. > > > > > > Good Luck > > > > > > > I handled a similar problem with a logging instrument using am > > 8 MByte Atmel data flash by: > > > > 1. using the onboard 1Kbyte+ (data block size) buffers. > > 2. Having the data storage wrap around at the end of flash. > > That way you lost the oldest data, but kept the most > > recent megabyte. > > 3. Using the extra bytes in the block (1024 data, about 32 > > 'extra' bytes) to keep track of the date and time that > > the block was written, as well as some other session > > data. It was simpler than implementing a DOS-type > > directory system and wear leveling. (or so I thought > > at the time. With the availability of Lewin's > > DOSFS and cheap SD cards, I'm reconsidering for my > > next project). > > There aren't any 'extra' bytes! They are for error correction codes (ECC) to > correct small numbers of bit errors in the sectors. The devices are not very > reliable - sectors fail or go bad and this situation needs to be detected > and allowed for.
I agree about the estimates of low reliability. In a data logging application as in my project, I would guess that each block might get written perhaps 5 times per year. That would only happen if the instrument was sampling continuously---which is very unlikely as you have to pull it out of the water and clean off the biofouling on a regular basis. I was satisfied that checksums would suffice, as there was significant redundancy in the directory information and the data consists of individual 4-byte floating point values where later values do not depend on earlier values. Were I working with a compression scheme or a data format where a single byte error could compromise a whole block, I would have done things differently.
> > > The problem with this scheme is that you will potentially lose > > data in the buffer if you lose power. I handled this with > > a backup battery and power supply switcher. If the > > main power dropped out, I wrote the data and went to sleep. >
Mark Borgerson
Thank you very much!, you have been a great help!

Regards,


The 2024 Embedded Online Conference