Part Number: MSP-EXP430FR6989
Tool/software: Code Composer Studio
Hi,
I'm trying to measure the clock on TA0CLK by using the capture mode. Two signals are made with Timer_B0 (working) to create the TA0CCR1 and TA0CCR2 interrupts by using inputs on TA0.1 and TA0.2. But I did not succeed to make it work.
/*
* MSP430FR6989
* -----------------
* /|\| XIN|-
* | | | 32KHz Crystal
* --|RST XOUT|-
* | |
* | P1.0|--> LED
* | |
* TA0CLK-->|P1.2 | ==> Timer_A TA0 clock signal TA0CLK input, P1SEL1 = 1, P1SEL0 = 0
* | |
* | |
* TA0.1-->|P1.6 | ==> Timer_A TA0 CCR1 capture: CCI1A input, P1SEL0 = 1, P1SEL1 = 1, LCDsz = 0 (no segment)
* TA0.2-->|P1.7 | ==> Timer_A TA0 CCR2 capture: CCI2A input, P1SEL0 = 1, P1SEL1 = 1, LCDsz = 0 (no segment)
* | |
* | P3.5|--> TB0.1 = 6us off + 4us on ______|----|______|----|__, P3SEL1 = 1, P3SEL0 = 0, LCDsz = 0 (S24 - not used)
* | P3.6|--> TB0.2 = 2us off + 8us on __|--------|__|--------¬__, P3SEL1 = 1, P3SEL0 = 0, LCDsz = 0 (S23 - not used)
* | |
* | |
*
*/
/* Configure TA0CLK and TA1CLK as clock inputs
* with Timer related option */
P1DIR &= ~(BIT1 | BIT2); /* P1.1 and P1.2 as inputs */
P1SEL0 &= ~(BIT1 | BIT2); /* P1.1 and P1.2 options select 0 */
P1SEL1 |= (BIT1 | BIT2); /* P1.1 and P1.2 options select 1 */
/* Configure TA0.1 and TA0.2 as inputs with
* timer related option
*/
P1DIR &= ~(BIT6 | BIT7); /* TA0.1 and TA0.2 as inputs */
P1SEL0 |= (BIT6 | BIT7); /* options select 1 */
P1SEL1 |= (BIT6 | BIT7); /* options select 1 */
/* Configure Timer TA0 - External Clock 0 */
TA0CCTL1 = CM_1 | CCIS_0 | CAP | CCIE | SCS ; /* Synchronous capture mode on CCIS1A */
TA0CCTL2 = CM_1 | CCIS_0 | CAP | CCIE | SCS ; /* Synchronous capture mode on CCIS2A */
TA0CTL = TASSEL__TACLK | MC__CONTINUOUS; /* Source TA0CLK, Continuous mode */
/* Timer0_A0 interrupt service routine */
#pragma vector = TIMER0_A0_VECTOR
__interrupt void Timer0_A0_ISR (void)
{
switch (__even_in_range(TA0IV, TA0IV_TAIFG))
{
case TA0IV_TA0CCR1:
P1OUT ^= BIT0; // LED1 toggle
break;
case TA0IV_TA0CCR2:
P9OUT ^= BIT7; // LED2 toggle
break;
case TA0IV_TA0IFG:
break;
default:
break;
}
}
Any help is welcome !
Thanks in advance