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