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