<SOLVED> EEPROM gets erased when programming Atmega644 (Arduino as ISP)

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?

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

http://www.engbedded.com/fusecalc

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

be careful, setting fuses can screw you up

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 :cold_sweat:

When looking at Sanquino's board.txt file:

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?

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

AVR® Fuse Calculator – The Engbedded Blog

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 :blush:

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

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.

corprius:
I got impatient and changed the boards.txt file with success!

yea its usually ok if you know where you are starting from and modify from there, the only things that can throw you in a pickle are the reset enable, serial programming and the stupid clock settings (which even if you think you have right its best to have a 1-20 mhz crystal oscillator on hand)