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/MSP430FR2000: Unable to take interrupt at P1.6

Part Number: MSP430FR2000
Other Parts Discussed in Thread: MSP430FR2100

Tool/software: Code Composer Studio

Hello,

My code makes P1.6 ON and goes OFF by LOW to HIGH edge at P1.3 and turn ON a RTC for 1 second and toggles back P1.6 waiting for interrupt at P1.3. This repeats.

#include <msp430.h>

/* Global Variables */
#if defined(__IAR_SYSTEMS_ICC__)
__persistent volatile unsigned char timeIncrement = 0; //Software Count Variable
 #elif defined(__TI_COMPILER_VERSION__)

#endif

#define MODCOUNT (32-1)

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;

    P1OUT = 0x00;
    P1DIR = ~BIT3;

    P2OUT = 0x00;
    P2DIR = 0xFF;

    P2SEL1 = BIT6 | BIT7;            // P2.6~P2.7: crystal pins
    SYSCFG0 = FRWPPW;            // Enable FRAM write access

    P1OUT ^= BIT6;


    PM5CTL0 &= ~LOCKLPM5;

    // Initialize crystal
    do
    {
        CSCTL7 = 0;             // Clear XT1 fault flag
        SFRIFG1 = 0;            // Clear fault flag
    } while (SFRIFG1 & OFIFG);  // Test oscillator fault flag


        P1REN = BIT3;
        P1IES = 0x00;
        P1IE  = BIT3;
        CSCTL4 = SELA__XT1CLK;

    __bis_SR_register(LPM3_bits | GIE);     // Enter LPM3, enable interrupt
}

#pragma vector=RTC_VECTOR
__interrupt void RTC_ISR(void)
{
    switch(__even_in_range(RTCIV,RTCIV__RTCIFG))
    {
        case  RTCIV__NONE:   break;          // No interrupt
        case  RTCIV__RTCIFG:                 // RTC Overflow

          P1OUT ^= BIT6;
            RTCCTL = RTCSS__XT1CLK | RTCSR | RTCPS__1024; //Stop RTC
            P1REN = BIT3;                    // P1.3 pull-down register enable
            P1IES = 0x00;                    // P1.3 Low/High edge
            P1IE  = BIT3;                    // P1.3 interrupt enabled
           __bis_SR_register_on_exit(LPM3_bits | GIE);

               break;
        default: break;
    }
}

#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
      P1OUT ^= BIT6;
    P1IE  = 0x00;
    P1IFG = 0x00;                            //Clear P1.3 IFG

    RTCMOD = MODCOUNT;

    RTCCTL = RTCSS__XT1CLK | RTCSR | RTCPS__1024 | RTCIE;

     __bis_SR_register_on_exit(LPM3_bits | GIE);

}

If I invert the working of P1.3 and P1.6 i.e wait for interrupt in P1.6, the ISR wont work for P1.6. Why is this happening as it should work the same for both. Am i missing something

#include <msp430.h>

/* Global Variables */
#if defined(__IAR_SYSTEMS_ICC__)
__persistent volatile unsigned char timeIncrement = 0; //Software Count Variable
 #elif defined(__TI_COMPILER_VERSION__)

#endif

#define MODCOUNT (32-1)

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;

    P1OUT = 0x00;
    P1DIR = ~BIT6;

    P2OUT = 0x00;
    P2DIR = 0xFF;

    P2SEL1 = BIT6 | BIT7;            // P2.6~P2.7: crystal pins
    SYSCFG0 = FRWPPW;            // Enable FRAM write access

    P1OUT ^= BIT3;


    PM5CTL0 &= ~LOCKLPM5;

    // Initialize crystal
    do
    {
        CSCTL7 = 0;             // Clear XT1 fault flag
        SFRIFG1 = 0;            // Clear fault flag
    } while (SFRIFG1 & OFIFG);  // Test oscillator fault flag


        P1REN = BIT6;
        P1IES = 0x00;
        P1IE  = BIT6;
        CSCTL4 = SELA__XT1CLK;

    __bis_SR_register(LPM3_bits | GIE);     // Enter LPM3, enable interrupt
}

#pragma vector=RTC_VECTOR
__interrupt void RTC_ISR(void)
{
    switch(__even_in_range(RTCIV,RTCIV__RTCIFG))
    {
        case  RTCIV__NONE:   break;          // No interrupt
        case  RTCIV__RTCIFG:                 // RTC Overflow

          P1OUT ^= BIT3;
            RTCCTL = RTCSS__XT1CLK | RTCSR | RTCPS__1024; //Stop RTC
            P1REN = BIT6;                    // P1.3 pull-down register enable
            P1IES = 0x00;                    // P1.3 Low/High edge
            P1IE  = BIT6;                    // P1.3 interrupt enabled
           __bis_SR_register_on_exit(LPM3_bits | GIE);

               break;
        default: break;
    }
}

#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
      P1OUT ^= BIT3;
    P1IE  = 0x00;
    P1IFG = 0x00;                            //Clear P1.3 IFG

    RTCMOD = MODCOUNT;

    RTCCTL = RTCSS__XT1CLK | RTCSR | RTCPS__1024 | RTCIE;

     __bis_SR_register_on_exit(LPM3_bits | GIE);

}

  • What's attached to P1.3/P1.6? I'm having trouble picturing your test setup.

    I see potential bounce troubles: In general, you should (habitually) clear the IFG just before setting the IE.
  • 1st case P1.6 has an LED and P1.3 is getting the Low to high edge. In the second case P1.3 has LED and P1.6 gets the Low to High edge. Code is the same in both cases (just interchanged P1.6 and P1.3) but works only in the first case.
  • I put both examples on an FR2311 Launchpad and (reversing the jumpers) they both perform as expected -- when I touch the trigger pin to GND I see the LED go out for a while, then come back. I don't have an FR2000.

    I had to use VLOCLK for the RTC since I don't have a crystal installed. I did see some bounce effects (phantom LED blinks) but they sorted themselves out, and they disappeared completely when I added clearing P1IFG before setting P1IE.

    What platform are you using? If this were a Launchpad I would ask if your UCA0TXD/RXD jumpers were still connected.
  •  Hello,

    Thank you. I have followed you. I used the same code for FR2433 launchpad I had. It worked perfectly. I have a custom made board to evaluate.  This is the case with MSP430FR2100 aswell. I will check with other pins aswell.

    Regards,

    Prudhvi Sagar

  • Hello,
    I have checked with other pins of Port 1 aswell. Interrupt is working on P1.0, 1.1, 1.2, 1.3. I think it has got to do with 'C' given in data sheet.

    Regards,
    Prudhvi Sagar
  • I'm not sure what you mean. Are you referring to rev C of the data sheet? (Changes seem innocuous.) Or the Comparator Cx pin functions?

    I was going to blame (4-wire) JTAG, but I haven't found any evidence for it in the Books. (And I'm still working blind here.)

  • Hello,

    Was referring to these. Im not sure.

    Regards,

    Prudhvi Sagar

  • Hm. Data sheet (SLASE78c) section 6.11.3 says "Edge-selectable interrupt,[...] is available for P1.0 to P1.3, P2.0, P2.1, P2.6, and P2.7." It suggests something like that in sec 1.1 and 1.4, but it enumerates them here.

    Seems like they could have been a little louder about it.

    [Edit: Hit Post too fast.]

**Attention** This is a public forum