Introduction: The Incredible STM32 L4!

About: Do you like technology? Follow my channel on Youtube and my Blog. In them I put videos every week of microcontrollers, arduinos, networks, among other subjects.

I want to start this article explaining that this letter L (of the L4) means Low (or, basically, Ultra Low Power). Thus, it spends little energy and shows why this STM32 is incredible! It spends microamps and has a system inside that can identify the expense of each chip part. This allows for a very efficient management of energy, and with high performance.

I already talked about this microcontroller in the video, “The easiest way to program a microcontroller!” In the video, I showed how to program the STM32 L4 with MBED. But while researching more about it, I discovered something that the manufacturer STMicroelectronics does not disclose. It implemented the Core Arduino in the chip, which enables programming through the Arduino IDE.

In this image, we have two versions of L4. The STM32L432KC is identical to the Arduino Nano and the STM32L476RG, which have equivalent IOs to the Arduino Uno. So, while working with two versions of this powerful microcontroller, I’ll show you how to install the Arduino Core in the STM32 family. Also, I’ll explain the main characteristics of the STM32 Kits.

Step 1: Plates With Core Arduino

I placed here a list about the diversity. However, we’re going to work with the STM32L432KC and the STM32L476RG.


  • Nucleo F030R8
  • Nucleo F091RC
  • 32F0308DISCOVERY


  • BluePill F103C8 (Basic support, no USB)
  • MapleMini F103CB (Basic support, no USB)
  • Nucleo F103RB


  • Nucleo F207ZG


  • Nucleo F302R8
  • Nucleo F303K8
  • Nucleo F303RE


  • Nucleo F401RE
  • Nucleo F411RE
  • Nucleo F429ZI
  • Nucleo F446RE
  • STM32F407G-DISC1




  • Nucleo L031K6
  • Nucleo L053R8
  • B-L072Z-LRWAN1


  • Nucleo L152RE


  • Nucleo L432KC
  • Nucleo L476RG
  • B-L475E-IOT01A


