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.

PowerSleepPrep function on MSP430

Other Parts Discussed in Thread: SYSBIOS

Hello all

 

I am trying to implement the PowerSleepPrep function that can be used as part of the SYSBIOS power module for the MSP430.

As indicated, I added the following line to the SYSBIOS script:

Power.sleepPrepFunction = "&Power_sleepPrep";

where Power_SleepPrep() is a custom function that I defined

But my function does not seem to be called ever, even though the CPU is correctly idled.

When I look at the code of the          ti_sysbios_family_msp430_Power_idleCPU__E function I do not see any call to my function.

Is that feature of the power module implemented?

If so how can I make sure that my function is linked in the executable code?

  • Hi,

    i am moving this thread to the SYS/BIOS forum in order to enable you getting support from the SYS/BIOS team directly.

  • Bruno,

    This function is called only when the application explicitly calls the Power_sleepCPU() API to invoke LPM 4.5 to shutdown the device.  In this case a device reset is needed to recover.

    /*
     *  ======== Power_sleepCPU ========
     */
    Void Power_sleepCPU(Power_SleepMode sleepMode)
    {
        if (sleepMode == Power_Sleep_LPM4_5) {

            /* call to configured function to prepare device I/Os for shutdown */
            Power_sleepPrepFunction();

            /* do the transition to LPM4.5 ... */
            asm(" MOV.W #0xA510, &0x120");        /* PMMPW | PMMREGOFF -> PMMCTL0 */
            _bis_SR_register(0xF0);   /* CPUOFF | OSCOFF | SCG0 | SCG1 -> SR */
        }
    }

    This function is not called for routine idling of the device by the Power_idleCPU() function.  In that case, an enabled interrupt will wake the CPU to resume operation.

    The source for both these functions can be found in the file src/ti/sysbios/family/msp430/Power.c in the SYS/BIOS install.

    Scott

  • Ah, I understand. That makes sense now!

    Thanks Scott

    Having that kind of hook would be a good improvement to consider in a future release. There may be preparation steps to complete before entering an LPM mode (for instance shutting down an external function).

    Another feature that would be nice (although not imperative) is an API function to return the current value of the Idle mode.

    In the mean time I think I will implement a custom Power function in the idle loop, the same way the Power module is implemented.

    Regards

    Bruno