Reply by Alf Katz November 14, 20062006-11-14
"karthikbg" <karthik.balaguru@lntinfotech.com> wrote in message 
news:1163244156.141992.218900@f16g2000cwb.googlegroups.com...
Hi,

>I came across something as below while i was looking for downcounters. >And this is really interesting !! > >" Downwriting is possible in Flash Memory . >Flash-Cells are proberly usable as downcounters. >Start with bytewise "FF" and ure able to reprogram this flash-cell with >every value >that means not to bring a flash-data-BIT from "0" to "1". " > >How is it possible to make the Flash memory to act like downcounters ? > >I am using S29GL512N MirrorBitT Flash. (Spansion Flash). > >Share your views/ideas . > >Thx in advans, >Karthik Balaguru
You can sort of count down FF, 7F, 3F, 1F, 0F, 07, 03, 01, 00 Those particular Spansion Flashes can be reprogrammed on a word (not byte) basis. Some other Spansion series have significant limitations on the number of times you can reprogram bytes or words and indeed which combinations of bytes/words can be reprogrammed "Programming to the same word address multiple times without intervening erases (incremental bit programming) requires a modified programming method. For such application requirements, please contact your local Spansion representative." You must not even try to write a 0 bit back to a 1 bit, always rewrite the 0 to 0, otherwise you will get errors due to the illegal operation. These errors may cut the operation short before the programming of the desired 0 is fully complete. Remember Flash is an analog device. Cheers, Alf
Reply by Meindert Sprang November 14, 20062006-11-14
"Rufus V. Smith" <nospam@nospam.com> wrote in message
news:45590b6a$0$31696$88260bb3@news.teranews.com...
> In fact, I believe in some cases, it is suggested that when > writing bytes over in this manner, you should overwrite 1's > on bits that are already 0. I think it is less wear and tear > on the bit.
The problem with that it that the write logic in the Flash will detect this as a write fault after a certain time-out. So writing this way would slow down things considerably. And as far as I know, only the erase action cause the wear. Meindert
Reply by Vladimir Vassilevsky November 13, 20062006-11-13

Rufus V. Smith wrote:

> > > So you can think of programming a bit as: > > Write 0 - change bit to a 0 > Write 1 - leave bit alone > > In fact, I believe in some cases, it is suggested that when > writing bytes over in this manner, you should overwrite 1's > on bits that are already 0. I think it is less wear and tear > on the bit. >
The problem is only the flash manufacturer really knows what is going on inside the flash. The process is much more complicated then you may think and involves several steps. The guessing about tear and wear may be right or wrong depending on the particular device. BTW, many EEPROMs have the hidden ECC for every byte, so it does not matter how many bits in a byte you are changing - wear is the same. Also, many manufacturers do not allow burning a byte into the same address twice, even if the byte is 0xFF. There are the things like "over erasing" and "over programming" of every single cell or a cluster of the cells. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Reply by Rufus V. Smith November 13, 20062006-11-13
"Darin Johnson" <darin@usa.net> wrote in message 
news:1163410232.975428.275430@h48g2000cwc.googlegroups.com...
> karthikbg wrote: >> The only way to change one byte in a block of Flash is To : >> 1) Copy the entire block to RAM (or other media) >> 2) Change the byte in the copy created in RAM. >> 3) Erase the Flash block and reprogram it with the entire image. > > This is untrue. Erasing a block turns all of its bits to ones. > You can then change any of the ones to zeros without > erasing again. Only when you need to turn a zero into a > one do you need to erase a block (or move to a different > block). The Flash that I've seen allow modifying a single > byte at a time. > > -- > Darin Johnson >
So you can think of programming a bit as: Write 0 - change bit to a 0 Write 1 - leave bit alone In fact, I believe in some cases, it is suggested that when writing bytes over in this manner, you should overwrite 1's on bits that are already 0. I think it is less wear and tear on the bit. e.g. Old Value: 0xFC New Value: 0xF0 Write Value: 0xF3 Rufus
Reply by Robert Adsett November 13, 20062006-11-13
Arlet wrote:
> Robert Adsett wrote: > > > > Not true. Flash can be bytewise programmed, as long as you're only > > > *clearing* bits. > > > > Be careful of absolutes, someone will come along with an exception :) > > The good part about using absolutes is that people will be eager to > correct you if you're wrong, which provides an opportunity to learn > something new :)
Touche :) Robert
Reply by Arlet November 13, 20062006-11-13
Robert Adsett wrote:

