I find that TA0R does not increment when I set CAP = 1.
First I set up TA0 along with TB1 and TB2, and start them closely together:
// Configure P2.3 as CCI0B input for TA0CCR0 capture
P2SEL0 |= BIT3;
P2SEL1 &= ~(BIT3);
P2DIR &= ~(BIT3);
// Set time base to source from same clock as everything else
TA0CTL |= TASSEL__ACLK | ID__8;
// Setup TA0CCR0 for:
// -- Capture on both rising/falling edges ( CM_3 )
// -- Select CCI0B (P2.3) as the capture input pin
// -- Synchronize captures to clock ( .SCS bit / bit 11 )
// -- Enables capture mode ( .CAP bit / bit 8 ) = 1
TA0CCTL0 |= CM_3 | CCIS_1 | BIT8 | BITB;
// After all configuration is done, enable the CCR0 capture interrupt
TA0CCTL0 |= CCIE;
I also configure TB1/TB2 ( just to show clocks/timers are running )
TB1CCR0 = 62500;
TB2CCR0 = 62500;
TB1CCTL0 |= CCIE;
TB2CCTL0 |= CCIE;
Then I start all three timers TA0, TB1, TB2:
// Start the actual timers ...
TB2CTL = TBSSEL__ACLK | ID__8 | MC__UP;
TB1CTL = TBSSEL__ACLK | ID__8 | MC__UP;
TA0CTL = TASSEL__ACLK | ID__8 | MC__UP;
// Then reset timers to all start at 0
TB2CTL |= TBCLR;
TB1CTL |= TBCLR;
TA0CTL |= TACLR;
When I observe TA0CTL & TA0CCTL0 in a debug environment, it seems everything is set up correctly like in my code:
It seems like TA0R never increments! And I cannot figure out why this is so when TACTL0 is configured correctly. To show that ACLK is running as well as TB1/TB2:
When I input a pulse into P2.3 / CCI0B, the interrupt is triggered and the program enters the ISR I can tell it enters the ISR because I put a breakpoint inside of it:
#pragma vector = TIMER0_A0_VECTOR
__interrupt void Timer0_A0_ISR(void)
{
__no_operation(); // Breakpoint on this line
myBufferValue = TA0CCR0;
}
However, since TA0R never increments, the value of myBufferValue is always zero.
What am I doing wrong here? Why does TA0R never increment despite UP_MODE being selected? From the status bits in TA0CTL / TA0CCTL0 it seems configured as per the manual.