The Netherlands
Offline
Newbie
Karma: 0
Posts: 35
|
 |
« on: December 09, 2012, 03:55:20 pm » |
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
Faraday Member
Karma: 35
Posts: 3650
@ssh0le
|
 |
« Reply #1 on: December 09, 2012, 04:10:16 pm » |
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
|
|
|
|
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
The Netherlands
Offline
Newbie
Karma: 0
Posts: 35
|
 |
« Reply #2 on: December 09, 2012, 04:18:07 pm » |
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  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?
|
|
|
|
« Last Edit: December 09, 2012, 04:21:41 pm by corprius »
|
Logged
|
|
|
|
|
The Netherlands
Offline
Newbie
Karma: 0
Posts: 35
|
 |
« Reply #3 on: December 09, 2012, 04:20:39 pm » |
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 Thanks for your reply. I found the answer myself. I forgot that I had Atmel studio installed  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
Newbie
Karma: 0
Posts: 35
|
 |
« Reply #4 on: December 09, 2012, 04:53:59 pm » |
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
Faraday Member
Karma: 35
Posts: 3650
@ssh0le
|
 |
« Reply #5 on: December 09, 2012, 07:00:06 pm » |
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
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
|