Part Number: MSP430FR6989
Hi,
When I start the below code, and pull low one of the pins 3.0 or 3.1 (or 3.2), the program does not go into the Interrupt Subroutine although (when looking at the registers with the debugger of code composer) the P3IFG are set for these particular pins (it goes all 1 to be honest, so when pulling 1 of the pins Low -> P3IFG=0xFF). I have no idea why this happens.
Anyone any clue?
#include <msp430.h>
#include "ram_module.h"
/**
* main.c
*/
int main(void)
{
PM5CTL0 &= ~LOCKLPM5;
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
//declare all the pins
//Control Ports
P3DIR |= 0b00000000; // third port is CSN port, this is READ ONLY
P3IE |= 0b00000111;
P3IES |= 0x03 ; // from high to low on the first two pins
P3IFG &= ~0x03 ; // clear the flags
//Address Ports (Port 1: 5, Port 8: 4, Port 9: 7), READ ONLY
P1DIR |= 0b00000000;
P8DIR |= 0b00000000;
P9DIR |= 0b00000000;
__no_operation();
__no_operation();
//Data Port
P2DIR |= 0x00;
__no_operation();
__no_operation();
return 0;
}
/*
* Each port has only one vector and only one ISR can be written.
* To distinguish between different interrupt sources for one interrupt vector,
* in this case the different port pins, you'll have to check the IFG bits inside the ISR.
*/
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=PORT3_VECTOR
__interrupt void Port_3(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(PORT3_VECTOR))) Port_3 (void)
#else
#error Compiler not supported!
#endif
{
uint16_t volatile * const address = (uint16_t *) getAddress();
//uint16_t* data = NULL;
//data = address;
if(P3IFG&BIT0){
//P1OUT^=BIT0; data is written to this MPC
*address = P2IN;
}
if(P3IFG&BIT1){ //could be an else
//P1OUT^=BIT1;data is read from the MPC
P2DIR &= 0xFF; // put in write mode
P2OUT = *address;
//address = address + 8;
//P2OUT = *address;
__no_operation();
P2DIR &= 0x00; // put in read mode
}
P3IFG=0; // set all flags to 0
}
With kind regards,
Yannick