Part Number: MSP430FR5972
Hi,
When I am running example code separate it is working properly, but when I put the same code in my project after few(30-40 sec) sec automatically comes out from LPM4.5.
I am sending my code below. Please suggest me what to do
void LPM4_5(void)
{
uart_putstring("\r\n> >>>>>>In LPM 4.5 Mode<<<<<<<\r\n ");
// Configure GPIO
P1OUT &= ~BIT6;
P1DIR = BIT6;
// Determine whether we are coming out of an LPMx.5 or a regular RESET.
if (SYSRSTIV == SYSRSTIV_LPM5WU) {
PJSEL0 = BIT4 | BIT5; // For XT1
// Clock System Setup
CSCTL0_H = CSKEY >> 8; // Unlock CS registers
CSCTL1 = DCOFSEL_0; // Set DCO to 1MHz
CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK;
CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // Set all dividers
CSCTL4 &= ~LFXTOFF;
PM5CTL0 &= ~LOCKLPM5;
do {
CSCTL5 &= ~LFXTOFFG; // Clear XT1 fault flag
SFRIFG1 &= ~OFIFG;
} while (SFRIFG1 & OFIFG); // Test oscillator fault flag
}
else {
// Configure P1.6 as an Interrupt
P1OUT &= ~BIT6; // Pull-down resistor on P1.6
P1REN |= BIT6; // Select pull-down mode for P1.6
P1DIR = 0xFF ^ BIT6; // Set all but P1.1 to output direction
P1IES &= ~BIT6; // P1.6 Lo/Hi edge
P1IFG = 0; // Clear all P1 interrupt flags
P1IE |= BIT6; // P1.6 interrupt enabled
// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
PMMCTL0_H = PMMPW_H; // Open PMM Registers for write
PMMCTL0_L |= PMMREGOFF; // and set PMMREGOFF
PMMCTL0_H = 0; // Lock PMM Registers
// Enter LPM4 Note that this operation does not return. The LPM4.5
// will exit through a RESET event, resulting in a re-start
// of the code.
__bis_SR_register(LPM4_bits);
while (1); // MCU will wait here until the interrupt receive on P1.6
}
}