I am using Timer_A in compare mode to generate PWM output on my MSP430f1xx. During Osc failure, I am changing Timer_A source from SMCLK to ACLK (XTS=1).
ACLK now runs on the same frequency as SMCLK did, and all the Timer registers look ok. But the PWM output frequency is now random (which i assume is because Timer_A is not running on ACLK as intended).
Here is my NMI routine,
#pragma vector=NMI_VECTOR
__interrupt void nmi_ (void)
{
if (OFIFG) {
configure_lfxt1(); // Ok
IFG1 &= ~NMIIFG;
IFG1 &= ~OFIFG;
IE1 |= NMIIE;
TACTL &= ~(MC0 | MC1);
TACTL &= ~TASSEL_2;
TACTL |= TASSEL_1;
__delay_cycles(200);
TACTL |= MC_1;
}
Any pointers would be appreciated. Thanks,