S32K118 VLPS Mode Current Consumption Issue with FreeRTOS

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

S32K118 VLPS Mode Current Consumption Issue with FreeRTOS

687 Views
Arunpk
Contributor II

Issue Summary:

  • When entering VLPS before starting the scheduler, the MCU enters sleep as expected and current drops to ~27µA.
  • When entering VLPS inside a FreeRTOS task, POWER_SYS_SetMode() returns STATUS_SUCCESS, but the MCU does not enter VLPS properly, and current remains ~1.5mA.

 

Case 1: Before Scheduler (Working) :

power_status = POWER_SYS_SetMode(VLPS, POWER_MANAGER_POLICY_AGREEMENT);

if (power_status == STATUS_SUCCESS)

__asm volatile("nop");

 

  • Called before vTaskStartScheduler().
  • MCU enters VLPS successfully.
  • Current consumption: ~27µA.
  • Debugger halts at nop and only proceeds on interrupt (expected behavior).

 

Case 2: Inside Task (Not Working) :

INT_SYS_DisableIRQ(PORT_IRQn);

INT_SYS_ClearPending(PORT_IRQn);

peripheral_deinit();

INT_SYS_EnableIRQ(PORT_IRQn);

 

vPortEnterCritical();

sts = POWER_SYS_SetMode(VLPS, POWER_MANAGER_POLICY_AGREEMENT);

vPortExitCritical();

 

  • Called inside a FreeRTOS task after suspending other tasks and deinitializing peripherals.
  • POWER_SYS_SetMode() returns STATUS_SUCCESS .
  • MCU does not appear to enter VLPS.
  • Current consumption: ~1.5mA (higher than expected).
  • With debugger attached, code proceeds beyond POWER_SYS_SetMode() without interrupt (unexpected).

 

Case 3: Inside Task with SysTick Disabled (Partially Working) :

INT_SYS_DisableIRQ(PORT_IRQn);

INT_SYS_ClearPending(PORT_IRQn);

peripheral_deinit();

INT_SYS_EnableIRQ(PORT_IRQn);

 

vPortEnterCritical();

S32_SysTick->CSR &= ~(SYSTICK_CSR_ENABLE_MASK); // Disable SysTick

sts = POWER_SYS_SetMode(VLPS, POWER_MANAGER_POLICY_AGREEMENT);

S32_SysTick->CSR |= SYSTICK_CSR_ENABLE_MASK; // Re-enable SysTick

vPortExitCritical();

 

  • Disabling SysTick timer before VLPS seems to help.
  • Debugger halts until interrupt (expected).
  • However, current consumption is still ~1.5mA (not the expected ~27µA).

 

My Setup:

  • MCU: S32K118
  • SDK : (s32sdk_s32k1xx_rtm_402)
  • RTOS: FreeRTOS(1.0.0)
  • Peripherals are deinitialized and unnecessary tasks are suspended before entering VLPS.
  • Behavior is same with or without debugger.

 

Questions:

  1. Why does POWER_SYS_SetMode() not put the MCU into VLPS properly when called from a FreeRTOS task?
  2. Are there additional steps required for VLPS under FreeRTOS (e.g., disabling SysTick or configuring interrupt priorities)?
  3. How can I achieve the same low current (~27µA) when entering VLPS from within a task?
Tags (1)
0 Kudos
Reply
1 Reply

655 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

The Systick is not available in VLPS since the HCLK (CORE_CLK) is gated-off during Deep Sleep.
For good practice, the user should disable it prior to any VLP entry sequence. 

I am not familiar with FreeRTOS, did you choose Systick for the scheduler?

I’m sorry to say that we currently do not have resources to support FreeRTOS issues. FreeRTOS is open source and the user is expected to use rather generic FreeRTOS support if needed:
https://www.freertos.org/RTOS-contact-and-support.html
We apologize for any inconvenience.

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "ACCEPT AS SOLUTION" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

0 Kudos
Reply