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.
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.
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
Absolutely. I even ran the bus clk out to a pin to double check, and it is at 2Mhz.
Thanks.