TDE - Why doesn't the EEPROM intialize on reset?

Submitted by: TechTools

There are 2 reasons TDE does not currently initialize or provide a means of editing the EEPROM space.

1.) The EEPROM space is real EEPROM within the bondout chip. IF we initialized it each time you reset your program, we would add significant wear to the bondouts. Although 10,000 writes might seem like a lot, one could easily reset a program a 1,000 times in a month of development.

Of course, we could add some option where you manually forced it to initialize instead of automatically doing it. That could extend the life considerably.

2.) This is the more important issue. The ONLY WAY to write to EEPROM is to do so under full-speed firmware control. It can not be done while the bondout is halted or by stepping through EEPROM write sequences. This is due to the safty locks build into the EEPROM peripheral that disable the write if a single clock cycle occurs between the write sequence.

This makes WRITES **MUCH** more involved than reads. It can be done but it is not trivial. The only viable approach to allowing you to edit the EEPROM is to:
1. snapshot the current state of your application and registers
2. download a custom program to the ICE (replacing your firmware).
3. execute the new code at full-speed, breaking at the end of the routine.
4. re-download your firmware
5. unwind the stack and anything else we affected
6. restore the processor to the exact state it was in before you changed
the EEPROM cell.

This approach is not impossible, just quite involved. I believe we will incorporate such a feature in a future release but it is not planned for the next TDE release (5.0).

Here is a work-around that would allow you to initialize the EEPROM space on demand:
Write a separate program that does nothing but initialize the EEPROM. Then anytime you wish to return to this initialized state, load that project and run it. Then load your normal project and start debugging. Search for 'EEPROM' to find sample source code for reading and writing the EEPROM space.