Pages: [1]   Go Down
Author Topic: <SOLVED> EEPROM gets erased when programming Atmega644 (Arduino as ISP)  (Read 1497 times)
0 Members and 1 Guest are viewing this topic.
The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: December 09, 2012, 04:54:24 pm by corprius » Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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?
« Last Edit: December 09, 2012, 04:21:41 pm by corprius » Logged

The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
« Last Edit: December 09, 2012, 04:23:52 pm by corprius » Logged

The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged


Pages: [1]   Go Up
Jump to: