Using POWER_SYS_SetMode() to switch to VLPS but PMSTAT doesn't change?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using POWER_SYS_SetMode() to switch to VLPS but PMSTAT doesn't change?

Jump to solution
1,569 Views
APU
Contributor II

Dear NXP,

 

I am using S32K118 with RTM 3.0.0 SDK and try to implement RUN <-> VLPS power mode switch.

Behavior is done within a RTOS task, snippet of code as follow:

#define RUN (0U)

#define VLPS (1U)

#define VLPR (2U)

void CustomizedTask(void *pvParameters)

{

    (void)pvParameters;

    uint32_t get_addr = 0;

 

    for (;;) {

        if (condition_match_1) {

                POWER_SYS_SetMode(RUN, POWER_MANAGER_POLICY_AGREEMENT);

        } else if (condition_match_2) {

                POWER_SYS_SetMode(VLPS, POWER_MANAGER_POLICY_AGREEMENT);

        } else if (condition_match_3) {

                POWER_SYS_SetMode(VLPR, POWER_MANAGER_POLICY_AGREEMENT);

        } else {

                /* Do nothing */

        }

        vTaskDelay(2000);

        get_addr = *((uint32_t*)0x4007E014);

        if (get_addr == 1) {

                /* Show value */

        } else if (get_addr == 4) {

                /* Show value */

        } else if (get_addr == 16) {

                /* Show value */

        } else {

                /* Show log */

        }

    }

    vTaskDelete(NULL);

}

 

In order to verify whether the power mode has been switched, I access the memory address 0x4007E014, which is supposed to store the value of SMC->PMSTAT

reg.png

 

However, I discovered only when I switched between RUN <-> VLPR, the value changed. RUN mode returned value 1, VLPR returned value 4, as described in `SMC_GetPowerModeStatus()` in power_smc_hw_access.h.

When I tried to switch to VLPS, the value always remained 1. This makes me wonder maybe the mode didn't change as expected, yet the function `POWER_SYS_SetMode()` returned "STATUS_SUCCESS".

Is the way I verify is wrong? Or there is something interfering during the transition?

Another question is, why function `POWER_SYS_GetCurrentMode()` only handles cases such as "STAT_RUN" and "STAT_VLPR", whilst other cases are regarded as "default"?

 

Best regards,

APU

0 Kudos
Reply
1 Solution
1,541 Views
APU
Contributor II

Dear NXP,

 

I realized my mistake.

SMC->PMSTAT cannot reveal VLPS status when debug is enabled.

APU_1-1646631934421.png

 

 

View solution in original post

Tags (1)
0 Kudos
Reply
1 Reply
1,542 Views
APU
Contributor II

Dear NXP,

 

I realized my mistake.

SMC->PMSTAT cannot reveal VLPS status when debug is enabled.

APU_1-1646631934421.png

 

 

Tags (1)
0 Kudos
Reply