Hazards of sleep mode

anonymous wrote on Friday, March 12, 2010:

Hi,
I wrote an an idle hook shown here

void vApplicationIdleHook( void )
{
    asm("nop");
    P1OUT &= ~0x01;//go to sleep lights off!
    LPM3;// LPM Mode -  remove to make debug a little easier...
    asm("nop");
}

That should cause the LED to turn off, and MSP430 to go to sleep when there is nothing to do. I turn the LED on during some tasks.

I also made sure to modify the sleep mode bit in the SR upon exit of any interrupt that could possibly wake the MCU (with the exception of the scheduler tick isr in port. The macro in iar is

__bic_SR_register_on_exit(LPM3_bits);   // Exit Interrupt as active CPU 

However, it seems as though putting the MCU to sleep causes some irregular behavior. The led stays on always, although when i scope it, it will turn off for a couple instructions cycles when ever i wake the mcu via one of the interrupts (UART).
If I comment out the LPM3 instruction, things go as planned. THe led stays off for most of the time and only comes on when a task is running.

I am using a MSP4f305438

Any ideas?

rtel wrote on Saturday, March 13, 2010:

Maybe not much help - but I seem to recall adding a wake from low power mode into the MPS430 tick handler code some time back (search http://www.freertos.org/History.txt to find the version this first went into).  I can’t remember which low power mode was used, but I know not all were suitable.

Regards.

anonymous wrote on Sunday, March 14, 2010:

Hey Richard, that thought occurred to me yesterday as well. I am using version 5.4 right now. I will give that a try and post my results when i have something.

Thanks,
mike