Skip to content

MCU Info Page: STM32L452xE

Jamie Smith edited this page May 16, 2022 · 9 revisions

STM32L452xE MCU Overview

The STM32L452xE (and the NUCLEO_L452RE_P, its Mbed dev board) is a capable midrange chip in the STM32L4 family. It is quite similar to its more popular cousin, the STM32L433, but features more than double the RAM and flash memory, so it's good for projects designed for that chip that outgrow the available space.

Feature Overview

CPU Flash/Code Memory RAM Communication Peripherals Other Features
Cortex-M4F, clocked at up to 80 MHz Total: 512 kiB
Available to user: 476.4 kiB
Total: 128 kiB (SRAM1) + 32 kiB (SRAM2)
Available to user: 117.4kiB
Note: SRAM2 is currently not usable by Mbed OS
  • 4x I2C
  • 1x UART
  • 1x LPUART
  • 3x USART
  • 3x SPI
  • 1x CAN
  • 1x USB (currently not supported)
  • 1x EMMC (currently not supported)
  • DAC (AnalogOut)
  • ADC (AnalogIn)
  • PWM
  • RTC
  • Hardware RNG
  • Hardware CRC Engine
  • DMA (currently not supported)

Configuring Clocking

Core Clock

Mbed OS provides four different clocking options for producing the main (core) clock that the chip will use:

Option Name Description
USE_PLL_HSE_EXTC This option uses an 8MHz* external oscillator connected to the OSC_IN pin. The main PLL will be used to generate system clock and PLLSAI1 will not be configured.
USE_PLL_HSE_XTAL This is similar to the above but expects an 8MHz* crystal on OSC_IN and OSC_OUT. See Page 132 of the datasheet for details.
USE_PLL_HSI This option uses the internal 16MHz (+-2%) HSI oscillator to generate clock. This is accurate enough for a lot of applications and does not require any external components at all.
USE_PLL_MSI This option uses the internal 48MHz (+-8%) MSI oscillator to generate clock. While this oscillator is less accurate by itself, it has the ability to automatically synchronize itself to the low speed (RTC) clock, allowing it to be much more accurate. If you already have a low-speed oscillator connected, using the MSI is the simplest way to have an accurate core clock.

All of these options result in 80 MHz for SYSCLK, HCLK, PCLK1, and PCLK2.

To configure which clock option you want to use, you will need to configure the "target.clock_source" option in your mbed_app.json file. For example, to select the HSI oscillator, you could use:

{
    "target_overrides": {
        "STM32L452xE": {
            "target.clock_source": "USE_PLL_HSI"
        }
    }
}

*The L452RE can accept any input clock from 4-48MHz, but Mbed OS currently hardcodes the configuration for 8MHz. Want to change this? You will first need to create a custom target that replaces the builtin NUCLEO_L452RE_P target and includes its own version of the system_clock.c file. Then, you will need to change the PLL configuration here so that the PLL outputs 80MHz with your input clock. Finally, you must define the macro HSE_VALUE to your new external clock frequency (e.g. by putting "macros_add": ["HSE_VALUE=16000000"] in your custom target).

Low Speed (RTC) Clock

By default, Mbed OS assumes that a 32.768kHz crystal is connected to the OSC32_IN and OSC32_OUT pins, and uses this crystal to drive the RTC as well as some peripherals that are active in sleep mode like the low-power timer. In your design, it might make sense to get rid of this crystal if you're not making active use of the RTC. If you do, make sure to set the option "target.lse_available": 0 in json, which ill use the internal

Clone this wiki locally