Pages: [1]   Go Down
Author Topic: setting the initial state of the EEPROM  (Read 810 times)
0 Members and 1 Guest are viewing this topic.
Brooklyn, NY, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 115
arduino for all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am starting to mess with the EEPROM library to store the state of Firmata.  I have run into a question that I can't seem to find the answer to.  Basically, I need to find a way to set the initial state of the EEPROM so that I can set the initial state of Firmata.  I imagine that by default the EEPROM has gibberish in it, like reading unallocated memory.  Ideally, there would be some way to init the EEPROM to 0.

This thread says
Quote
I think if I read the bootloader correctly the EEPROM is erased when you upload a sketch
.  That would work quite nicely if that was true.  But it does not seem to be.  According to my tests, the EEPROM remains untouched when burning a new firmware.

This thread means that there is code in the bootloader for reseting the EEPROM.  Any chance of this getting activated?  

Or are there other options for reseting the EEPROM? Maybe this would work best as a menu option in the Arduino IDE.

« Last Edit: April 09, 2007, 05:45:58 pm by eighthave » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 203
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Perhaps you could use some sort of signature? Say, if the the EEPROM begins 0xdeadbeef or whatever you choose then you will believe that you have initialized it and it has your data in it. Otherwise, initialize it in your code. You probably want a version number in there too so you know when it is initialized with old format data after you inevitably change formats.
Logged

Brooklyn, NY, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 115
arduino for all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, that's a good hack for that.  I thought of another: adding a function to the Firmata firmware that zeros the EEPROM and make it part of the SYSTEM_RESET functionality.


But now I can't seem to undo my EEPROM writes... hmm...
« Last Edit: April 09, 2007, 07:02:54 pm by eighthave » Logged

Underhill Center, Vermont, USA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 71
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am starting to mess with the EEPROM library to store the state of Firmata.  I have run into a question that I can't seem to find the answer to.  Basically, I need to find a way to set the initial state of the EEPROM so that I can set the initial state of Firmata.  I imagine that by default the EEPROM has gibberish in it, like reading unallocated memory.  Ideally, there would be some way to init the EEPROM to 0.

This thread says
Quote
I think if I read the bootloader correctly the EEPROM is erased when you upload a sketch
.  That would work quite nicely if that was true.  But it does not seem to be.  According to my tests, the EEPROM remains untouched when burning a new firmware.

This thread means that there is code in the bootloader for reseting the EEPROM.  Any chance of this getting activated?  

Or are there other options for reseting the EEPROM? Maybe this would work best as a menu option in the Arduino IDE.


I am not so usre that erasing EEPROM with each sketch upload would be such a good idea.

  (1) the whole write cycle thing, although flash is getting rewritten each time a sketch is loaded I am wondering about the write-cycle life of the EEPROM.

  (2) on a more personal basis I want to use EEPROM in a simple program to read to store and EEPROM 1-Wire device IDs, then load a different sketch to make use of the 1-Wire devices.
 
 cheers ... BBR
Logged

Pages: [1]   Go Up
Jump to: