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.

RTOS: msp432 always in notifyFxn()

Tool/software: TI-RTOS

Hi

    I am using Power_registerNotify() function with PowerMSP432_ENTERING_SLEEP event type. Like below:

#########

Power_registerNotify(&notifyObj,PowerMSP432_ENTERING_SLEEP,(Power_NotifyFxn) notifyFxn, 0x1);

unsigned int notifyFxn(unsigned int eventType, unsigned int eventArg, unsigned int clientArg)
{
    GPIO_toggle(Board_GPIO_LED3);
    return (Power_NOTIFYDONE);
}

#########

    I found it strange that mcu always enter the notifyFxn(), although I do nothing about pcm. And I think mcu is in active mode.

    Then I try to call PCM_getPowerMode() and PCM_getPowerState() to check the current state. I step into the function and get message below:

Can't find a source file at "/vagrant/build/driverlib/pcm.c"
Locate the file or edit the source lookup path to include its location.

I am quite sure that I have included the lib file, but the pcm.c is located in "simplelink_msp432_sdk_1_30_00_40\source\ti\devices\msp432p4xx\driverlib\pcm.c" not  "/vagrant/build/driverlib/pcm.c" .

So my question is:

1、How can I trace into  the api function “PCM_getPowerMode()” ?

2、Why does notifyFxn() always be called?

For the second question, I doubt  if the sleep() api , which call Task_sleep() will  do something to pcm.

So the third question is

3、What will the Task_sleep() do to mcu?

My question maybe quite easy. It is more grateful if you can suggest any detail specs about pcm on msp432 especially under rtos environment.

By the way I am using msp432p401r with ccs7. 

Best regards.

  • The libraries are built at TI so the path in the library reflects this. You can navigate to the simplelink directory in CCS and open that one when prompted. However, CCS 7.1 is required for the 1.30 versions of the SimpleLink SDK. 7.1 is better at locating the source files.

    I expect the device is changing power modes so it is calling your callback.

    The Task_sleep() causes that task to block until the time in the API expires. Other task of the same or lower priority can run when a Task_sleep call is made.

    Todd
  • Hi Todd,
    Than you for your reply.
    I try to add notifyFxn() in the empty example Ti provided like below:

    ######################

    #include <unistd.h>
    #include <stdint.h>
    #include <stddef.h>

    /* Driver Header files */
    #include <ti/drivers/GPIO.h>

    /* Board Header file */
    #include "Board.h"

    #include <ti/drivers/power/PowerMSP432.h>
    Power_NotifyObj notifyObj;

    unsigned int notifyFxn(unsigned int eventType, unsigned int eventArg, unsigned int clientArg)
    {
    GPIO_toggle(Board_GPIO_LED0);
    return (Power_NOTIFYDONE);
    }

    /*
    * ======== mainThread ========
    */
    void *mainThread(void *arg0)
    {
    uint32_t time = 1;
    GPIO_init();
    GPIO_write(Board_GPIO_LED1, Board_GPIO_LED_ON);
    Power_registerNotify(&notifyObj,
    PowerMSP432_ENTERING_SLEEP,
    (Power_NotifyFxn) notifyFxn, 0x1);

    while (1) {
    sleep(time);
    }
    }
    ##################################

    The phenomenon is that notifyFxn() is always called and LED1 look brighter than LED0.
    Then I delete the code "sleep(time);". The function notifyFxn() is no longer executed and LED0 is off.

    This is the reason why I doubt if the sleep() will do something to pcm, except system schedule.

    I meet problem on power control on msp432 with tirtos. Is there any detail specs about pcm on msp432 especially under rtos environment?
  • With the sleep removed (but I'm assuming the while(1) is still there), this task runs forever, which does not allow the device to go into a lower power mode since Idle never runs.

    Todd
  • Todd
    I know what you say. Since Idle never runs, notifyFxn() will never be called. By compare the two phenomenon, the only difference is sleep() function. Is that mean sleep() will lead MCU into idle state which really influences power control? In other words, sleep() not only have system schedule function, but also lead MCU into low power mode.
    If my guess is right, what level(lpm0 lpm3...) will the MCU enter using sleep()? On the contrary, if sleep() will not change power mode, how to explain the example I given above?
  • Calling sleep in a task causes that task to block (until the timeout expires). If there is nothing else in the system running, Idle is allowed to run and then you can go into lower power modes. The specific level depends on what else is going on (e.g. UART is open, the next tick is less than x microseconds away, etc.).

    Todd
  • Todd
    Thank you for your reply. I'm not sure whether my understanding is correct. When MCU is in idle state it can go into lpm, and the lpm level is depend on low power strategy that configured in rtos.

    Where can I get related document about this?
  • Jufeng han said:
    Thank you for your reply. I'm not sure whether my understanding is correct. When MCU is in idle state it can go into lpm, and the lpm level is depend on low power strategy that configured in rtos.

    Basically.

    There is a Power Management User Guide in the SimpleLink SDK. You can open the docs\Documentation_Overview.html page and find the link.

    Todd

  • Thank you I will find it.