ChibiOS and STM32

ChibiOS is a compact and fast real-time operating system supporting multiple architectures. It offers a multi-threading scheduler and related APIs to manage threads scheduling and priorities, events and inter-thread communication. It also provide an Hardware Abstraction Layer.

STM32 is a broad family of 32-bit microcontrollers based on ARM Cortex-M architecture. With hundreds of different chips, STM32 covers a broad range of applications. Thanks to cheap and valuable development kits it is quite easy to evaluate them or create an prototype.

No matter what they say, you will not be able to appreciate the performance of these MCUs without a good scheduler. Here we will provide resources to getting started with STM32 development board using ChibiOS/RT as kernel and ChibiOS/HAL as drivers. Pick one and read it! If you like it don’t forget to Share the knowledge.

Wide box Tiny box List
Ascent Descent

Using STM32 I2C with ChibiOS

How to drive a HD44780 with I2C backpack with a STM32

The Inter-Integrated Circuit (often shored as I2C or I2C bus pronounced I-squared-C or alternatively I-two-C) is a widely used synchronous serial communication peripheral which communicates in half duplex mode using a multi-master-multi-slave architecture.

Like the SPI, the I2C is a Synchronous Serial bus, and the clock signal is generated by one of the endpoint and provided to the others through a specific Serial Clock Line often shorted as SCL by a party which is named Master.

In half-duplex buses, the communication happens on the same line no matter the direction. The continue reading...

Using STM32 SPI with ChibiOS

The Serial Peripheral Interface (often shored as SPI bus) is a widely used synchronous serial communication peripheral which communicates in full duplex mode using a master-slave architecture with a single master.

As the SPI is a Synchronous Serial bus, a clock signal is generated by one of the endpoint and provided to the others through a specific Serial Clock Line often shorted as SCL or CLK. The communication party which generates the clock is named Master while other Slaves.

In full-duplex buses, the communication is simultaneously bi-directional, i.e. data can flow continue reading...

PWM in hardware with STM32 Timer and ChibiOS

The Pulse Width Modulation (also known as PWM) is a digital modulation technique which uses duty-cycle of square waves to encode information. In communication field PWM surrendered to more evolute communication technique which uses more complex waveforms showing better noise rejection ratio and less transmission errors at highest data rate. Nevertheless, PWM is still used in infrared communication where data rate is very low but transmitter and receiver are cheap.

Anyway low rate communication is not the most relevant use case of PWM which is widely used in many fields continue reading...

Using STM32 ADC with ChibiOS ADC Driver

A microcontroller is a system which works on bits and bit streams more than analog signals, anyway those signals are still widely used in many fields especially in audio and power applications. An Analog to Digital Converter (or ADC) is a system that converts such kind of signals in a sequence of discrete values directly interpretable by the microcontroller. Such kind of converter is widely used in embedded systems to deal with those peripherals which works with analog signals like potentiometers, analog microphones or sensors.

Some examples?

Analog sensors which continue reading...

Using STM32 USART with ChibiOS Serial Driver

The serial communication in asynchronous mode is one of the simplest and most used method to exchange data between microcontroller and other devices. Such kind of communication can be achieved through a Universal Synchronous/Asynchronous Receiver Transmitter (or USART) as well as UART peripheral which actually is a subset of USART. Each STM32 microcontroller is equipped with multiple instances of these peripherals (from 2 up to 8) depending on the microcontroller model.

In this article we are going to take an overview of serial communication protocols and peripherals continue reading...