EEprom writes unreliably - 9S08PT32

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EEprom writes unreliably - 9S08PT32

573 Views
larrymitschke
Contributor II

Hi,

 

I am getting some bytes that do not write correctly in eeprom (some left blank at FF and some 00) when setting default values on first powerup.  I suspected the eeprom clock running too fast, but the FCLKDIV register is set per the data sheet:

 

Crystal  4Mhz

Bus Clk 2Mhz

NVM_FCLKDIV = 0X01   // for fclk of 1Mhz

 

Because it acts as if the clk is too fast, I set the FCLKDIV to 0X02 to slow it down.  Now it programs the eeprom all correctly, but I don't see this as a solution because I am worried about overstressing the eeprom over time.  Am I missing something that I have overlooked? 

 

I am using the Cosmic compiler and their library routines, and they have verified that the routines work correctly on their test setup.

Labels (1)
Tags (2)
0 Kudos
3 Replies

465 Views
larrymitschke
Contributor II

Problem turned out to be the WDT timing out in the middle of saving default values in the first-time-power-up routine.  Upon restart, the software thought all the default settings were filled and bypassed the EEprom routine, leaving blank addresses.

0 Kudos

465 Views
pgo
Senior Contributor V

Hi Larry,

An obvious question is how are you setting up the Processor Clock.  Are you sure it's operating with a bus frequency of 2MHz (FBE/FBELP with a BDIV of 1)?

bye

0 Kudos

465 Views
larrymitschke
Contributor II

Absolutely.  I even ran the bus clk out to a pin to double check, and it is at 2Mhz.

Thanks.

0 Kudos