I have a 32.768 KHz oscillator connected to XIN of a MSP4305418A microprocessor. ACLK is set to XT1CLK which is 32.768 KHz.
P7SEL |= 0X01; // select crystal bypass mode on XT1 pins
USCCTL4 = SELA__XT1CLK | SELS__DCOCLK | SELM__DCOCLK;
UCSCTL5 = DIVA__1 | DIVS__8 | DIVM__1;
UCSCTL6 = XT2OFF | XT1BYPASS;
I programmed timer A to use ACLK / 1. Timer A counts up to 1023 and resets.
TA0CCR0 = 0X03FF;
TA0CCTL0 = CCIE;
TA0CTL = TASSEL0 | MC0;
The interrupt handler toggles an output every time the counter overflows. The frequency of the output should be 16 Hz. I measured XIN and the output with a frequency counter on two MSP4305418A microprocessors.
XIN = 32.76795350 KHz (- 1.4 ppm)
output = 16.00714183 Hz (+ 446 ppm)
XIN = 32.76795848 KHz (- 1.3 ppm)
output = 15.94690128 Hz (- 3319 ppm)
As you can see, XIN is pretty accurate but the output frequency which is toggled by ACLK is inaccurate. One is a little high and the other is very low.
Why so much error?
Thanks.