STM32l476 LOW POWER DESIGN - Part 1:Power scaling

Overview:

The STM32L476 is a low-power MCU based on the ARM Cortex-M4 architecture. A single-precision floating point unit (FPU) in the Cortex-M4 core supports all Arm® single-precision data-processing instructions and data types. It also has a complete set of DSP instructions and a memory protection unit (MPU) to boost programme security. It is ideal for ultra-low power applications. This blog aims to demonstrate to you the low-power design of the STM32L476 controller. We will use STM32l476 Nucleo Board and CUBE MX environment for project setup as our power measurement tool is Nordic Power Profile kit 2.

STM32L476 Low Power Features:

  • Low power modes: Low power modes include Sleep, Stop, Standby, and Shutdown on the STM32L476 microcontroller. These modes enable the microcontroller to consume less power while preserving certain functionality, and the mode can be chosen according to the specific application requirements.
  • Power scaling: The STM32L476 microcontroller offers power scaling capabilities, allowing it to dynamically change its power consumption based on the application's processing demands. The device's working frequency and voltage can be scaled, resulting in lower power consumption and longer battery life.
  • Ultra-low power consumption: The STM32L476 microcontroller is designed to consume very little power. It has a deep sleep mode that uses 1.2 uA of current and a standby mode that uses 600 nA of current. Ultra-low power consumption.
  • Low-power peripherals: The STM32L476 microcontroller has various low-power peripherals, including low-power timers, low-power comparators, and low-power ADCs. These peripherals contribute to the system's overall power consumption.

  • Wake-up sources: The STM32L476 microcontroller has several wake-up sources, including external interrupts, internal events, and timers. These wake-up sources allow the microcontroller to exit low-power modes and resume normal operation when required.

  • Will test these low-power features to see how they affect power consumption. This is the first phase, which will focus on power scaling. In subsequent posts, I will go into the low-power modes and other features.



    Power Profiler Kit II:

    The Power Profiler Kit II (PPK2) is a low-cost, flexible instrument for measuring your designs' real-time power usage. The PPK2 monitors power consumption by either powering the external board or acting as an ampere metre. It monitors current from 500 nA to 1 A and provides a thorough picture of the user application's current profile.

    For more details on Nucleo Board and Power Profiler Kit 2 please refer to the datasheet links provided at the end of the blog, also visit the GitHub page for the firmware files.

    Hardware details:
    • Target Board: Nucleo-l476RGV
    • Power Measurement Tools: Nordic Power Profile Kit 2

    STM32L476 Power Supply Overview:




    The internal digital power VCORE is supplied via an inbuilt linear voltage regulator. The power supply for digital peripherals and memories is known as VCORE.


    Voltage Regulator

    Except for the Standby circuitry and the backup domain, all digital circuitries are powered by two inbuilt linear voltage regulators. The software can tune the main regulator output voltage (VCORE) to two different power ranges (Range 1 and Range 2) to minimise consumption based on the system's highest operating frequency.

    Depending on the application mode, the VCORE supply is given by either the main regulator (MR) or the low-power regulator (LPR).
    • Both regulators are enabled in Run, Sleep, and Stop 0 modes, and the main regulator (MR) gives full power to the VCORE domain (core, memories and digital peripherals).
    • The main regulator is turned off in low-power run and low-power sleep modes, and the low-power regulator (LPR) feeds low power to the VCORE domain while keeping the contents of the registers, SRAM1 and SRAM2.
    • In Stop 1 and Stop 2 modes, the main regulator is off and the low-power regulator (LPR) supplies low power to the VCORE domain, preserving the contents of the registers, SRAM1 and SRAM2.
    • In Standby mode, with SRAM2 content retained (the RRS bit set in the PWR CR3 register), the main regulator (MR) is turned off, and the low-power regulator (LPR) supplies only SRAM2. The core, digital peripherals (with the exception of standby circuitry and backup domain), and SRAM1 are all turned off.
    •  Both regulators are turned off in Standby mode. Except for the Standby circuitry and the backup domain, the contents of the registers, SRAM1 and SRAM2 are lost.
    • In Shutdown mode, both regulators are powered off. When exiting from Shutdown mode, a power-on reset is generated. Consequently, the contents of the registers, SRAM1 and SRAM2 are lost, except for the backup domain.

    Dynamic voltage scaling management:

    Dynamic voltage scaling is a power management technique which consists of increasing or decreasing the voltage utilised for the digital peripherals (VCORE), according to the application performance and power consumption needs.

    Dynamic voltage scaling to increase VCORE is known as over-volting. It allows for improvement in the device's performance.

    Dynamic voltage scaling to decrease VCORE is known as under-volting. It is performed to save power, particularly in laptops and other mobile devices where the energy comes from a battery and is thus limited.

    The main regulator has two configurable voltage ranges, which are outlined below:

    •  Range 1: High-performance range
    The main regulator output voltage is typically 1.2 V. The system clock frequency can be set to as high as 80 MHz. The Flash access time for read access is the shortest feasible; write and erase operations are also allowed.

    • Range 2: Low-power range
    The main regulator output voltage is typically 1.0 V. The system clock frequency can be set to as high as 26 MHz. When compared to Range 1, the Flash access time for read access is longer;
    write and erase operations are still available.

    Now let's implement the dynamic voltage scaling methods and will check the measurements will create a project using Cube MX Tool and build the project in cube ide.




    The user-led connected to PA_5 on the Nucleo board will be used to blink in seconds interval and also will print some messages on the UART.



    The clock source is selected HSI (High-Speed Internal) which will provide the 16Mhz clock to the CPU Core. As we are using a Nucleo board input supply is 5Vs.

    First will check the power consumption in Range 1 then Range 2.


    As we can see in the above image when we are operating the CPU in range 1 in RUN Mode we are getting an average current of 3.98ma. Also in between, we can see the current is getting dropped due to delays introduced in LED's toggling.

    Let's set the CPU in Range 2 by utilising the HAL API, as illustrated below.

    /** Configure the main internal regulator output voltage
    */
    if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE2) != HAL_OK)
    {
    Error_Handler();
    }

    Note: For the entire firmware please don't forget to visit the GitHub link provided at the bottom of the page.

    The above API will be called inside SystemClock_Config() function.



    As we can see the average currents get a drop to 3.6ma as we shift the regulator output voltage in Range 2.

    Now let's try to offload the CPU means we don't blink the LEDs and stop the UART Transmitting and basically will exclude the peripherals to check only the CPU Core consumption in RUN Mode. Just will comment LED blinking and UART Transmit part from the code.


    As we see in the above image the current comes to around 2.2ma when we stop using the Peripherals.

    To reach a conclusion, we can compare the measured values with the CUBE MX Tool. In CUBE MX Tool there is a power calculator tool where we can calculate the power consumption for our application. By selecting the appropriate configurations and system peripherals.



    In the tool, we can see the step consumption which is showing the CPU consumption without the peripherals is 2.31ma for Range 2 when CPU Frequency is 16Mhz further, we can come down to less current if we reduced the operating voltage to 3.3V or 1.8V. As we are using NUCLEO -Board we don't have the feasibility to reduce the operating voltage below 5V's.


    Thank You to visit our blogs in further parts will check the different sleep modes of the STM32L476 and also see more ways to reduce the power consumption of the MCU like clock gating etc.



    References:





    Comments