Go Down

Topic: Can EEPROM be made read-only? (Read 1 time) previous topic - next topic

JimboZA

Hi all....

Thought just went through my mind that it would be handy to be able to write some identifying data into a few EEPROM locations- in case of confusion because "they all look the same to me", one would know which UNO was which.

But of course the whole point of EEPROM is that it is indeed EE  8) .

Is there any way that an EEPROM location can be made read-only? I guess even if there is such a way, it would need to be reversible in the long run.

Any thoughts, anybody?

(Or is the easiest way just to write my name on the thing with a marker?)



Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

Coding Badly


Marker(s) & CRC is the usual technique.  If the data is especially important include a two-phase commit when writing.

nickgammon

What might work would be to write some identifying bytes into the end of the bootloader. Most bootloaders will have a couple of spare bytes (it would be unusual if they fitted exactly into 512/1024/2048/4096 bytes).

You could grab the bootloader file for your current board, add an extra line to put those bytes in (get the sumheck right) and burn that on.

Under normal circumstances, and without special hardware, the bootloader is not changed.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

GoForSmoke

Here's a couple of possible tricks/strategies that should work.

If the data to be preserved is known the first time the flash program is run and the EEPROM cleared with the program able to determine that it has not initialized those bytes then sure you could safeguard that data.

I forget if EEPROM starts as all bits set or cleared but a program that only uses that state to check or erase bytes, perhaps limiting valid data to 7 bits or either 0-254 or 1-255 could 'know where the data ends'.

1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

CrossRoads

EEPROM starts as 0xFF (255 DEC).
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

JimboZA

I think I'll just use a marker...

Thanks for the replies.

Note to Messrs Arduino- leave space on the board for a "This board belongs to ....." label  8)
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

Go Up