Just to illustrate, I show the details of an STM32F746G DISCOVERY, which I consider a beast. I've already ordered this chip, and I hope to talk about it soon.


  • STM32F746NGH6 microcontroller featuring 1 Mbytes of Flash memory and 340 Kbytes of RAM in a BGA216 package
  • On-board ST-LINK / V2-1 supporting USB re-enumeration capabilities
  • Mbed-enabled (
  • USB functions: virtual COM port, mass storage, and debug port
  • 4.3-inch 480x272 color LCD-TFT with capacitive touch screen
  • Camera connector
  • SAI audio codec
  • Audio line in and line out jack
  • Stereo speaker outputs
  • Two ST MEMS microphones
  • SPDIF RCA input connector
  • Two pushbuttons (user and reset)
  • 128-Mbit Quad-SPI Flash memory
  • 128-Mbit SDRAM (64 Mbits accessible)
  • Connector for microSD card
  • RF-EEPROM daughterboard connector
  • USB OTG HS with Micro-AB connectors
  • USB OTG FS with Micro-AB connectors
  • Ethernet connector compliant with IEEE-802.3-2002
  • Five power supply options:

- ST LINK / V2-1

- USB FS connector

- USB HS connector

- VIN from Arduino connector

- External 5 V from connector

  • Power supply output forexternal applications:

- 3.3 V or 5 V

  • Arduino Uno V3 connectors

Step 3: Arduino Due X STM NUCLEO-L476RG

Here is a comparison with the Arduino Due, which is an ARM Cortex-M3. I have used this model in videos: Nema 23 Stepper Motor with Driver TB6600 with Arduino Due, and SpeedTest: Arduinos - ESP32 / 8266s - STM32, with STM NUCLEO-L476RG , which is an ARM Cortex-M4 Ultra Low Power, and is in the image on the right side.

Arduino Due:

Microcontroller: AT91SAM3X8E

Operating Voltage: 3.3V

Input Voltage (recommended): 7-12V

Input Voltage (limits): 6-16V

Digital I / O Pins: 54 (of which 12 provide PWM output)

Analog Input Pins: 12

Analog Output Pins: 2 (DAC)

Total DC Output Current on all I / O lines: 130 mA

DC Current for 3.3V Pin: 800 mA

DC Current for 5V Pin: 800 mA

Flash Memory: 512 KB all available for the user applications

SRAM: 96 KB (two banks: 64KB and 32KB)

Clock Speed: 84 MHz

Length: 101.52 mm

Width: 53.3 mm

Weight: 36 g


STM32L476RGT6 in LQFP64 package

ARM®32-bit Cortex®-M4 CPU

Adaptive real-time accelerator

(ART Accelerator ™) allowing 0-wait state execution from Flash memory

80 MHz max CPU frequency

VDD from 1.71 V to 3.6 V

1 MB Flash


SPI (3)

I2C (3)


UART (2)


GPIO (51) with external interrupt capability

Capacitive sensing with 12 channels

12-bit ADC (3) with 16 channels

12-bit DAC with 2 channels

FPU or Floating Point Unit

* I highlight here the
separate FPU of STM NUCLEO-L476RG, which means that the chip makes trigonometric calculations with amazing speed. This is unlike the Arduino Due, which needs a genetic processor to do that.

Step 4: Dhrystone

Dhrystone is a synthetic computer benchmark program developed in 1984 by Reinhold P. Weicker, which is intended to be representative of (integer) system programming. Dhrystone became a representative of overall processor performance (CPU). The name "Dhrystone" is a pun on a different benchmark algorithm called Whetstone. This is a measure taken from some generic operations.

This program is here to compile something inside these microcontrollers in Arduino. And the result of two tests I did, one with Dhrystone and another from the SpeedTest video, are as follows:

Arduino Due: US $ 37.00

  • Dhrystone Benchmark, Version 2.1 (Language: C)

Execution starts, 300,000 runs through Dhrystone

  • Execuion ends

Microseconds for one run through Dhrystone: 10.70

Dhrystones per Second: 93,431.43

VAX MIPS rating = 53.18 DMIPS

  • Running test Fernandok

Total time: 2,458 ms

  • Does not have FPU
  • Dhrystone software on Arduino

STM NUCLEO-L476RG: US $ 23.00

  • Dhrystone Benchmark, Version 2.1 (Language: C)

Execution starts, 300,000 runs through Dhrystone

  • Execution ends

Microseconds for one run through Dhrystone: 9.63

Dhrystones per Second: 103,794.59

VAX MIPS rating = 59.07 DMIPS

  • Running test Fernandok

Total Time: 869 ms 2.8x FASTER

  • PI up to 40Mbit / s, USART 10Mbit / s
  • 2x DMA (14 channels)
  • Up to 80 MHz / 100 DMIPS with ART Accelerator

Step 5: STM32L432KC X Arduino Nano

The left board is the STM32L432KC, in which STMicroelectronics placed the identical Arduino Nano pinout in the picture on the right.

Step 6: STM32L432KC

Ultra-low-power Arm® Cortex®-M4 32-bit

MCU + FPU, 100DMIPS, up to 256KB Flash, 64KB SRAM, USB FS, analog, audio

Up to 26 IOs faster, more tolerant to 5V

  • RTC with HW calendar, alarms, and calibration
  • Up to 3 capacitive detection channels
  • 11x Timers: 1x16-bit advanced engine control

1x 32-bit and 2x 16-bit general purpose, 2x 16-bit basic, 2x low-power 16-bit timers (available in Stop mode), 2x watchdogs, SysTick timer

  • Memory:

- Up to 256 KB Flash, proprietary code reading protection

- 64 KB SRAM including 16 KB with hardware parity check

- Quad SPI memory interface

  • Rich analog peripherals (independent supply)

- 1x 12-bit ADC 5 Msps, up to 16 bits with hardware oversampling, 200 μA / Msps

- 2 channels of 12-bit DAC output, low power consumption

- 1x operational amplifier with built-in PGA

- 2x compared to ultra-low power interfaces

- 1x UPS (serial audio interface)

- 2x I2C FM + (1 Mbit / s), SMBus / PMBus

- 3x USARTs (ISO 7816, LIN, IrDA, modem)

- 1x LPUART (Stop 2 wake up)

- 2x SPI (and 1x SPI Quad)

- CAN (2.0B active)

- Single wire protocol master SWPMI I / F

- IRTIM (infrared interface)

  • 14-channel DMA controller
  • Random Number Generator

Step 7: Install Core Arduino for STM32L4 Cards

  1. Install ST-Link program that records
  2. Json Address
  3. Boards: Card Manager
  4. Libraries: Library Manager

Step 8: Install ST-Link - Program That Records

Download the file at Just register, download, and install the device.

Step 9: Address Json

On properties, include the following address:

Step 10: Boards: Board Manager

In the Arduino Board Manager, install the STM32 Core, which is about 40MB.

Step 11: Libraries: Library Manager

Finally, install the libraries.

I personally liked the group, which has several examples, some of which I installed. I also downloaded a FreeRTOS, which I liked a lot. I found it fast and reliable. I also installed (but haven’t yet tested) LRWAN. I'll soon tell you whether it's good or not.

Step 12: Download PDF