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.

Questions about setup MSP430FR5726 timer

Other Parts Discussed in Thread: MSP430FR5726

Its my first time to use the FR5726 timer, it says on the website the controller has 5 timer internally.

but the thing is that I found there is only two timer block in the diagram. timerA and timerB,  anyone who have the experience using the platform, could explain to me a little bit more about this?  In addition, where should I look for the example code if I want to learn how to configure them, basically I need 4 timer to generate interrupt to respond to different event.

Thank you for the help!

  • There can be several independent TimerA or TimerB modules.

    The MSP430FR5726 has:

    1. one TimerA module (TA0) with 3 CCRs;
    2. one TimerA module (TA1) with 3 CCRs;
    3. one TimerB module (TB0) with 3 CCRs;
    4. a watchdog timer;
    5. a real-time clock.

    (See table 3-1 in the device-specific datasheet.)

    The website appears to be wrong.

  • By Event, you mean a time (pause or interval) event?

    Is 3 and 1 at fixed interval OK? as there are only 3 CCR's plus the TAIE.
    as other option is to use second timer or two events share one CCRx and you have to compare and sort the delta to next one.

    This is how you set it up.(from G2553 so may need some small changes)

     #define TA1second (unsigned int) 1024      // 1024 when aclk=div8 and timmer=div4 (a tick = 0.977ms) 
     BCSCTL1 |= DIVA_3;				           // add the div the ALCK by 8 (saves power)
     TA1CTL = TACLR;
     TA1CTL = TASSEL_1 + MC_2 + ID_2 + TAIE;   // ACLK source, Continous up, input divider /4, rollover irq
     ...
    
    // state machines init stage that turns on its own private ccr irq by copy the freerunning tar value
       switch (alarm.state){ 
        
       case 0: TA1CCTL0 = 0;	               // interrupt disabled for TA1_0  
              {unsigned int temp;              // temporary vars need brackets inside switch/case
              do {temp = TA1R;}                // not same freq domain, read twice and cmp
              while(temp != TA1R);             // it's safe as 1KHz is way slower than 1MHz
              TA1CCR0 = temp + TA1second*2;}   // come back in two seconds   
              TA1CCTL0 = CCIE;                 // interrupt enabled for TA1_0
              alarm.state = 1;                              
              break;
       case 1: ...
    
    
    #pragma vector=TIMER1_A0_VECTOR		       // Timer A1_0 interrupt service routine
    __interrupt void Timer_A1 (void)           // Alarm event TIMER
    {  			
            event.alarm = 1;
            __bic_SR_register_on_exit(LPM3_bits);
    }
    #pragma vector = TIMER1_A1_VECTOR		   // Timer A1_1 Interrupt vector (shared)
    __interrupt void TIMER1_A1_ISR (void)
    {
      switch(__even_in_range(TA1IV,0x0A))
      {...
    

  • If you need to "generate interrupt to respond to different event", you can probably use a CCR in the capture mode to do so. Fr5726 has 3x3 = 9 CCR's.

    See Clements' respond:
    1. one TimerA module (TA0) with 3 CCRs;
    2. one TimerA module (TA1) with 3 CCRs;
    3. one TimerB module (TB0) with 3 CCRs;

**Attention** This is a public forum