Comparing WFI-only vs VLSR transition approaches

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

Comparing WFI-only vs VLSR transition approaches

Jump to solution
856 Views
malove
Contributor IV

 

I'm working on a power-optimized bare-metal application using the S32K311.
Our system runs a periodic task every 10ms, and remains idle the rest of the time.

Currently, I'm evaluating two different strategies for reducing power consumption during idle periods:

 

Option 1 – WFI only:
Let the MCU stay in RUN mode, and simply use __WFI() at the end of the main loop when there's nothing to do:

 

 
while (1) {
  if (task_ready) {
    DoSomething();
  }

  __WFI(); // Sleep during idle
}​

This approach keeps the PLL and high-speed clocks active, but gates the CPU core during idle time.

 

Option 2 – Dynamic VLSR/Run mode switching:
Switch the MCU to VLSR mode (FIRC 3MHz) when idle, and back to RUN mode (PLL) when a task is ready:

 

while (1) {
  if (task_ready) {
    ChangeToRunMode();
    DoSomething();
  } else {
    ChangeToVLSRMode();
  }
}

This reduces the clock domain frequency during idle, but introduces frequent MC_ME and clock domain switching.

 

My question:

  • Is it practical and safe to switch between RUN and VLSR mode every few milliseconds?

  • Could the overhead of frequent mode transitions outweigh the power saving benefit?

  • Would NXP recommend one approach over the other for 10ms-periodic task scheduling?

My primary goal is to achieve maximum power saving without causing system instability or excessive latency.

I would really appreciate your technical opinion on this.

Thanks in advance!

Tags (2)
0 Kudos
Reply
1 Solution
838 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @malove,

I can see you've also posted about a similar issue in this post: Inquiry about WFI + PIT Scheduler Use in Bare-metal on S32K311 - NXP Community. If this answer applies to that post as well, please let me know so I can close it instead.

Actually, Option 2 is a recommended implementation if you need to cyclically monitor anything while trying to save power consumption. You can see in the S32K3xx Data Sheet, in chapter 6.9 (Cyclic wake-up current), a cyclic wake-up current example is presented.

It shows data for an application that periodically (every 40ms) alternates between RUN mode, for approximately 200μs to scan several GPIO inputs (51 GPIOS), and spends the rest of the time in STANDBY mode.

There are some recommendations in the S32K3 Low Power Management AN and demos document. One common issue for high current consumption is frequency of wake-up events is too high, which means that the MCU spends more time in Run or VLSR mode than in a low-power mode. The transition time from low-power mode to Run mode is quick. If the MCU only spends 9 ms in run and 1 ms in a low-power mode, the average current of the system will be considerably higher than if the MCU was running only 1 ms every 1 second. 

  • Is it practical and safe to switch between RUN and VLSR mode every few milliseconds?

Yes.

  • Could the overhead of frequent mode transitions outweigh the power saving benefit?

This is application dependent. As current consumption depends on various factors such as which modules are enabled, what frequency is feeding Core and other peripherals, temperature conditions, and so on. You can use the Power Estimation Tool (PET). Keep in mind the data provided in the tool are estimations only based on ideal conditions and should be used as reference.

  • Would NXP recommend one approach over the other for 10ms-periodic task scheduling?

Not really. You should measure consumption in both cases and evaluate which one is more beneficial for your specific application.

Best regards,
Julián

View solution in original post

4 Replies
839 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @malove,

I can see you've also posted about a similar issue in this post: Inquiry about WFI + PIT Scheduler Use in Bare-metal on S32K311 - NXP Community. If this answer applies to that post as well, please let me know so I can close it instead.

Actually, Option 2 is a recommended implementation if you need to cyclically monitor anything while trying to save power consumption. You can see in the S32K3xx Data Sheet, in chapter 6.9 (Cyclic wake-up current), a cyclic wake-up current example is presented.

It shows data for an application that periodically (every 40ms) alternates between RUN mode, for approximately 200μs to scan several GPIO inputs (51 GPIOS), and spends the rest of the time in STANDBY mode.

There are some recommendations in the S32K3 Low Power Management AN and demos document. One common issue for high current consumption is frequency of wake-up events is too high, which means that the MCU spends more time in Run or VLSR mode than in a low-power mode. The transition time from low-power mode to Run mode is quick. If the MCU only spends 9 ms in run and 1 ms in a low-power mode, the average current of the system will be considerably higher than if the MCU was running only 1 ms every 1 second. 

  • Is it practical and safe to switch between RUN and VLSR mode every few milliseconds?

Yes.

  • Could the overhead of frequent mode transitions outweigh the power saving benefit?

This is application dependent. As current consumption depends on various factors such as which modules are enabled, what frequency is feeding Core and other peripherals, temperature conditions, and so on. You can use the Power Estimation Tool (PET). Keep in mind the data provided in the tool are estimations only based on ideal conditions and should be used as reference.

  • Would NXP recommend one approach over the other for 10ms-periodic task scheduling?

Not really. You should measure consumption in both cases and evaluate which one is more beneficial for your specific application.

Best regards,
Julián

806 Views
malove
Contributor IV

Hello,

I’d like to ask if there is any RTD support for transitioning between RUN mode and STANDBY mode.

If such support exists, would it be possible to receive an example project or configuration demonstrating how to properly implement this transition using PIT?

Thank you in advance for your help!

0 Kudos
Reply
787 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @malove,

You can look into the previous thread I shared, which shows various examples with RTD in low-level and high-level drivers. There is also the updated thread for RTD 4.0.0 & 5.0.0, since the original post is based in S32DS v3.4 + RTD 2.0.0.

Specifically, you can look at the RTI_Cycl_Wkup example, which shows the usage of Normal and Fast cycle wake up by RTI Timeout, and you can change the standby time by changing the value of PIT_RTI_TIME in Wkup.h header.

Best regards,
Julián

821 Views
malove
Contributor IV

Hello @Julián_AragónM .

 

Sorry for posting a duplicate thread. I must have accidentally submitted it twice.
Please feel free to remove the previous one.

 

Thank you as always for your kind and helpful respo