
Bilahari,
On Wed, 2006-10-11 at 22:17 +0000, bilahari wrote:
But one thing that doesnt work with my code and also with u-boot is that if I want to write two different values to the same flash locationconsecutively ( for example when I try to write 0x12 to flash address 0xff000000 and then write 0x34 to same flash address, u-boot gives me a message "flash not erased". My driver makes the program simply loop forever in a status register polling loop, I guess).
Is it something natural with flash programming ?. Should I always erase the whole sector before I re-program a location ? (doesnt sound like a good approach to me), is it not possible to write consecutively as with the conventional memory?
Flash can't be accessed like the RAM you're thinking of. You can only change a bit state from 1 to 0 (That's why after erasing a sector you'll see that the contents are all 'ffffffff'). For all intents and purposes, once you write to a location in flash, it's 'read-only' until you erase the whole sector again. Also, keep in mind that flash devices have a limited number of erase cycles before performance becomes unreliable. A common value is 100000 cycles, although there are devices with more and less than this number. In general, use Flash to store information that will change infrequently.
regards, Ben