AN5425 - Transfer Power Mode
AN5425 - Transfer Power Mode
Contents
1. Introduction ........................................................................1
1. Introduction 2. Overview of power modes. .................................................2
2.1. ARM Cortex-M4 and M0+ power modes
implementation ...................................................................... 2
The power consumption of devices and the implications 3. Power Modes description ...................................................3
around designing for low power are common topics 3.1. Power mode transitions ........................................... 5
currently. The S32K1xx family includes internal power 4. Clock Operation in low-power modes ................................6
4.1. System Clock Generator (SCG) clocks.................... 6
management features that can be used to control the 4.2. Power Management controller (PMC) ..................... 8
microcontroller’s power usage and assist reaching the 5. Power Mode Entry/Exit ......................................................8
targets of embedded designs. 5.1. HSRUN mode entry ................................................ 9
5.2. HSRUN mode exit ................................................. 11
This application note discusses how to use the power 5.3. VLPR mode entry .................................................. 11
5.4. VLPR mode exit .................................................... 12
management system, provide use case examples and 5.5. STOP and VLPS mode entry sequence ................. 13
shows current measurement results for these cases. Tips 5.6. STOP and VLPS mode exit sequence.................... 15
are given for using each of the power modes available on 6. Modules in power modes .................................................. 15
7. Hardware and software considerations ............................. 15
S32K1xx family. 7.1. Hardware considerations ....................................... 16
7.2. Software considerations......................................... 16
7.3. Tips for making low-power measurements on the
bench……… ....................................................................... 16
7.4. Current Consumption measurements ..................... 18
8. Power modes use cases. .................................................... 18
8.1. VLPS + RUN for 100uA on System current ......... 18
8.2. Clock considerations when switching between
different modes .................................................................... 20
8.3. VLPS + DMA + LIN ............................................. 25
9. Revision History ............................................................... 27
Overview of power modes
Normal Run Default mode out of reset, on-chip voltage regulator is on Run -
(internal supply is fully regulated).
High Speed Run Allows maximum performance of the chip. In this mode, Run -
(HSRUN)1 the chip can operate at a higher frequency as compared to
Normal Run mode but with restricted functionalities.
Internal clocking requirements should be met.2
Very Low Power On-chip voltage regulator is in a low power mode that Run -
Run (VLPR) supplies only enough power to run the chip at a reduced
frequency.
• Reduced-frequency flash memory access mode (1
MHz)
• LVD is off
• SIRC provides a low power 4 MHz source for the
core, the bus and the peripheral clocks.
Very Low Power Places the chip in a static state with Low Voltage Detect Deep Sleep Interrupt (or
Stop (VLPS) via (LVD) operation off. This is the lowest-power mode in Reset)
WFI instruction which pin interrupts are functional.
• Some peripheral clocks are stopped.3
• LPTMR, RTC and CMP can be used.
• NVIC is disabled.
• AWIC is used to wake from interrupt.
• Core is gated off.
• All SRAM is operational (content is retained and
I/O states are maintained).
Stop 1 (via WFI Places the chip in static state. LVD protection is Deep Sleep Interrupt (or
instruction) maintained. Reset)
• NVIC is disabled.
• AWIC is used to wake up from interrupt
• Some peripheral clocks are stopped.3
• The core clocks, system clocks and bus clock are all
gated.
Stop 2 (via WFI Places the chip in static state. LVD protection is Deep Sleep Interrupt (or
instruction) maintained. Reset)
• NVIC is disabled.
• AWIC is used to wake up from interrupt
• Some peripheral clocks are stopped.3
• Only the core and system clocks are gated, but the
bus clock remains active. The bus masters and bus
slaves clocked by the system clock enter stop mode,
but the bus slaves clocked by the bus clock remain
in run mode. The clock generators in the SCG and
the PMC’s on-chip regulator also remain in Run
mode.4
1. HSRUN is not available in S32K11x series of device.
2. Core and System clock must be 112 MHz or less, Bus clock must be programmed to 56 MHz or less and an integer divider of
the core clock. Flash clock must be programmed to 28 MHz or less, the core clock to flash clock ratio is limited to a
maximum value of 8.
3. See Modules in power modes chapter in this application note for more details.
4. The following can initiate an exit from STOP: Reset, an asynchronous interrupt from a bus master (valid also for
STOP1) and A synchronous interrupt from a bus slave clocked by the bus clock (Valid only for STOP2).
Following table defines trigger for the various state transitions shown in figure above.
Table 2. Power modes transition triggers
Transition From To Mode Transition Trigger Command/Condition
SMC_PMCTRL[STOPM] = 0b010,
VLPR VLPS
3 following a WFI instruction.2
VLPS RUN Interrupt and VLPS mode was entered directly from RUN or reset.
Muxes and inputs in red are not available in S32K11x. CMU module (in blue) in only available for
S32K11x.
NOTE
System PLL is not available in S32K11x family.
The clock generation circuitry provides several clock dividers and selectors allowing different modules to
be clocked at a specific frequency for that module. Four main clock sources (Besides Low Power
Oscillator LPO module) can be seen on SCG module: Fast Internal Reference Clock (FIRC), Slow Internal
Reference Clock (SIRC) System Oscillator (SOSC) and System PLL (SPLL). For Run modes, (HSRUN,
normal RUN, VLPR) different sources can be used to provide clock signal to core. Next diagram shows
all possible sources for core clock that can be used in different power modes.
For other power modes, such as STOP and VLPS, as core clock is gated off, no source is used.
When entering VLPR/VLPS mode, the System PLL and FIRC must be disabled by software in RUN
mode before making any mode transition.
Before switching clock sources, be sure to meet requirements listed in section Internal clocking
requirements and Module clocks in Reference Manual.
NOTE
Flash programming/erasing is not allowed. No FTFC commands of
any type, including CSE commands (for CSEc parts), are available
when the chip is in this mode.
NOTE
Modifications to clock gating control bits are prohibited
As HSRUN mode allows MCU to run at maximum clock speed, be sure to adjust frequencies in SCG
module to meet clock requirements for RUN mode. These requirements can be consulted on section
Internal clocking requirements from Reference Manual.
NOTE
HSRUN mode is not supported in S32K11x family
NOTE
Flash programming/erasing is not allowed. No FTFC commands of any
type, including CSE commands (for CSEc parts), are available when the
chip is in this mode.
NOTE
Do not increase the clock frequency while in VLPR mode, because the regulator is slow
in responding and cannot manage fast load transitions. In addition, do not modify the
clock source in the SCG module or any clock divider registers. Module clock enables in
the PCC can be set, but not cleared.
NOTE
To reduce MCU power consumption in low power modes, PMC_REGSC[BIASEN] bit
should be set. This bit enables source and well biasing for the core logic in low power
modes. This bit must be set to 1 when using Very Low Power (VLP) modes.
SMC_STOPCTRL[STOPO] bits selects whether MCU is sent to STOP1 (0b01) or STOP2 (0b10) mode.
Next snippet code shows a basic RUN to STOP1/STOP2 transition function.
void RUN_to_STOP (void)
{
/* Enable SLEEPDEEP bit in the Core
* (Allow deep sleep modes) */
S32_SCB ->SCR|=FSL_SCB_SCR_SLEEPDEEP_MASK;
/* Select Stop Mode */
SMC->PMCTRL=SMC_PMCTRL_STOPM(0b00);
/* Select which STOP mode (Stop1 or Stop2)
* is desired (Stop1 - 0b01, Stop2 - 0b10) */
SMC->STOPCTRL=SMC_STOPCTRL_STOPO(0b01);
/* Check if current mode is RUN mode */
if(SMC->PMSTAT == 0x01)
{
/* Go to deep sleep mode */
asm("WFI");
}
}
1 You can refer to section System clock switching in Reference Manual for more details.
Power Management for S32K1xx, Rev. 1, 05/2018
14 NXP Semiconductors
Hardware and software considerations
NOTE
To reduce MCU power consumption in low power modes, PMC_REGSC[BIASEN] bit should be
set. This bit enables source and well biasing for the core logic in low power modes. This bit must be
set to 1 when using Very Low Power (VLP) modes.
7.3.1. External.
The suggestions below address the most common issues encountered when trying to duplicate the data
sheet current specs.
• When using a digital multimeter (DMM), use "Manual Range Mode." Using a DMM with an
auto-ranging function enabled may cause LVD and POR resets. This is most common when you
are exiting from one of the low-power modes like LLS or VLPS back to Run. The DMM has
changed the range to a micro-amp or nano-amp range while the MCU is in the low-power mode
and the sudden inrush of current requires the DMM to change range. The range change does not
happen fast enough and the MCU starves and pulls the VDD level below the LVD or POR limits.
• Disconnect the debugger and power cycle the MCU. With the JTAG debugger is attached, the
MCU may have the debugger module in the MCU active, clocking and consuming power. The
external debugger hardware may also load the I/O of the JTAG port when attached. Thus, your
low-power measurements will be higher than expected.
• Isolate the MCU VDDs. If you want to measure the current draw of the MCU, then remove the
other IC and component networks that are sourced by the voltage supply sourcing the MCU. For
example, some EVBs have a potentiometer connected between MCU_VDD and ground. A 5 K
potentiometer across a 3.6 V supply pulls 720 μA. This is huge when considering that the MCU
consumes around dozens μA in lowest power modes.
• Match impedance of inputs. If the impedance of high speed signals (fast edge transitions) are
not well matched, then the signals can "ring" and exceed the VDD supply of the device. This can
result in the signal providing current to the device through the input protection diodes. This is
particularly true for high speed input clocks. This issue can result in negative IDD measurements
while in the lowest power modes.
• Match voltage levels. Although the MCU input pins are 5 V tolerant on some parts, when the
MCU goes into the low-power modes, measurement of the current through MCU_VDD will be
affected by any input higher than MCU_VDD. The higher input pin will back power the MCU
through the input pin, resulting in negative IDD reading in low-power modes.
• Reduce pin loading of the MCU. When the MCU sources current through the output pins, the
power is being sourced through MCU_VDD. This is most evident when you output high
frequency signals to an output pin as you might with the external memory interfaces such as
clock and address/data pins.
7.3.2. Internal.
Below is a list of the most common issues that can prevent you from getting to the lowest data sheet
current specs.
• Watchdog is not disabled, causing resets. Disable or service the watchdog.
• The clock monitor is not disabled which may cause resets. Disable all clock monitors.
• A crystal oscillator is enabled in low power mode. The RTC oscillator, typically consumes <500
nA of current.
• The CLKOUT signal is being output to a pin. Any pin that is constantly changing state will
draw power.
• The requested low-power mode is not allowed with a corresponding bit in the PMPROT
register. For example, if AVLP is not set in the PMPROT and the WFI instruction is executed,
you won’t enter Stop mode.
• The clock gate for a module is not enabled before it is read or written. This causes a reset
before the MCU tries to enter the low-power mode.
• The clock gate for a module that must acknowledge the mode controller mode entry request is
turned off prior to low-power mode entry. This will result in a Stop Mode Acknowledge reset.
• Failure to un-comment out the call to the stop or sleep function after debugging is complete
will keep you in the higher run current mode.
• The frequency of wake-up events is too high, which means that the MCU spends more time in
Run or VLPR 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.
• The MCU is running at a much higher frequency than is needed to accomplish the work.
Throttle the clock with the SCG dividers or reduce the clock. Obviously, the higher the MCU
frequency the higher the IDD of the MCU. Reduce the clock and lower the Run or Wait current.
However, there is some trade-off. If the current of Run mode can be tolerated, then getting work
done as quickly as possible and going right back to low power mode is more advantageous than
running a slower clock in Run mode.
• An input pin is floating without an internal or external pull device. This can result in 50-80 uA
of current per pin. This include the JTAG or SWD pins. Disable the JTAG pins on PORTA or
properly terminate the inputs.
Beside this, user can vary operation frequency, module’s settings, etc. to identify how the system current
is impacted.
For this use case, we made a second test to set the core frequency to 4MHz (expecting the maximum
current could be reduced although time spent in RUN would be longer) to correlate if system current can
be reduced. Following image shows the results we had.
As seen in the figure above, average current for the system is increased using a lower frequency for the
core, so the relationship between maximum current in RUN vs time spent in RUN plays a role to define
the total current consumption for the system.
7.12 𝑚𝐴 ∙ 0.63 𝑚𝑠 + 35𝜇𝐴 ∙ 50.79 𝑚𝑠
𝐼𝑠𝑦𝑠𝑡𝑒𝑚 = = 121.8 𝑢𝐴
51.42 𝑚𝑠
In summary, user needs to consider not only the lowest power mode when designing the whole system
but also the operating frequency for the “awaken” mode, the configuration for used modules, the
periodicity for the wake-up signal, etc. to achieve the desired current value.
8.2.1. Switching between HSRUN and RUN (S32K14x devices only) to use
CSEc/EEEPROM features when device is running at maximum speed.
As some features such as Programming/Erasing Flash and CSEc/EEEPROM operations are not available
in HSRUN, user must switch between HSRUN and RUN mode to run device at maximum speed in
HSRUN and then execute some operations (CSEc/EEEPROM) in RUN when these features are
required.
As the switching process between 112MHz in HSRUN mode using SPLL as the main clock source to
48MHz in RUN mode using FIRC as the main clock source can be easily done using the different
SCG_xCCR registers settings shown in table below.
For HSRUN mode, Core clock will be 112MHz, Bus clock 56MHz and Flash clock 28MHz.
For RUN mode, Core clock will be 48MHz, Bus clock 48MHz and Flash clock 24MHz.
Using this configuration, user can switch between HSRUN and RUN easily if Asynchronous peripheral
clock sources are not used (SPLL_DIV1 and SPLL_DIV2) otherwise, some considerations must be
taken.
According to Clock definitions section in Reference Manual, SPLL_DIV1 can be configured to 80MHz
or less in RUN mode and to 112MHz or less in HSRUN. Also, SPLL_DIV2 can be configured to 40
MHz or less in RUN mode and to 56 MHz or less in HSRUN, besides this, whenever a peripheral clock
source or its divider is changed, the corresponding module should be disabled. To avoid this, it is
recommended to set a fix frequency in both signals that meets requirements for both Run and HSRUN to
avoid the need of disabling the peripheral when the power mode switching takes place (For instance, a
PWM signal driven by FTM which is using SPLL_DIV1 might not need to be paused while the power
mode transition is happening). Following image shows the maximum frequencies for each source to
facilitate the power transition between HSRUN and RUN without the need to change the dividers/clock
source before the power mode transition.
Although SPLLDV1_CLK can be configured to 56 MHz (it does not violate the maximum allowed
frequency), there is a restriction in FTM that requires FTM’s functional clock (SPLLDVI1_CLK) not to
exceed ¼ the functional clock (Clock feeding FTM logic, which is driven from SYS_CLK). So
SPLLDIV1 is fixed to 14MHz (56 MHz / 4 = 14 MHz).
For diagram above, all peripherals bonded to SPLL_DIV1 and SPLL_DIV2 do not need to be
disabled/suspend for the switching process as the same value remains in these signals on every
transition, on the other hand, peripherals linked to SYS_CLK and BUS_CLK might need to be disabled
before the switching process and enable the peripherals again after the transition to desired power mode
is completed.
NOTE
Although SCG_xCCR[DIVBUS] and SCG_xCCR[DIVSLOW] remain unchanged, DIVCORE is
changed impacting the frequency value for Bus and Flash clocks, so peripherals using these clock
sources need to be disabled prior the switching event.
Table 27-9 in reference manual lists all the peripherals and their available clock sources. Be sure to
disable all those peripherals tied to SYS_CLK / BUS_CLK before any transition (Specifically all
timer/communications peripherals which are more time-depending).
NOTE
Although FIRC_DIV1 and FIRC_DIV2 signals could be configured to 48MHz, most peripherals
able to use these signals limit the allowed frequency for the peripheral as this governed by
BUS_CLK / SYS_CLK. It is depicted in table Peripheral clock summary from reference manual.
Once all these considerations are taken, device can run on HSRUN for high speed performance and
whenever is needed, switching to RUN to execute any CSEc/EEEPROM functionality. After these are
completed, device can go back to HSRUN.
Example project was tested on S32K142EVB and it implements:
Once CSEc operations are completed, device will run again at maximum speed. Following figure shows
clock signal after, during and before the transitions to RUN mode.
Data can be transferred through LPUART interface as DMA can be active in VLPS. Once it is
completed, MCU is awaken before last data is physically seen on TX pin. In this use case, LPUART is
loaded with same data to be transferred and process is repeated endlessly. Following figure shows the
power consumption for this use case. One important difference here is that, if more data is sent while
MCU remains in VLPS, the current consumption is reduced.
9. Revision History
Version Number Revision Date Description of changes
While NXP has implemented advanced security features, all products may be subject to
unidentified vulnerabilities. Customers are responsible for the design and operation of
their applications and products to reduce the effect of these vulnerabilities on
customer's applications and products, and NXP accepts no liability for any vulnerability
that is discovered. Customers should implement appropriate design and operating
safeguards to minimize the risks associated with their applications and products.
NXP, the NXP logo, NXP SECURE CONNECTIONS FOR A SMARTER WORLD,
COOLFLUX, EMBRACE, GREENCHIP, HITAG, I2C BUS, ICODE, JCOP, LIFE VIBES,
MIFARE, MIFARE CLASSIC, MIFARE DESFire, MIFARE PLUS, MIFARE FLEX,
MANTIS, MIFARE ULTRALIGHT, MIFARE4MOBILE, MIGLO, NTAG, ROADLINK,
SMARTLX, SMARTMX, STARPLUG, TOPFET, TRENCHMOS, UCODE, Freescale, the
Freescale logo, AltiVec, C 5, CodeTEST, CodeWarrior, ColdFire, ColdFire+, C Ware,
the Energy Efficient Solutions logo, Kinetis, Layerscape, MagniV, mobileGT, PEG,
PowerQUICC, Processor Expert, QorIQ, QorIQ Qonverge, Ready Play, SafeAssure, the
SafeAssure logo, StarCore, Symphony, VortiQa, Vybrid, Airfast, BeeKit, BeeStack,
CoreNet, Flexis, MXC, Platform in a Package, QUICC Engine, SMARTMOS, Tower,
TurboLink, and UMEMS are trademarks of NXP B.V. All other product or service names
are the property of their respective owners. ARM, AMBA, ARM Powered, Artisan,
Cortex, Jazelle, Keil, SecurCore, Thumb, TrustZone, and μVision are registered
trademarks of ARM Limited (or its subsidiaries) in the EU and/or elsewhere. ARM7,
ARM9, ARM11, big.LITTLE, CoreLink, CoreSight, DesignStart, Mali, mbed, NEON,
POP, Sensinode, Socrates, ULINK and Versatile are trademarks of ARM Limited (or its
subsidiaries) in the EU and/or elsewhere. All rights reserved. Oracle and Java are
registered trademarks of Oracle and/or its affiliates. The Power Architecture and
Power.org word marks and the Power and Power.org logos and related marks are
trademarks and service marks licensed by Power.org.
Document Number:AN5425
Rev. 1
05/2018