Hi all, my code got stuck due to some error in the examples codes.
I got an uncalibrated part and behaved bad also other stuck at start, calibration area is erased when both not one is 0xff:
Wrong code:
if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)
{
while(1); // If calibration constants erased
// do not load, trap CPU!!
}
Right code:
if (CALBC1_1MHZ ==0xFF && CALDCO_1MHZ == 0xFF)
or short version
while (CALBC1_1MHZ ==0xFF && CALDCO_1MHZ == 0xFF) ; // trap CPU!
So I BULK erased flash and loaded calibration code.
Calibration routine failed again and oscillator was not @ correct frequency, code need an adjustment to wait oscillator settle out and stabilize.
More long delay is needed to oscillator startup and COMPLETE stabilization before to calibrate, Best way is to check oscillator fault flag till reset then wait half a second then run calibration code.
This is the delay code in calibration routine, not enough to reliable operation of LF oscillator
for (i = 0; i < 0xfffe; i++); // Delay for XTAL stabilization
Long time needed:
volatile long i;
for(i=0;i<300000,i++) _NOP; // Delay for XTAL stabilization
Or best solution wait till oscillator startup then wait stabilization
while (BCSCTL3 & LFXT1OF) ; // Wait till Xtal fault flag reset
for (i = 0; i < 0xfffe; i++); // Delay for XTAL stabilization
I am not sure this is corret place to post but i please TI personnel to do correction on code. Also correct xcap is needed to startup and stable run.
Regards