This section introduces a series of tutorials to get familiar with STM32 microcontroller architecture and programming. Tutorials are written for Windows and tested on a Windows 10 platform. Most involved software is free and available across all platforms (Windows, Linux, Mac). The only exception is Percepio® Tracealyzer, which is not absolutely necessary, yet a great debug tool you'll meet in the FreeRTOS tutorial section.
Tutorials have been written as teaching materials for absolute newbies in the field of MCU programing, considering STM32 as a first experience in embedded software development. If you have previous experience with some other devices (Microchip, Intel, Atmel, ...) you may find that STM32 specific information is somehow scattered within a larger amount of general MCU programing considerations. You may also disagree with several aspects of the proposed approaches (both in terms of tools, project organization, coding style, …). I'm just a fraud :-)
For newcomers, tutorials should be done in the proposed order as concepts are introduced incrementally. Tutorials cover everything you need to get started with STM32 development. From the IDE setup, to the basic usage of several standard peripherals (GPIO, USART, ADC, DAC, RTC, Watchdog) and more. Topics such as clock settings, interruptions and DMA behavior are also addressed. The chosen approach is as close as possible to the MCU hardware.
Although these are primarily STM32 tutorials, you'll find much more than just STM32 things... Take a look at #5.1 for instance, and you will understand what I mean. Control and digital signal processing are also on the menu.
Code examples are 100% fat free from High-Level libraries such as HAL, or any other... Be prepared to dive into STM32 documentation and peripheral registers. High-Level libraries are not evil, and for some advanced peripherals (USB, Ethernet, ...) it's really hard to overcome their use. I just believe that a good understanding of hardware mechanisms will make you a better user of hardware abstraction layers in the future. In addition, I'm pretty sure that these tutorials will not suffer software fashions, and will still be up-to-date in 10 years from now (as long as ST silicon doesn’t change). If you have previous experience with other 8-bit MCU devices (e.g. Microchip® PIC series), you’ll find moving to STM32 very easy this way.
Most of the tutorials can be done at home, with no instrumentation. Having an oscilloscope helps, but it is not strictly mandatory. What you need is a 10$ dev board. Exception is for communication peripherals (I2C, SPI) that requires the wiring of external devices( e.g. sensors, displays, ...).
Finally, please accept my apologies if things hurt you when reading.
STM32 Nucleo® boards are ultra-low-cost platforms used to quickly evaluate and start developing with STM32 microcontrollers.
Theses boards include:
- An STM32 microcontroller unit (MCU)
- Connectivity for Arduino shields
- Pin headers exposing most of the MCU I/Os
- Onboard ST-LINK/V2-1 debugger/programmer with SWD connector
- A user LED and a user Button
- A reset button
The Nucleo board family covers a broad range of MCUs. In these tutorials, we will consider the STM32F072RB. This MCU incorporate the high-performance ARM®Cortex®-M0 32-bit RISC core operating at up to 48 MHz frequency, high-speed embedded memories (up to 128 Kbytes of Flash memory and 16 Kbytes of SRAM), and an extensive range of enhanced peripherals and I/Os. All devices offer standard communication interfaces (two I2Cs, two SPI/I2S, one HDMI CEC and four USARTs), one USB Full-speed device (crystal-less), one CAN, one 12-bit ADC, one 12-bit DAC with two channels, seven 16-bit timers, one 32-bit timer and an advanced-control PWM timer.
- UM1724 User manual STM32 Nucleo-64 board
- 025004 Datasheet STM32F072x8 STM32F072xB January 2017 DocID025004 Rev 5
- PM0215 STM32F0xxx Cortex-M0 programming manual Doc ID 022979 Rev 1
- RM0091Reference manual for STM32F0x1/STM32F0x2/STM32F0x8 advanced ARM®-based 32-bit MCUs DocID018940 Rev 9