Not Erasing EEPROM when programming

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did a search here but didn't see anything that menioned this already.
Is there an option or setting to set AVRSTUDIO 4.05 to not erase the eeprom when programming the flash program memory?
I am using a AVRISP unit with a AT90S8535 at the moment.
What I want to do is have the program/MCU calibrate itself and store the data in the EEPROM, then if I need to change the program, I don't have to have it re-calibrate itself again.
In this case it's reading Red Green Blue color range values off of a color sensor and saving the results.
But if I reprogram the MCU, the eeprom gets reset back to all FF's.
It's probably obvious, but I don't see it at this time, maybe too much Christmas dinner earlier. ;)
Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi :

I think it depends on the avr you are using. At least, the mega series has a fuse for this pourpose, is "EEPROM memory is preserved throug the Chip Erase". Set this fuse and you eeprom memory won't be ereased.

Regards,
Alejandro.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi :

Just checked, at90s8535 doesnt't has this fuse. Sorry .

Regards,
Alejandro.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Some programming systems can help you out, but I don't think AVRStudio has this feature.

In CodeVision, I can click on "Preserve EEPROM". It then does a read of the EEPROM space, does the chip erase, and proceeds with the programming and verification of flash & EEPROM.

Ths sequence can be replicated with AVRStudio, but not with one check mark. :) We have also done it "semi-automatically" with a batch file and STK500.EXE.

Lee

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks guys, I appreciate it.
I was just using up some at90s8535's I had before I start using the new Atmega8535's.
It's not a big hassle, except you have to suffer the time lag of recalibrating before you can see if your program is working correctly. Sort of like the good old days when we used UV erasable eproms to program these things.
I can turn off the erase chip option and also the verify after programming option and it doesn't erase the eeprom for me. If you only turn off one option you get a error when it tries to verify.
So I'll go that route, when I get done, I can turn them back on and recalibrate like normal.
Have a happy holiday too.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"...except you have to suffer the time lag of recalibrating before you can see if your program is working correctly."

Did you try just doing the one more step of uploading the existing EEPROM first before programming as normal? It's really not that hard if you keep your wits about you. Just one more click to Read EEPROM which overwrites the image produced by the assembler or compiler.. then program with the normal sequence, using "old" EEPROM and "new" flash.

Lee

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes that looks like it'll work. It reads in the EEPROM into a separate file
which you can use to re-program the EEPROM when it erases it.
I hadn't thought about that as I didn't expect the prgramming system to erase the eprom unless I really wanted it to.
Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"...It reads in the EEPROM into a separate file which you can use to re-program the EEPROM when it erases it."

Close. You can always (ignoring lock bits) read and store flash or EEPROM images for later programming, changing file type, etc. Some programming systems have more facilities in this area than others.

But it is just a little different in the sequence that I mentioned. When you do a programming sequence, the flash and EEPROM images from the current "buffer" are used. Hittiing the Read EEPROM or similar button first gets the EEPROM contents from the chip and puts them in the current buffer, throwing away what was already there. They aren't on disk anywhere, and will be lost after the current session.

"I didn't expect the prgramming system to erase the eprom unless I really wanted it to."

The nature of the AVR is that it needs to be erased before programming. The erase takes care of flash & EEPROM, except in the new AVRs that have the fuse to not erase EEPROM. The programming system can't do anything about it, except to do the read-first two-step like CodeVision does.