S32K118 power mode switch unsuccessfully, system status unknown

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

S32K118 power mode switch unsuccessfully, system status unknown

Jump to solution
1,239 Views
APU
Contributor II

Dear NXP,

I tried to implement the example "power_mode_swtich_s32k118" to my FreeRTOS project.

The plan is to use a GPIO pin detecting falling edge and rising edge to switch power mode between RUN and VLPS.

When I comment out the functions "POWER_SYS_SetMode(VLPS, POWER_MANAGER_POLICY_AGREEMENT)" and "POWER_SYS_SetMode(RUN, POWER_MANAGER_POLICY_AGREEMENT)", everything works well when GPIO detects interrupt. Log messages I make are printed as expected within GPIO_ISRHandler, Tasks also output log messages periodically.

However if I uncomment the two functions above, system will hang when I toggle the GPIO pin. More specifically saying, I didn't know the status of the system because my log messages stopped right before POWER_SYS_SetMode(...) and never resume again.

Meantime I attached a galvanometer on my power supplier to observe the change of current consumption. Result showed that the current had no difference when I toggle the GPIO pin to enter VLPS mode, so I assume mode did not set successfully and hang for some reasons.

 

I have few doubts in my mind hope you can clarify them for me:

1. I use vTaskSuspendAll() to suspend all the running tasks before set mode to VLPS, and use xTaskResumeAll() after set mode to RUN. Those tasks have data communication(xQueueReceive() and xQueueSend()) within them, perhaps this isn't the right way to stop multiple tasks?

2. The example is a non-RTOS project, in order to implement it to a RTOS project maybe some adjustments must be made?

3. Is it legal to call POWER_SYS_SetMode(...) within a ISRHandler? 

3. Are there other peripherals(e.g. PWM, I2C, UART...) I need to disable manually before entering VLPS mode? Even I am using Processor Expert.

 

Best regards

0 Kudos
Reply
1 Solution
1,219 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @APU,

This is a rather complex issue.

 

I understand that the debugger is disconnect and you use only the serial communication to monitor the MCU.

However, if you call the POWER_SYS_SetMode(VLPS, ...) function, it disabled all the system clock except for SIRC (if enabled in VLPS) and LPO.

And you need to call POWER_SYS_SetMode(RUN, ...) to resume it.

I would recommend monitoring the system clock (for example the BUS_CLK) on a CLKOUT pin.

If the clock is not gated off, the transition to VLPS failed, you can attach the debugger (without reset) and check where it is stuck.

 

If you call the WFI (wait for interrupt) instruction in an ISR, you will need a higher priority interrupt to wake it up (preempt the interrupt).

Typically, the MCU is put into low-power mode in the idle task (idle hook).

https://www.freertos.org/RTOS-idle-task.html

 

If you use an SDK driver in a FreeRTOS application, you should initialize the driver within the task where you call the driver's functions.

 

The FlexCAN should be dissabled before the MCU enters VLPS.

 

Regards,

Daniel

 

 

View solution in original post

0 Kudos
Reply
2 Replies
1,220 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @APU,

This is a rather complex issue.

 

I understand that the debugger is disconnect and you use only the serial communication to monitor the MCU.

However, if you call the POWER_SYS_SetMode(VLPS, ...) function, it disabled all the system clock except for SIRC (if enabled in VLPS) and LPO.

And you need to call POWER_SYS_SetMode(RUN, ...) to resume it.

I would recommend monitoring the system clock (for example the BUS_CLK) on a CLKOUT pin.

If the clock is not gated off, the transition to VLPS failed, you can attach the debugger (without reset) and check where it is stuck.

 

If you call the WFI (wait for interrupt) instruction in an ISR, you will need a higher priority interrupt to wake it up (preempt the interrupt).

Typically, the MCU is put into low-power mode in the idle task (idle hook).

https://www.freertos.org/RTOS-idle-task.html

 

If you use an SDK driver in a FreeRTOS application, you should initialize the driver within the task where you call the driver's functions.

 

The FlexCAN should be dissabled before the MCU enters VLPS.

 

Regards,

Daniel

 

 

0 Kudos
Reply
1,187 Views
APU
Contributor II

Dear NXP,

Thank you for your reply.

Although my problem hasn't been solved, your suggestions still gave me plenty of guides.

 

The following is my another post of current progress, please kindly check and reply if you pleased.

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

 

Best regards,

APU

0 Kudos
Reply