avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] About the EEPROM application problem in AVR


From: David Kelly
Subject: Re: [avr-gcc-list] About the EEPROM application problem in AVR
Date: Thu, 2 Jun 2005 21:53:13 -0500


On Jun 2, 2005, at 8:32 PM, laser lei wrote:

Dear All,
     I used the ATmega48 EEPROM stored my parameter.
But I can't read back right data before in my program
I have defined  it.Please see the below part,give me some advice!
     Thanks!
     Laser
#include <inttypes.h>
#include <avr/io.h>
#include <avr/eeprom.h>
 unsigned char EMy_addr __attribute__((section(".eeprom"))) =5;
 unsigned char my_addr;

int main(void)
{
        eeprom_busy_wait();
        my_addr=eeprom_read_byte(&EMy_addr);
}

I have discovered a similar problem today, that initialized eeprom data is not loading in the eeprom correctly thru AVR Studio 4 from dwarf2 format object files.

Avr-objdump shows the expected data perfectly, in the correct place. But in the Memory view pane of AVR Studio often shows a byte skipped in mid-pack and always several bytes extra garbage at the end copied from elsewhere in the eeprom data. For example one variable is initialized with 0x2a8 and this value is wrongly found past the end of other data, in addition to the copy which is almost in its correct place within the data.

I didn't use the canned eeprom library in avr-libc, wrote my own. Beating on it most all day today I'm convinced AVR Studio is displaying the truth, and that my routines agree with AVR Studio. That the single point of failure is that AVR Studio does not write eeprom correctly when loading.

Doesn't matter if I have "preserve eeprom contents" option enabled or not.

For now I've given up on preloading eeprom variables.

Atmega 64L with ICEcube, Feb 2005 version of WinAVR, AVR Studio 4.11 SP2 upgraded to SP3.

--
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.





reply via email to

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