Pages: [1]   Go Down
Author Topic: Can EEPROM be made read-only?  (Read 497 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Faraday Member
**
Karma: 80
Posts: 3795
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-cool .

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



Logged

Although I answer in good faith, remember always: Your Mileage May Vary.
Get me on LinkedIn: za.linkedin.com/in/jimbrownza/

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 197
Posts: 12743
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 92
Posts: 4710
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 518
Posts: 26359
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

EEPROM starts as 0xFF (255 DEC).
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Faraday Member
**
Karma: 80
Posts: 3795
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-cool
Logged

Although I answer in good faith, remember always: Your Mileage May Vary.
Get me on LinkedIn: za.linkedin.com/in/jimbrownza/

Pages: [1]   Go Up
Jump to: