This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problem Wake-up in LPM4.5 MSP430F5438A

I try to implement the LMP4.5 sleeping mode, but I have some difficult to wake-up my device.

My source code is to go to sleep:

watchdog_stop();
P1DIR=P2DIR=P3DIR=P4DIR=P5DIR=P6DIR=P7DIR=P8DIR=P9DIR=P10DIR=P11DIR=PJDIR=0;
P1OUT=P2OUT=P3OUT=P4OUT=P5OUT=P6OUT=P7OUT=P8OUT=P9OUT=P10OUT=P11OUT=PJOUT=0;
P1REN=P2REN=P3REN=P4REN=P5REN=P6REN=P7REN=P8REN=P9REN=P10REN=P11REN=PJREN=0xff;
TA0CTL=0;TA1CTL=0;TB0CTL=0;	// clear all timer

// declare P1.2 as interrupt pin to wake up
P1DIR&=~0x04;P1OUT=0x04;
P1REN|=0x04;
P1IFG=0;
P1IE|=0x04;
// Disable SVS
PMMCTL0_H = PMMPW_H;                  // PMM Password
//this turns off the PMM to allow for LPM4.5
PMMCTL0_L |= PMMREGOFF;
// set Flag to enter LPM4.5 with LPM4 request
_BIS_SR(GIE | LPM4_bits ); // LPM4.5 sleep

and to wake-up:

main(int argc, char **argv)
{
WDTCTL = WDTPW + WDTHOLD;
short wake;
unsigned int i = 0x1000;
switch (SYSRSTIV){	// LPM4.5 wake up
case 8:
	while(i--);
	wake = 1;
	while (wake);// SW trap for debugger..
	PMMCTL0_H = PMMPW_H;                      // open PMM
	// 	 PM5CTL0 &= ~LOCKIO;
	PMMCTL0_H = 0x00;                         // close PMM
	// Clear pending interrupts
	P2IFG = 0;
	while (wake);
break;
}

But it seems my device can't wake up even after a toggling on P1.2 or a reset. In this mode, I can't debug anymore the device. 

Other question:

I follow without success the slaa424.pdf documentation to debug the LPM4.5 . It seems there is a code source sample but I don't have it. Where I can find it?

best regards,

Mathieu

  • When LPM4.5 is entered, the CPU is shut off. Of course you cannot debug anymore as this will also shut down the JTAG interface. Except for the port pins, the MSP is dead then. (the CPU core is unpowered)
    Also, see EEM21 erratum. An attached debugger may wake the device from LPM4.5 or crash ist.

     After reset, you read SYSRSTIV. However, this register will report all reset causes since power-on, ordered by priority. It is possible that multiple resets have happened before this point is reached. So you should wrap the switch statement by a while(1) and exit the while for case 0. Also, I dimly remember that some compiler startup code reads this register too, removing its content.

**Attention** This is a public forum