Getting started with ChibiOS using the SDP-K1
In this article we are going to see how to take the first steps with ChibiOS using the Analog Devices EVAL-SDP-CK1Z or simply SDP-K1 controller board. ChibiOS is a large open source project that revolves around ChibiOS/RT, a Real Time Operating System (RTOS) that offers plenty of utilities to implement a wide spectrum of applications and ChibiOS/HAL a set of device drivers to enable and use dozens of MCU peripherals such as GPIO, UART, SPI, I2C etc.
Learning how to use ChibiOS is very convenient as it would be possible with it to implement a wide spectrum of applications that go from simple educational projects up to commercial products. Moreover, ChibiOS/HAL does a very good job of making the application independent from the MCU in use: this means that it would be possible to port an application from one development board to another in literally 5 minutes.
The choice of the controller board has been mainly dictated by the combination of a well designed STM32F469 microcontroller and the ADI 120-pin connector that allows it to interface to hundreds of Analog Devices evaluation boards.
For those users that are approaching the Microcontroller world for the first time, the article Microcontroller 101 will answer the common questions such as what, why and how.
Setting up the toolchain
The first thing to do is to setup the toolchain. You can either assemble your toolchain from scratch by downloading each component individually and configuring them or you can simply download ChibiStudio, a zip file that contains a preassembled toolchain. To do so:
- Get the last release of ChibiStudio from the Official page of ChibiStudio
- Extract the files under C:\ using 7zip
- Copy the link “Chibi Studio GCC x.x” on the desktop and use it to launch the toolchain.
In case you need more detailed instruction or to troubleshoot follow this how to:
First flash and run
At the first launch of ChibiStudio the toolchain will look like this
The title bar shows that the version of ChibiStudio in the picture is 2022-01, the version of ChibiOS in use is 21.11.x and the workspace in use is Workspace User. The first thing you may want to do is to import a project for the SDP-K1 (here how to) that is located at C:\ChibiStudio\chibios2111\demos\STM32\RT-STM32F469I-EVAL-SDP-CK1Z
A few remarks:
- ChibiStudio comes with different version of ChibiOS and a workspace for each version of ChibiOS and you can switch between them
- The current workspace uses ChibiOS 21.11.x and this dictates the choice of the folder C:\ChibiStudio\chibios2111 for picking the initial project
- The folder C:\ChibiStudio\chibiosxxx\demos contains many demos for different microcontrollers and boards
- The name RT-STM32F469I-EVAL-SDP-CK1Z specifies that the demo uses ChibiOS\RT configured for the microcontroller STM32F469I on the board EVAL-SDP-CK1Z
Once the project has been imported, you will need to build it, flash the firmware on the SDP-K1 and run it. This step by step procedure is described the following how tos:
Description of the main demo
The main demo carries mainly two tasks:
- blink the board LEDs following a specific sequence
- launch the test suite if the pin A0 of the SKD-K1 is grounded and output the results on the CMSIS-DAP serial
The LED blinking is performed by calling the functions palSetLine()/palClearLine() that respectively set high and low the LED line passed as arguments and using the function chThdSleepMillisecond() that stops the flow of the code introducing a well defined delay between LED switches.
The ChibiOS Test Suite performs some OS related tests and outputs the result on the CMSIS-DAP COM port. To get the output of the Test suite, we would need to identify the CMSIS-DAP COM port. Note that the COM port is assigned by Windows and can be re-assigned if you connect the board to a different USB Hub, therefore it is always a good idea to check which COM port has your DAP. To do so:
- open the Device Manager and browse to Port (COM & LPT)
- check the list when the SDP-K1 is connected and disconnected to identify the COM port assigned to the CMSIS DAP
At this point, in the debug perspective of ChibiStudio we have to open the Terminal. To do so:
- Click on the Terminal tab and click on the Open Terminal button
- Choose the Serial Terminal
- Configure it for using the CMSIS DAP COM port, 38400, 8 bit, no parity 1 stop bit
- Choose ok
At this point with a jumper cable short A0 to GND for more than half a second and you will see the output of the Test Suite in the terminal window.
We strongly suggest not modifying the default project as this may be used in the future as a template. The next natural step would be duplicate the initial project and modify LED blinking thread and see how any change influences the blinker timing.
Another suggestion is to look into the simplest project you can ever make for this SDP-K1.