Part Number:MSP430G2553
Hi All,
I have some code which has high sleep current during LPM4. I have made a branch that ripped everything out except a) setting all pin assignments, b) setting some clock, ADC, UART settings, c) going to LPM4 sleep So basically, system turns on, does some housekeeping and goes to sleep.
The high sleep current in LPM4 -may- be hardware-related but I need to ensure that the software is bulletproof before suggesting that.
Here is a code snippet. All the pin assignments (P1DIR, P1REN,P1OUT, etc.) are set to an output high or low, no resistor enable. All the port select settings (PSEL, P2SEL, P3SEL, etc.) are set to 0, so the port are all general purpose I/O.
///////////////////////////////////// code snippet ////////////////////////////////////
DCOCTL = 0; // Select lowest DCOx and MODx settings
BCSCTL1 = CALBC1_1MHZ; // Set DCO
DCOCTL = CALDCO_1MHZ;
// disable UART
UCA0CTL1 |= UCSWRST; // **DEACTIVATE USCI state machine**
IE2 = 0; // disable all USCI_A0 interrupts
// disable ADC conversion
ADC10CTL0 &= ~ADC10IE;
ADC10CTL0 &= ~ADC10ON;
ADC10CTL0 &= ~REFON;
ADC10CTL0 &= ~ADC10SHT_2;
ADC10CTL0 &= ~SREF_1;
// stop watchdog timer
WDTCTL = WDTPW + WDTHOLD; // Stop WDT - also resets clock to SMCLK
__bis_SR_register(LPM4_bits); // Enter LPM4 - NO global interrupts enabled
///////////////////////////////////// end of code snippet ////////////////////////////////////
Is there anything wrong with doing the above? Anything else I should do before going to LPM4?
My understanding is that LPM4 basically disables everything - clocks, etc. so really those settings shouldn't matter. Does anyone have any code references for entering LPM4?
Thank you!