Part Number: MSP430FR2310
I'm having an odd issue; my port 1 interrupts will not clear. From the moment I call _enable_interrupt() I execute no more code other than in an interrupt handler - if I place a breakpoint on the statement following this I never hit it, while inserting a breakpoint at the entry and exit of my interrupt handler confirms that I'm repeatedly hitting it. Minimal example exhibiting this below:
#include <msp430.h> #pragma vector=PORT1_VECTOR__interrupt void Port_1(void){ P1IFG = 0; return;}int main(void){ WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer P1DIR &= ~BIT5; // input P1OUT |= BIT5; // pull up P1REN |= BIT5; // enable pull P1IES |= BIT5; // high -> low transition P1IFG &= ~BIT5; //clear interrupt flag P1IE |= BIT5; // enable interrupts __enable_interrupt(); while(1){ } return 0;}
In the debugger, I can see that P1IE is set to 0x20 (correct) but P1IFG registers 0x30 at the start of the interrupt. This is wrong; it suggests that pin 4 is also triggering an interrupt. Equally, writing P1IFG=0 in my interrupt handler doesn't seem to change the value of P1IFG when the interrupt handler returns.
This isn't peculiar to this particular pin, I see the same behaviour with other pins I've tested triggering interrupts from (and indeed combinations of pins). I wondered whether the particular chips was bad, so built up a few other boards and all behaved the same. I have had this working before (indeed, the other day I had one working perfectly for a few minutes before it started misbehaving again). Have I fallen foul of an obscure hardware bug, or am I missing something?
I know there are other ways to clear interrupt flags (e.g. using P1IV), but these have no more success.