EmbeddedRelated.com
Forums

Writing to flash. Erase first???

Started by mrobins99 November 2, 2007
Is it necessary to erase the flash before writing to it, or can I just
overwrite the old data without any worries?

Beginning Microcontrollers with the MSP430

--- In m..., "mrobins99" wrote:
>
> Is it necessary to erase the flash before writing to it, or can I
just
> overwrite the old data without any worries?
>

Hello mrobins99
You cannot just overwrite data in flash, You have to erase whole
segment first (it is the minimum quantity You can erase) and then
write Your data.

Just erased flash is filled with 0xFF bytes. So when data is written,
some bits are set to 0. The only operation that can set bits from 0
to 1 is erase.

Regards
Max
To: m...From: m...@yahoo.comDate: Fri, 2 Nov 2007 13:38:20 +0000Subject: [msp430] Writing to flash. Erase first???

> Is it necessary to erase the flash before writing to it, or can I just > overwrite the old data without any worries?

The short answer is yes, you must erase flash every time before writing to it. Many flash systems erase cells to 1's and when programmed selected bits are programmed to 0's. So, you can only overwrite a 1 to a 0 and not the other way.

Also, according to TI, there is a cumulative program time, which means you can only write a cell a certain number of times (like twice) before you have to erase it again. I used to think you could erase a block and then write to a cell whenever you wanted, but TI says not to do that. Something about adjacent cells being affected by the write - there is an app note on it (see slaa334, section 3.3).

Lou
Recent Activity
16
New Members

1
New FilesVisit Your Group
Yahoo! Finance
It's Now Personal
Guides, news,
advice & more.

Dog Zone
on Yahoo! Groups
Join a Group
all about dogs.

10 pairs of tickets
a day from Yahoo!
Fly home for the
Holidays for free.
.

_________________________________________________________________
Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct