How to start
Hello you, and welcome on PLAY Embedded. If you are reading this, most likely this is the very first time for you here. This small guide will explain to you how to better navigate PLAY Embedded, find what you are looking for and interact with Editors to ask support or specific articles.
Approaching STM32 and ChibiOS
Why should I?
STM32 is the largest family of microcontroller based on ARM Cortex-M architecture. Nowadays this architecture has become an industry standard and it is a must know for an embedded developer. What it is better than STM32? Hard to say because this family of microcontrollers has grown quite rapidly in the latest years offering a lot of degrees of freedom and a well-designed set of internal peripherals.
The ARM Cortex architecture is designed for embedded applications and has some internal mechanisms that make it optimized for power consumption still keeping good performances. Some of these mechanisms are designed to perform Operating System context switch more efficiently: they are designed to run a Real-Time Operating System.
Talking of optimization, design, extensibility there is nothing better than ChibiOS. This RTOS is designed for performance, quick context switch, low power and extremely small code footprint. It even offers a Hardware Abstraction Layer that allows you to port applications from a microcontroller to another with ease.
So what is the best way to learn how to use a STM32 with proficiency?
In this blog, there are three categories you should keep watching and follow if you are interested in STM32 or ChibiOS:
- Basic Knowledge which contains some articles about embedded systems and programming in general. These articles contain information you most likely will need soon or later.
- ChibiOS and STM32 which contains a large amount of article related to STM32 and ChibiOS. The aim of this section is to help inexperienced users to get started with STM32 using a ready to use IDE for Windows and providing an example, exercises and libraries for external peripherals.
- Advanced Knowledge which contains some articles about specific advanced topics very useful to extend your own knowledge on specific topics.
These sections are continuously extended with new articles often based on user feedback: your interaction could be the driver for a new article.
In case you are new to STM32 or to ChibiOS we have designed a specific path which would help you to get started with this stuff.
You can notice that the category ChibiOS and STM32 has sub-categories. In a first moment you should concentrate your attention to two categories:
- Getting Started which contains a series of articles which are meant to be tutorials and should be read in a subsequent way.
- Examples and exercises which contains a series of examples and exercises as integration to our tutorial.
At the moment, we are extending these two sections adding new articles in the Getting started section. The idea is to have at least an article for each peripheral of the STM32 and a related set of examples and exercises.
So where do I start?
This is not something you will get in a day or a couple of hour. It would require weeks or months but at list there is a well defined training.
Step 1: the overview
First of all, you should take an overview of the STM32 family and install the STLink drivers. So let’s start from this article: From 0 to STM32. At the end of this article, you will:
- have an overview of how is organized STM32 ecosystem,
- know which development board are available and which is the best for you,
- also know how to install drivers for the STLink, the embedded debugger offered for free by STM32 development kits.
Now you are ready to move forward and take a look to ChibiStudio, a ready to use a working environment for firmware development in Windows. This is explained in the article Developing on STM32: introducing ChibiStudio. At the end of this article, you will:
- have an overview of ChibiStudio,
- know how are organized demos in ChibiStudio,
- have installed the toolchain on your PC,
- be able to do the basic operation with the toolchain (i.e. import demos, create a new project, flash and run the firmware, do basic stuff with the debugger).
To complete the first step, there is another article: A close look to ChibiOS demos for STM32. At the end of this article, you will:
- have detailed knowledge about how a ChibiOS demo is organized,
- be able to launch the ChibiOS test suite,
- master ChibiOS configuration files.
Step 2: first interactions with the external world
Now that you are able to handle and interact with the development environment we can move to the next step. Here we are going to see how to interact with the external world moving our first steps with Input\Output controller. This involves a new tutorial: Using STM32’s GPIO with ChibiOS’ PAL Driver. By the end of this article you will:
- know how GPIO peripheral is organized, its various operating modes and which registers are involved in the GPIO configuration,
- have an overview of the PAL driver that allows interacting with GPIO with ease,
- have a look to PAL APIs and their common usage,
- know how to toggle an output PIN, read an input PIN, how to configure the PIN mode,
- be able to reroute internal peripherals through the GPIO Alternate Functions.
To complete this step there are some examples that you should look. These articles are thought to provide you with some code snippet to deal with the most common use cases. The suggested articles are:
- Dealing with LEDs using an STM32 (Examples and Exercises), for hands-on GPIO using LEDs;
- Dealing with push-buttons using an STM32 (Examples and Exercises), for hands-on GPIO and EXTI using Buttons.
Step 3: first interaction with communication peripherals
This step is important to understand how communication peripherals work and to do something a little bit more complex that toggling a PIN. First of all, you should read the article Using STM32′ USART with ChibiOS Serial Driver, to understand how to deal with STM32 Universal Synchronous\Asynchronous Receiver Transmitter to implement an RS-232 using the ChibiOS Serial driver. This article gives you even an overview of communication protocols highlighting differences between serial and parallel protocols.
Even here we have some suggested examples. Up to know there is only one article but more are coming. Printing strings on a Virtual COM port with an STM32 and ChibiOS is a hands-on STM32 USART with the ChibiOS Serial Driver that explain to you how to use chprintf() to print formatted strings on a terminal.
Step 4: up to you
The next step depends on what is your goal. We have here some additional article that explains how to deal with other STM32 peripherals and related ChibiOS driver.
- Using STM32’s ADC with ChibiOS ADC Driver (Getting Started), to understand how to deal with STM32 Analog to Digital Converter and convert the signal in sequence using ChibiOS ADC Driver.
- PWM in hardware with STM32 Timer and ChibiOS (Getting Started), to understand how to generate Pulse Width Modulation signals using STM32 TIM and the ChibiOS PWM Driver.
- Using STM32 SPI with ChibiOS (Getting Started), to understand how to deal with Serial Peripheral Interface of the STM32 using ChibiOS SPI Driver.
- Using STM32 I2C with ChibiOS (Getting Started), to understand how to deal with Inter-Integrated Circuit bus of the STM32 using ChibiOS I2C Driver.
We are adding articles day by day and reviewing the old one. Keep an eye on PLAY Embedded if you are interested in these topics. The best way is to follow our facebook page where we usually share our new articles (we try to publish only when necessary without annoying you).
We try to keep the quality as high as possible: if you find errors, or you have suggestions, or you would like to read about something specific, your feedback is highly appreciated. If you want to interact with us you can use the contact form or the facebook chat. If you want to interact with us on regular basis we suggest you subscribe our official forum (forum.playembedded.org) which is the best place to start discussions and also the right place to ask new articles or contribute with feedback or error reporting.
If you want to know something about the author you should notice that in the right site of the article there are interesting inside including the author card: hovering it, the card would flip showing interesting link included the link to the author page where you can find a form to get in contact with that specific author.