Part Number: MSP430FR2433
Tool/software: Code Composer Studio
I have been reading and still cant get it to work...
I want to calibrate the VLO using the TimerA0. With the code below i am trying to enter Twice to the interreupt and get the time difference and use it to calibrate the VLO knowing the period as Application Report SLAA693A–January 2016–Revised February 2016 suggest
My problem is that the time keeps triggering and and TA0CCTL1 &= ~CCIFG is never cleared on the debugger...
any advice?
So i have this VLO Function
void cal_VLO(void)
{
cap_cnt1 = 0; // First capture counter
cap_cnt2 = 0; // Second capture counter
RTCMOD = RTC_CAL -1; // Ouput RTC pulse every RTC_CAL VLO clock cycles
RTCCTL = RTCSS__VLOCLK | RTCSR | RTCPS__1024;
TA0CCTL1 |= CM_1 | CCIS_1 | CAP | CCIE; // Timer0_A1 Setup
/// Capture rising edge,
// Capture on RTC output CCIS_1
/ CCIE Enable interrupt
// Enable capture mode,
TA0CTL |= TASSEL__ACLK | MC_2 | TACLR; // Use ACLK as clock source, clear TACLR
// Start timer in continuous mode
__bis_SR_register(LPM3_bits | GIE); //wake on first count
__no_operation();
__bis_SR_register(LPM3_bits); // wake again to get second count
counts = cap_cnt2 - cap_cnt1;
TA0CTL = 0; // Stop timer
TA0CCTL0 = 0;
RTCCTL = 0; // Stop RTC
}
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector = TIMER0_A1_VECTOR
__interrupt void TIMER0_A1_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER0_A3_VECTOR))) TIMER0_A1_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(TA0IV,TA0IV_TAIFG))
{
case TA0IV_NONE:
break; // No interrupt
case TA0IV_TACCR1:
if(cap_cnt1 ==0)
{
cap_cnt1 = TA0CCR1; // First capture counter
}
else
{
cap_cnt2 = TA0CCR1; / Second capture counter
}
/
TA0CCTL1 &= ~CCIFG; // Clear timer IFG
__bic_SR_register_on_exit(LPM3_bits); // Exit LPM3
break; // CCR1 not used
case TA0IV_TACCR2:
break; // CCR2 not used
case TA0IV_TAIFG:
break; // overflow
default:
break;
}
}