Electronics > Microcontrollers

Zeroing microcontroller EEPROM in a product

(1/4) > >>

Psi:
Are there any downsides to zeroing all MCU eeprom locations to 0x00 as the default state for a product.
I ask because it seems more logical to have product settings in eeprom that default to off so they can be used as boolean.
I could add code to treat 0xFF as off but it would be simpler to just set all eeprom to 0x00 to start with.

The eeprom in ATMegas is byte oriented so there's no paging issues.

Can anyone think of physical or software reason why 0xFF is preferable as the default eeprom state?



ve7xen:
I would deal with this by using one byte as a marker value (e.g. if address 0 is 0xaa, EEPROM data is valid, else initialize it to defaults), or better yet, store a checksum. There are lots of ways the state might be corrupted that could make your code behave screwy if you just trust it.

Unless you're using every byte of EEPROM I don't see an advantage to the extra programming step, but I don't think it can cause harm either. 0xff is just the default state for newly manufactured EEPROM cells (no charge stored on the floating gate), the manufacturer doesn't go to the trouble of setting them to that specifically.

nctnico:
+1 for the checksum. I usually use CRC32 instead of a simple XOR or sum.

mikeselectricstuff:
Why add unnecessary code? You _know_ a factory part will be all 0xff. Why add the risk that a bug in your code may not initialise it correctly in all situations (e.g. powerdown during zeroing).

Codemonkey:

--- Quote from: mikeselectricstuff on January 04, 2013, 10:01:26 am ---Why add unnecessary code? You _know_ a factory part will be all 0xff. Why add the risk that a bug in your code may not initialise it correctly in all situations (e.g. powerdown during zeroing).

--- End quote ---

Thats not always the case though. I'm pretty sure I've seen in datasheets of devices I used (long ago admittedly) that the contents of on chip EEPROM was undetermined and could not be guarenteed to be all F's on products straight from the manufacturer, so basically read the datasheet carefully if you're going to make an assumption like that.

I do agree about not adding uncecessary code wherever possible though!

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod