[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fw: [avr-gcc-list] placing a variable in flash

From: E. Weddington
Subject: Re: Fw: [avr-gcc-list] placing a variable in flash
Date: Mon, 22 Nov 2004 13:57:49 -0700
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

Geoffrey Wossum wrote:

On Monday 22 November 2004 12:19 pm, E. Weddington wrote:

2. Ease of use.
Reading and writing the EEPROM is easy especially for small values,
because each byte can be erased. While reading Flash is easy, it is more
complicated to write to Flash because you have to erase and write a
block of data at a time, which means you need to flush the contents of a
Flash block to a RAM buffer, erase the block and write the block with
the new contents.

As I understand it, there is no way for normal application on an AVR to write to program flash memory. Only code running in the bootloader area is allowed to write to program flash. Is this correct? That's a huge ease of use issue.
That is correct, and you are correct in that it is a huge ease-of-use issue. I did not directly say that one needs a bootloader, but it is implied once one is familiar with the AVR and how to program the Flash (program memory). :-)

I got around this by having a special mode in my bootloader that copies a block of data from E2 to a fixed area in flash. I use this for manufacturing information I really don't want lost, like serial number and 802.15.4 MAC address. This may seem like overkill, but in the past we've had problems with the AVR's E2 "losing" data. I think this was only on the old ATmega103, and that is fixed on parts like the ATmega128. Because of these old problems, though, we're still a little shy about using the ATmega's E2 for stuff we don't want to lose.

From what I understand and remember, I thought it was only having to do with address 0 of the EEPROM memory, and you're right, that Atmel got that fixed in later devices. Best to always check the datasheet errata. We've never had any problems with the EEPROM on the mega128s.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]