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.

MSP430FR5729 timer A0 behaves different than MSP430F2274 timer A

Other Parts Discussed in Thread: MSP430F2274, MSP430FR5729, MSP430FR5739, TEST

I have two pieces of coda that are almost exactly the same. Code was originally written for MSP430F2274 but recently ported th MSP430FR5729.The code is for a programmable medical stimulation device, Basically I am creating an output pulse and using an external interrupt to rest the timer if it sences X interrupts per second in the inhibited mode. When I switch to triggered mode the interrupt should always trigger the timer with in a cetrain time frame. Basically I am switching from auto triggering to manual triggering. The code works in both modes of operation for the 2274, pulse function works Icapulse works. The 5729 will not trigger manually, pulse function works Icapulse does not.  Here is the source code, can someone explain why Icapulse (); will not release timer?

2274 Code.

#include "msp430x22x4.h"

/*      Global Variables                   */
unsigned int activity = 0x00;

/*      function proto types          */
void pulse(void);
void icapulse(void);
void comp_heart(void);                        // interupt clear timer A
void comp_activity(void);                      // interupt

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                  // Stop WDT
 
  BCSCTL1 = CALBC1_1MHZ;                       // Set DCO to 1MHz
  DCOCTL = CALDCO_1MHZ;        //  
 
  //pulse(); 
  icapulse();
  P4DIR = 0xC4;                                 // Provides power to comaparator 
  P4OUT = 0x40;                                 // No Transistor
  comp_heart();
             
  _BIS_SR(LPM3_bits + GIE);      // Enter LPM3 + GIE
 
  while (1) 
  {
 
  }  
 
}  

void pulse(void)

  P1DIR |= 0x0C;                            // P1.2 and P1.3 output 0x04 0C       0000 0100
  P1SEL |= 0x0C;                            // P1.2 and P1.3 TA1/2 otions 0x04 0C 0000 0001 
 
  TACCTL0 = 0x00;                             // Clear Capture/Compare Control Register   
  TACCR0 = 32760;                             // PWM Period 32000-1;
 
  TACCTL1 = OUTMOD_7;                         // TACCR1 reset/set
  TACCR1 = 11;                                // TACCR1 PWM duty cycle 10 
  TACCTL2 = OUTMOD_7;                         // TACCR2 reset/set
  TACCR2 = 11;                             // TACCR2 PWM duty cycle 30000                   
  TACTL = TASSEL_1 + MC_1 + TACLR;
}

void icapulse(void)

  P1DIR |= 0x0C;                              // P1.2 and P1.3 output 0x04 0C       0000 0100
  P1SEL |= 0x0C;                              // P1.2 and P1.3 TA1/2 otions 0x04 0C 0000 0001
     
  TACCTL0 = CCIE;                           // TACCR0 interrupt enabled   
  TACCR0 = 32760;                             // PWM Period 32000-1;
  TACCTL1 = OUTMOD_7;                         // TACCR1 reset/set
  TACCR1 = 11;                                // TACCR1 PWM duty cycle 10 
  TACCTL2 = OUTMOD_7;                       // TACCR2 reset/set
  TACCR2 = 16384;                              // TACCR2 PWM duty cycle 30000   
  TACTL = TASSEL_1 + MC_0 + TACLR;                    // ACLK, up mode  OK  
}

// Timer A0 interrupt service routine
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A0(void)

  TACTL = TASSEL_1 + MC_0; 
}

void comp_heart(void)

  //P2DIR |= 0x20;                              // Set P2.5 to output dir 0010 0000 tp6 0x08
  P2IE  |= 0x02;                              // P2.1 interrupt enabled 0000 0010     0x20
  P2IES &= ~0x02;                             // P2.1 LO / Hi edge
  P2IFG &= ~0x02;                             // P2.1 IFG cleared   
}

void comp_activity(void)
{
  //P2DIR |= 0x10;                              // Set P2.4 to output dir 0001 0000 tp5 0x04
  P2IE  |= 0x04;                              // P2.2 interrupt enabled 0000 0100     0x10
  P2IES &= ~0x04;                             // P2.2 LO / Hi edge
  P2IFG &= ~0x04;                             // P2.0 IFG cleared   
}

// Port 2 interrupt service routine
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)

  if(P2IFG & 0x02)                            // Comp_Heart in 0000 0010
  {    
    P2IFG &= ~0x02;                           // P2.1 IFG cleared   
 TACTL = TASSEL_1 + MC_1 + TACLR;
  }
  else if(P2IFG & 0x04)                       // Comp_Activity in 0000 0100 
  {                                                 
   P2IFG &= ~0x04;                            // P2.2 IFG cleared  
   activity++;                                // Increment Activity  
  } 
}

