Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22211

MSP430FR2311: P2 IO IRQ not firing

$
0
0

Part Number:MSP430FR2311

Hello Everyone,

I am trying to write a simple edge detector using P2.2. The pin is connected to a by pass cap of another circuit t hat gets powered separately from the processor running this code. 

When I run the code and write to the P2IFG BIT2 in my main code I can force the IRS to run but when I power up the external circuit it does not run. I can see (via the debugger) the P2 bit2 change from low to high so why doesnt the ISR fire? 

Here is the initialization code..

void nfc_wakeup_init(void)
{
    // P2.2 is 2x input from nfc chip
    // should transition from zero to approx 3V when NFC powered
    // make input
    // make primary funciton GPIO
    // setup interrupt
    detected = false;
    P2SEL0  &= ~BIT2;
     P2SEL1  &= ~BIT2;
    P2DIR   &= ~BIT2;       // Set P2.2 to input direction
    //P2OUT   &= ~BIT2;       // set pull down
    //P2REN   |=  BIT2;       // P2.2 pull-up register enable
    P2IES   &= ~BIT2;       // P2.2 set from low to high transition
    P2IFG   &= ~BIT2;       // P2.2 IFG cleared
    P2IE    |=  BIT2;       // P2.2 interrupt enabled

}

here is the interrupt code

#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
{
    //check IES bit
    if (0 == (P2IES | BIT2)) {  // low to high means nfc powered up
        P2IES |= BIT2 ;         // now watch for  high to low
        detected = true ;
        // start timer to poll for IAA
    }
    else {                     // high to low means nfc powered down
        P2IES &= ~BIT2;       //now watch for low to high
        detected = false;
        // stop timr isr
    }
    P2IFG &= ~BIT2;           // Clear P2.2 IFG
}

The main code just loops waiting for the detected var to change..

Any ideas would be  helpful, thanks for talking the time to look over my code..

Steve


Viewing all articles
Browse latest Browse all 22211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>