Go Down

Topic: <SOLVED> EEPROM gets erased when programming Atmega644 (Arduino as ISP) (Read 2 times) previous topic - next topic

corprius

Hi,

I'm programming an Atmega644 using the Arduino as ISP. For this I'm using the Sanquino software add in for he Arduino IDE. For some reason the EEPROM gets erased every time I upload the code to the 644.

For uploading I use an Arduino Uno (SMD version) with the Arduino ISP sketch. It doesn't matter if I use Visual micro for compiling and uploading or the Arduino IDE.

Any ideas why the EEPROM gets erased and how I can stop it from getting erased when uploading new code?

Osgeld

you can set a fuse bit to prevent the eeprom from being erased during a upload

http://www.engbedded.com/fusecalc

Quote
Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]


be careful, setting fuses can screw you up

corprius

#2
Dec 09, 2012, 10:18 pm Last Edit: Dec 09, 2012, 10:21 pm by corprius Reason: 1
Oke I was a bit to fast with asking. I know now why the EERPROM gets erased. The fuses are set to erase the EEPROM at the chip erase chip prior to programming it. Correct me if I'm wrong  :smiley-roll-sweat:

When looking at Sanquino's board.txt file:
Code: [Select]
atmega644.name=Sanguino W/ ATmega644P

atmega644.upload.protocol=stk500
atmega644.upload.maximum_size=63488
atmega644.upload.speed=57600

atmega644.bootloader.low_fuses=0xFF
atmega644.bootloader.high_fuses=0x9A
atmega644.bootloader.extended_fuses=0xFF
atmega644.bootloader.path=atmega
atmega644.bootloader.file=ATmegaBOOT_168_atmega644p.hex
#atmega644.bootloader.file=ATmegaBOOT_644P.hex
atmega644.bootloader.unlock_bits=0x3F
atmega644.bootloader.lock_bits=0x0F

atmega644.build.mcu=atmega644p
atmega644.build.f_cpu=16000000L
atmega644.build.core=arduino
atmega644.build.variant=standard


Is see that the low_fuses=0xFF, high_fuses=0x9A and the extended_fuses=0xFF.
When I fill in these values at 'Atmel studio's AVR simulator - device programmin' I see that the 'EESAVE' option is not checked. When I check it the high fuses change to 0X92.

Is it OK to change the high fuses in the boards.txt file to high_fuses=0x92?

corprius

#3
Dec 09, 2012, 10:20 pm Last Edit: Dec 09, 2012, 10:23 pm by corprius Reason: 1

you can set a fuse bit to prevent the eeprom from being erased during a upload

http://www.engbedded.com/fusecalc

Quote
Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]


be careful, setting fuses can screw you up
Thanks for your reply. I found the answer myself. I forgot that I had Atmel studio installed  :smiley-red:

Is it OK to change the high fuses in the boards.txt file to high_fuses=0x92? (see my fore last reply)

corprius

I got impatient and changed the boards.txt file with success! I needed to upload the bootloader again before the change had the desired effect.

Go Up