> > Not true. Flash can be bytewise programmed, as long as you're only > > *clearing* bits. > > Be careful of absolutes, someone will come along with an exception :)
The good part about using absolutes is that people will be eager to correct you if you're wrong, which provides an opportunity to learn something new :)
> In this case I know of an exception, the Philips/NXP LPC2000 series use > ECC on their internal flash. The effect of which is to make it not > possible to write any 16 byte block a second time w/o erasing the > sector it's in. If you clear a bit that was previously set the ECC > will kick in and 'correct' the value, and since you will be unknowingly > update the ECC code at the same time the corrected value isn't easily > predictable.
Interesting. I've worked with the LPC2xxx processors, but had not tried accessing the flash from the application yet.
Reply by Grant Edwards November 13, 20062006-11-13
On 2006-11-13, karthikbg <karthik.balaguru@lntinfotech.com> wrote:

>> Not sure if it's what you mean, but after you erase a sector it is >> filled with an all-ones pattern. You can then program (clear) each bit >> one by one, and implement a simple counter. So, you'd start with >> writing binary 11111110, then overwrite the same byte with 11111100, >> 11111000, ... 10000000, 00000000. After that, you move on to the next >> byte. >> >> This can be a useful technique if you absolutely must commit every >> event to flash. > > I believe that there are many issues in using this method. > > In the case of reprogramming, EEPROM is reprogrammable > bytewise.
Yes.
> But, FLASH is not bytewise programmable(usually).
Yes, it is. It's just not bytewise erasable.
> The only way to change one byte in a block of Flash is To : > 1) Copy the entire block to RAM (or other media) > 2) Change the byte in the copy created in RAM. > 3) Erase the Flash block and reprogram it with the entire image.
Wrong. You can program a single byte in all of the flash devices I've used. You just can't erase a single byte.
> what do you think?
It works exactly the way it was described to you. I've done it.
> Or Is there any other way of doing the Flash Memory to act as > downcounters?
-- Grant Edwards grante Yow! I have seen these at EGG EXTENDERS in my visi.com Supermarket... I have read theINSTRUCTIONS...
Reply by Robert Adsett November 13, 20062006-11-13
Arlet wrote:
> karthikbg wrote: > > > > Not sure if it's what you mean, but after you erase a sector it is > > > filled with an all-ones pattern. You can then program (clear) each bit > > > one by one, and implement a simple counter. So, you'd start with > > > writing binary 11111110, then overwrite the same byte with 11111100, > > > 11111000, ... 10000000, 00000000. After that, you move on to the next > > > byte. > > > > > > This can be a useful technique if you absolutely must commit every > > > event to flash. > > > > Thx for your reply. > > That is a pretty good idea. But, I believe that there are many issues > > in using this method. > > > > In the case of reprogramming, > > EEPROM is reprogrammable bytewise . But, FLASH is not bytewise > > programmable(usually). > > > > The only way to change one byte in a block of Flash is To : > > 1) Copy the entire block to RAM (or other media) > > 2) Change the byte in the copy created in RAM. > > 3) Erase the Flash block and reprogram it with the entire image. > > Not true. Flash can be bytewise programmed, as long as you're only > *clearing* bits.
Be careful of absolutes, someone will come along with an exception :) In this case I know of an exception, the Philips/NXP LPC2000 series use ECC on their internal flash. The effect of which is to make it not possible to write any 16 byte block a second time w/o erasing the sector it's in. If you clear a bit that was previously set the ECC will kick in and 'correct' the value, and since you will be unknowingly update the ECC code at the same time the corrected value isn't easily predictable. Robert
Reply by Stef November 13, 20062006-11-13
In comp.arch.embedded,
karthikbg <karthik.balaguru@lntinfotech.com> wrote:
> > In the case of reprogramming, > EEPROM is reprogrammable bytewise . But, FLASH is not bytewise > programmable(usually). > > The only way to change one byte in a block of Flash is To : > 1) Copy the entire block to RAM (or other media) > 2) Change the byte in the copy created in RAM. > 3) Erase the Flash block and reprogram it with the entire image. >
What kind of flash are you referring to? Your steps seems valid for some kind of flash memory card. On a flash device like the AM29LV080 you can program a single byte just fine, erasing is done per sector. -- Stef (remove caps, dashes and .invalid from e-mail address to reply by mail)
Reply by Darin Johnson November 13, 20062006-11-13
karthikbg wrote:
> The only way to change one byte in a block of Flash is To : > 1) Copy the entire block to RAM (or other media) > 2) Change the byte in the copy created in RAM. > 3) Erase the Flash block and reprogram it with the entire image.
This is untrue. Erasing a block turns all of its bits to ones. You can then change any of the ones to zeros without erasing again. Only when you need to turn a zero into a one do you need to erase a block (or move to a different block). The Flash that I've seen allow modifying a single byte at a time. -- Darin Johnson