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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,565 次查看
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 项奖励
回复
1 解答
1,537 次查看
APU
Contributor II

Dear NXP,

 

I realized my mistake.

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

APU_1-1646631934421.png

 

 

在原帖中查看解决方案

标记 (1)
0 项奖励
回复
1 回复
1,538 次查看
APU
Contributor II

Dear NXP,

 

I realized my mistake.

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

APU_1-1646631934421.png

 

 

标记 (1)
0 项奖励
回复