5729 Code.


#include "msp430fr5739.h"

/*      Global Variables                   */
unsigned int activity = 0x00;

/*      function proto types          */
void pulse(void);
void icapulse(void);
void comp_heart(void);                         // interupt clear timer A
void comp_activity(void);                     // interupt

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                    // Stop watchdog timer 
  // XT1 Setup
  PJSEL0 |= BIT4 + BIT5;
 
  CSCTL0_H = 0xA5;
  CSCTL1 |= DCOFSEL0 + DCOFSEL1;             // Set max. DCO setting
  CSCTL2 = SELA_0 + SELS_3 + SELM_3;         // ACLK = XT1, SCLK = DCO, MCLK = DCO
  CSCTL3 = DIVA_0 + DIVS_3 + DIVM_3;         // aclk /1, sclk / 8, mclk /8, set dividers
  CSCTL4 |= XT1DRIVE_0;
  CSCTL4 &= ~XT1OFF;
 
  do
  {
    CSCTL5 &= ~XT1OFFG;                       // Clear XT1 fault flag
    SFRIFG1 &= ~OFIFG;
  }
  while (SFRIFG1&OFIFG);                     // Test oscillator fault flag        
     
  //pulse(); 
  icapulse();
  P4DIR = 0xC4;                                // Provides power to comaparator
  P4OUT = 0x40;                                // No Transistor
  comp_heart();
            
  _BIS_SR(LPM3_bits + GIE);      // Enter LPM3 + GIE
 
  while (1) 
  {
 
  }  
 
}  

void pulse(void)
{   
  P1DIR |= BIT0+BIT1;                       // P1.0 and P1.1 output     P1DIR |= 0x03; 0000 0011
  P1SEL0 |= BIT0+BIT1;       // P1.0 and P1.1 options select  P1SEL |= 0x03; 0000 0011  
 
  TA0CCTL0 = 0x00;
  TA0CCR0 = 32760;                             // PWM Period 32000-1;
  TA0CCTL1 = OUTMOD_7;                         // TA0CCR1 reset/set
  TA0CCR1 = 11;                                // TA0CCR1 PWM duty cycle 10 
  TA0CCTL2 = OUTMOD_7;                       // TACCR2 reset/set
  TA0CCR2 = 11;                              // TACCR2 PWM duty cycle 16384
  TA0CTL = TASSEL_1 + MC_1 + TACLR;                
}

void icapulse(void)

  P1DIR |= BIT0+BIT1;                       // P1.0 and P1.1 output     P1DIR |= 0x03; 0000 0011
  P1SEL0 |= BIT0+BIT1;       // P1.0 and P1.1 options select  P1SEL |= 0x03; 0000 0011 
     
  TA0CCTL0 = CCIE;                           // TA0CCR0 interrupt enabled   
  TA0CCR0 = 32760;                             // PWM Period 32000-1;
  TA0CCTL1 = OUTMOD_7;                         // TA0CCR1 reset/set
  TA0CCR1 = 11;                                // TA0CCR1 PWM duty cycle 10 
  TA0CCTL2 = OUTMOD_7;                       // TACCR2 reset/set
  TA0CCR2 = 11;                              // TACCR2 PWM duty cycle 30000
  TA0CTL = TASSEL_1 + MC_0 + TACLR;                 
}

// Timer A0 interrupt service routine
#pragma vector = TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{  
  TA0CTL = TASSEL_1 + MC_0;
}

void comp_heart(void)

  //P2DIR |= 0x80;                              // Set P2.7 to output dir 1000 0000
  P2IE  |= 0x08;                              // P2.3 interrupt enabled 0000 0010     0x20
  P2IES &= ~0x08;                             // P2.3 LO / Hi edge
  P2IFG &= ~0x08;                             // P2.3 IFG cleared   
}

void comp_activity(void)
{  
  //P2DIR |= 0x80;                              // Set P2.7 to output dir 1000 0000
  P2IE  |= 0x10;                              // P2.4 interrupt enabled 0000 0100     0x10
  P2IES &= ~0x10;                             // P2.4 LO / Hi edge
  P2IFG &= ~0x10;                             // P2.4 IFG cleared   
}

// Port 2 interrupt service routine
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
{   
  if(P2IFG & 0x08)                            // Comp_Heart in 0000 0010
  {   
    P2IFG &= ~0x08;                           // P2.3 IFG cleared
 TA0CTL = TASSEL_1 + MC_1 + TACLR;
  }
  else if(P2IFG & 0x10)                       // Comp_Activity in 0000 0100
  {                                                 
   P2IFG &= ~0x10;                            // P2.4 IFG cleared
   activity++;                                // Increment Activity  
  }     
}

**Attention** This is a public forum