This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430FR6972: msp430fr6972

Part Number: MSP430FR6972
Other Parts Discussed in Thread: MSP430FR6989

Tool/software: Code Composer Studio

Hello ,

I am making CAPTURE PROGRAM.

I am using MSP430FR6972 (I am making a pulse counter)

My intention is  1) to take the analog Value through capture program,

                       2) and then send to value to scope (to check the frequency).

I am also using UART program , and checking the "Tx data" to scope 

( I am not sure...i am doing correct or not ......  The data received by CAPTURE .....is sending via uart)

But I am getting some random value at SCOPE ( some time MHz, sometimes KHz)

unsigned int timerAcapturePointer = 0;
int main(void)
{
  WDTCTL = WDTPW | WDTHOLD;                 // Stop watchdog timer

    
  PM5CTL0 &= ~LOCKLPM5;

 //===============================PIN DEFINED===========================================

          P1SEL0 |=BIT3 ;                    // Pulse Capture
          P1SEL1 &=~BIT3;
          P1DIR &=~BIT3;


  //====================================CLOCK==============================================
/*
  // Clock System Setup
  CSCTL0_H = CSKEY >> 8;                    // commented
  CSCTL2 |= SELA_7;                          //commented
  CSCTL2 |= SELA__VLOCLK;                   // commented
  CSCTL0_H = 0x00;                          // commented

//  __delay_cycles(1000);                     // commented
*/


              CSCTL0_H = CSKEY >> 8;
             CSCTL1 = DCOFSEL_0;
             CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK;
             CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;
             CSCTL4 &= ~LFXTOFF;
             do
             {
               CSCTL5 &= ~LFXTOFFG;
               SFRIFG1 &= ~OFIFG;
             }while (SFRIFG1&OFIFG);
             CSCTL0_H = 0;


//=======================================================================================

//        LCD_init();                      //commented
        uart_init();
//        adc();                           //commented

 //=================CAPTURE ============================================================
  // Timer0_A3 Setup
  TA0CCTL2 = CM_1 | CCIS_1 | SCS | CAP | CCIE;   // Capture rising edge,Use CCI2B=ACLK,Synchronous capture,Enable capture mode,Enable capture interrupt

  TA0CTL = TASSEL__SMCLK | MC__CONTINUOUS;  // Use SMCLK as clock source,Start timer in continuous mode

   while(1)
   {
  __bis_SR_register(LPM3_bits | GIE);
   }
}



TIMER INTERRUPT  :


#pragma vector = TIMER0_A1_VECTOR
__interrupt void Timer0_A1_ISR(void)
{
  switch (__even_in_range(TA0IV, TA0IV_TAIFG)) {
    case TA0IV_TA0CCR1:


      break;
    case TA0IV_TA0CCR2:
        timerAcapturePointer = TA0CCR2;
      
           putchar(timerAcapturePointer);

      __delay_cycles(100000);
        LPM3_EXIT;
      break;
    case TA0IV_TA0IFG:
      break;
    default:
      break;
  }
}

I am using  MSP430FR6972.
And I want to check the Frequency on the "SCOPE".
There is NO PROBLEM with UART.

CAN YOU PLEASE CHECK IT,,

AND PLEASE TELL ME  .....

where Am I doing wrong?

(I m not sure of the program too......so please response)

Regards,

Srijit.

  • >  TA0CCTL2 = CM_1 | CCIS_1 | SCS | CAP | CCIE;   // Capture rising edge,Use CCI2B=ACLK,Synchronous capture,Enable capture mode,Enable capture interrupt

    P1.3 is [TA1.]CCI2A, not [TA0.]CCI2B [Ref Data Sheet (SLASE23E) Table 6-19]. [TA0.]CCI2A is over on P1.7 [Table 6-20].

    You can move your input wire or change TA0->TA1. Then:

    >  TA0CCTL2 = CM_1 | CCIS_0 | SCS | CAP | CCIE;   // Capture rising edge,Use CCI2A=P1.7,Synchronous capture,Enable capture mode,Enable capture interrupt

    ---------------

    >         putchar(timerAcapturePointer);

    This will only send the low byte of the captured value, which isn't very useful. You should send both bytes, but if you can really only send one, the high byte will be (slightly) more useful:

    >         putchar((timerAcapturePointer >> 8) & 0xFF);  // high byte of timer value

    ---------------

    [Edit: On re-reading the data sheet I noticed that P1.3 doesn't come into TA0 at all, rather TA1. Updated accordingly.]

  • Hi Bruce,

    Thank you very much for the reply.

    I did some change : 

    INTERRUPTS  :
    
    #pragma vector = TIMER1_A1_VECTOR
    __interrupt void Timer1_A1_ISR(void)
    {
      switch (__even_in_range(TA1IV, TA1IV_TAIFG)) {
        case TA1IV_TA1CCR1:
          break;
        case TA1IV_TA1CCR2:
             timerAcapturePointer = TA1CCR2;
            putchar((timerAcapturePointer >> 8) & 0xFF);
            __delay_cycles(100000);
             LPM3_EXIT;
          break;
        case TA1IV_TA1IFG:
          break;
        default:
          break;
      }
    }
    
    
    MAIN : 
              TA1CCTL2 = CM_1 | CCIS_1 | SCS | CAP | CCIE;   // Capture rising edge,Use CCI2B=ACLK,Synchronous capture,Enable capture mode,Enable capture interrupt
              TA1CTL = TASSEL__SMCLK | MC__CONTINUOUS;  // Use SMCLK as clock source,Start timer in continuous mode
    
    # IF I USE CCIS_0 ( FOR CCI2A ): the interrupt is not working, 
                  But if I use CCIS_0(CCI2B)...the interrupts is working.
    
    

    CAN you please tell me , 

    Any idea?

    (According to DATASHEET , it should be  CCIS_0 (CCI2A).

    Regards,

    Srijit.

  • HII,

    Srijit Munian said:
    But if I use CCIS_0(CCI2B)...the interrupts is working.

    :

    it will be "CCIS_1" not "CCIS_0".

  • I don't see anything obvious either. You're still using P1.3 for your input signal?

    Does it change anything if you use LPM0 instead of LPM3?

  • hii.I am using the same pin.

    P1.3.

    It is a customized board.

    And I need to use that pin till now.

    Regards,

    Srijit

  • I put your code on an MSP430FR6989 Launchpad, generated a (1kHz) signal on P1.7 and patched that to P1.3. Result: I get captures as expected with CCIS=0. I had to add "PJSEL0 |= (BIT4|BIT5); " to get past the LFXT startup loop.

    All I can think of is that somehow your signal is not getting to P1.3, since everything else seems to be in place. Do you have a scope to watch P1.3?

**Attention** This is a public forum