From: Ben Warren Date: Wed, 11 Oct 2006 18:44:13 -0400 Subject: [U-Boot-Users] Can I write to flash using mw command In-Reply-To: References: <20061006033619.65376.qmail@web33205.mail.mud.yahoo.com> <45264A79.1090600@smiths-aerospace.com> Message-ID: <1160606653.27646.38.camel@saruman.qstreams.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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