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.
I placed here a list about the diversity. However, we’re going to work with the STM32L432KC and the STM32L476RG.
STM32F0
STM32F1
STM32F2
STM32F3
STM32F4
STM32F7
STM32L0
STM32L1
STM32L4
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.
Characteristics:
- ST LINK / V2-1
- USB FS connector
- USB HS connector
- VIN from Arduino connector
- External 5 V from connector
- 3.3 V or 5 V
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
STM NUCLEO-L476RG:
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
128 KB SRAM
SPI (3)
I2C (3)
USART (3)
UART (2)
LPUART (1)
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.
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
Execution starts, 300,000 runs through Dhrystone
Microseconds for one run through Dhrystone: 10.70
Dhrystones per Second: 93,431.43
VAX MIPS rating = 53.18 DMIPS
Total time: 2,458 ms
http://www.saanlima.com/download/dhry21a.zip
STM NUCLEO-L476RG: US $ 23.00
Execution starts, 300,000 runs through Dhrystone
Microseconds for one run through Dhrystone: 9.63
Dhrystones per Second: 103,794.59
VAX MIPS rating = 59.07 DMIPS
Total Time: 869 ms 2.8x FASTER
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
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
- Up to 256 KB Flash, proprietary code reading protection
- 64 KB SRAM including 16 KB with hardware parity check
- Quad SPI memory interface
- 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)
Download the file at https://www.st.com/en/development-tools/stsw-link0.... Just register, download, and install the device.
Finally, install the libraries.
I personally liked the group STM32duino.com, 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.