Hello
I have a question regarding entering and exiting the LPM4.5 on MSP430F5419A.
I am attempting to enter LPM4.5 by the help of the following function:
void enter_LPM4_5(void)
{
PMMCTL0_H = PMMPW_H; // open PMM
PMMCTL0_L |= PMMREGOFF; // set Flag to enter LPM4.5 with LPM4 request
__bis_SR_register(LPM4_bits+ GIE);
__no_operation();
}
I put a break point at the beginning of the function and as described in SLAA424 set the debugger to "Release JTAG on Go" (using IAR 5.20.1)
Then I press run....The interface that shall wake me up from LPM is P2.1, and the iinterrupt on it is enabled...
Upon wakeup from LPM I see that the PMMREGOFF is set, but I am not running from the main(), but I run from interrupt handler for port 2.
Also I have noticed that the LOCKLP5 bit is not set. The system registers and internal RAM variables preserve their values so I assume that I am not entering an LPM4.5 but LPM4.
The question is what I am missing and why not entering LPM4.5?
The port2 handle is as follows:
case 4:
P2IFG &= (~BIT1);
P2IE &= (~BIT1);
LPM4_5_WakeUP();
__bic_SR_register_on_exit(LPM4_bits);
__no_operation(); // For debugger
break;
where the wakeup function is:
void LPM4_5_WakeUP(void)
{
volatile short wake;
volatile unsigned int i = 0x1000;
while(i--);
wake = 1;
while (wake);// SW trap for debugger..
PMMCTL0_H = PMMPW_H; // open PMM
PM5CTL0 &= ~LOCKIO; // Clear LOCKIO and enable ports
PMMCTL0_H = 0x00; // close PMM
// Clear pending interrupts
P2IFG = 0;
while (wake);
}
In general I assumed that I will not wakeup on port interrupt but will start from main() where the code handles the wakeup as follows:
void main(void) { WDTCTL = WDTPW+WDTHOLD; // Stop WDT ////////////////////////////////////////////////////////////////////////////////// P2DIR |= BIT0; // MCLCK P2.0 P2SEL |= BIT0; P2DIR |= BIT6; // ACLCK P2.6 P2SEL |= BIT6; /////////////////////////////////////////////////////////////////////////////////// switch (__even_in_range(SYSRSTIV,SYSRSTIV_PMMKEY)) { case SYSRSTIV_NONE: break; case SYSRSTIV_BOR: break; case SYSRSTIV_RSTNMI: break; case SYSRSTIV_DOBOR: break; case SYSRSTIV_LPM5WU: LPM4_5_WakeUP(); break; case SYSRSTIV_SECYV: break; case SYSRSTIV_SVSL: break; case SYSRSTIV_SVSH: break; case SYSRSTIV_SVML_OVP: break; case SYSRSTIV_SVMH_OVP: break; case SYSRSTIV_DOPOR: break; case SYSRSTIV_WDTTO: break; case SYSRSTIV_WDTKEY: break; case SYSRSTIV_KEYV: break; case SYSRSTIV_PERF: break; case SYSRSTIV_PMMKEY: break; } ... } On general wake up I am rasing the PMM to Vcore Level 3 and the system sourced by XT1 clock of 32768 Hz frequency, and SMCLK is DCOCLK/2, MCLCK is DCOCLK and ACLCK is sourced by XT1 directly (ACLK 32768, MCLCK ~24 MHz, SMCLCK is ~12 MHz). The system uses I2C, UART and SPI interfaces, which are re-configured upon entry into the LPM4.5 to be GPIO's.... Please help. Regards, Igor