One of the most important features of the S32K1xx is the power management controller, that allows the user to minimize the current consumption depending on the running application. The PMC blocks allows user to handle the device power modes and trigger subsystems execution when switching between power modes.
The following table describes the power modes for the S32K14x processor:
|RUN||The MCU can be run at full speed and the internal supply is fully regulated, that is, in run regulation. This mode is also referred to as Normal Run mode.|
|HSRUN||The MCU can be run at a faster frequency compared with RUN mode and the internal supply is fully regulated.|
The core clock is gated off. There are two variants of stop mode - STOP1 and STOP2. In STOP1 system clock as well as bus clocks are gated. In STOP2 bus clocks keep running whereas system clocks are gated.
The core, system, bus, and flash clock maximum frequencies are restricted in this mode.
On-chip voltage regulator is in a low power mode that supplies only enough power to run the chip at a reduced frequency.
The core clock is gated off. System clocks to other masters and bus clocks are gated off after all stop acknowledge signals from supporting peripherals are valid.
Places the chip in a static state with Low Voltage Detect (LVD) operation off. This is the lowest-power mode in which pin interrupts are functional.
The following diagram shows the power mode transitions. Any reset always brings the chip back to the Normal Run state. In run, stop modes active power regulation is enabled. The VLPR modes offer a lower power operating mode than normal modes. VLPR is limited in frequency.
Power mode state transition diagram (S32K1xx Series Reference Manual, Rev. 4, 06/2017 pag.969)
For more information about power modes and please read the AN5425, Power Management for S32K14x.
Another important feature that we provide through the new MDBT release is the possibility of automatically call a subsystem "Before", "After" and "Before and after" switching between the power mode selected in the PMC_Config block. The following example shows a PMC_Config block that changes the running mode to VLPS and calls two callbacks: the first one is called "Before" entering the VLPS mode and the second one is called "After" the ISR Handle is executed. The "Before and after" callback is not required so a terminator was added.
PMC_Config Blocks Callbacks example
For demonstrating the functionality of the power management controller we created an application presented in the following video, that measures the ambient temperature using an NXP S32K144 controller. The example combines some blocks in Model-Based Design Toolbox as FLEXIO, LPTMR and PMC.
The peripherals blocks used for this examples, can be found in MBDT and provides the following features:
- FLEXIO is a highly configurable module providing a wide range of functionality including emulation of a variety of serial communication protocols. The MBDT blocks provides support for the following communication protocols: I2C, UART, SPI.
- LPTMR (low-power timer) can be configured to operate as a time counter with optional prescaler, or as a pulse counter with optional glitch filter, across all power modes, including the low-leakage modes. The MBDT blocks provides support to configure LPTMR as Time Counter mode or Pulse Counter mode and an interrupt handler functionality.
- PMC (power management controller) provides multiple power options allowing users to optimize power consumption for the level of functionality needed. The MBDT blocks provides support for running the S32K144 trough the following power modes: VLPS, VLPR, HSRUN, RUN, STOP1/2 and also it can run some callbacks to be triggered on changing the power mode.
On this example the controller uses I2C emulation via FLEXIO to read the temperature from an I2C sensor and send the value over UART communication, every 10 seconds. While the microcontroller waits for those 10 seconds to pass, it runs in the STOP1 low power mode. To wake up the processor every 10 seconds, an interrupt is triggered by the low power timer which is clocked by the SIRC clock. Also to measure the real time current consumption we connected an ammeter in series with the microcontroller on the J15 jumper of the S32K144EVB.
For more detailed explanation please watch the following video.
You can also download and test this example which is available as attachment.
Thank you for your attention! if you have questions feel free to reply to this discussion.
Original Attachment has been moved to: mbdt_s32k14x_pmc_temperature_example.mdl.zip