I was asked to review the STMicroelectronics STM32F0-Discovery board, a high-quality, low-cost board designed to show off the technical capabilities of the STM32F0 microcontroller, while remaining versatile enough to be used for applications immediately.
Box Contents
The STM32F0-Discovery comes in a nice package, with colourful illustrations, and some text highlighting the advantages of the board. The board itself is well protected, and should survive even the harshest of transport. The package doesn't contain any CDs, or any cables; the board is powered and programmed with a single mini-USB connector, and you probably already have a few of those on your desk anyway. If you don't, you can pick them up at a supermarket, or any electronics store. As for the CD, everything is available on the website, so once again, it isn't something you need. The package therefore contains the strict minimum, but it does come with a hidden advantage, one I didn't know about until unboxing the board. Hidden below is a prototyping board, slightly smaller than the Discovery, but with the I/O connector position clearly indicated. It's a nice addition, especially since it doesn't take much to turn this board into a shield. By adding some headers and components, this board can sit underneath the Discovery, or if you don't need the reset and user buttons, it can also go on top. It's a nice addition, one I wasn't expecting, but was very pleased to see.
STM32F051R8T6
The Discovery board has two visible chips one of them is for the USB interface and the other is the STM32 F0 itself This board uses the STM32F051R8T6 based upon an ARM Cortex-M0 it features 64KB of Flash memory and 8KB of RAM with a clock speed of up to 48MHz It is powered by a USB connector but the microcontroller itself can be powered from anywhere between 2.0 and 3.3V useful for battery operation While it is powered at 3.3V it has 36 I/O lines that are 5V tolerant reducing the need for electronics when interfacing with 5V components All of the I/O lines are fast I/Os theoretically capable of switching in a single cycle
The STM32F051R8T6 also has 5 DMA channels one 16-channel 12-bit high-speed ADC one 12-bit D/A converter and 18 capacitive touch sensor channels I<t also has 11 timers with functionality ranging from 16-bit PWM channels a 32-bit timer input capture and output compare timers that can be used for IR remote controls or watchdog timers to name but a few
As far as communications go, it has 2 I2C ports, 2 USARTS and 2 SPI ports. One of the I2C ports can operate at 1Mbit/s, and the SPI ports can run at up to 18Mbit/s. The USART has auto baud rate detection.
The STM32F051R8T6 also has a few more interesting features that aren't available on all devices It has an HDMI CEC interface and integrates motor control With a wide range of peripherals the STM32F0 can be used in a large amount of devices
The Discovery Board
This particular board does not embark a large amount of peripherals, but does come with a complete I/O set. It has 66 headers, one for each of the 64 pins, and two power rails. The headers are standard 2.54” format, and each one is clearly labelled on the circuit board. There is enough space both above and below the board to add probes or connectors, and it is even possible to place an entire side onto a breadboard if you really need to. You'll need two breadboards to be able to access everything, but I'd suggest getting some female/male connectors to get the job done.
The board does have a few components though. It has two buttons; a user button, and a reset button. By default, the board has a blink program, and the user can select the output rate by pressing the user button. This action is shown on the two user LEDs, one green and one blue. There are 2 other LEDs; one is for the power, and the other shows the current status of the communications port.
ST-Link and Software
The board is powered and programmed using a single USB connector, using the onboard ST-Link. This interface allows you to both program the board, and to debug applications. This can be transformed into a simple UART port by removing two jumpers.
STMicroelectronics provides a complete solution for developing with these microcontrollers, called STM32Cube. This solution is separated into several packages, one for each family of ARM microcontrollers. Since this board is a Cortex-M0, the STM32F0 family, you will need the STM32CubeF0 software, called the Cube library, available for free on the STMicroelectronics site.
As a quick side note, STMicroelectronics also provides STM32CubeMX, a graphical interface used to create boot-up and initialization code. It allows you to quickly select the desired input/output for each pin, and create the boot-up code necessary to use your device in that configuration. You won't need this to use the evaluation board, but it is worth looking at this program to help you decide which microcontroller to use for your project. This is the sort of tool that can make all the difference.
Your First Program
Having an excellent board just isn't enough, you need to be able to make your own programs, and this is where each manufacturer uses their own system. Some have their own universal software, this is the case with Arduino. The IDE works on Windows, Linux and MacOS, and even has some interesting ports like the Raspberry Pi. Atmel has their own branded version of Visual Studio, giving the end user a professional environment, but one that will only work on Windows. STMicroelectronics has a different approach.
STM32Cube isn't an application at all, but a collection of files. You are free to use any IDE you want, under any operating system. Personally, I went with KDevelop on Linux, but I could easily have gone with Eclipse, Code::Blocks or even Visual Studio. What STMicroelectronics provide is a collection of C and header files, each one is crystal clear, and heavily commented. First of all, you start with the BSP files, Board Support Package. This is everything needed to boot the board up, and has access to low-level devices. Want to turn an LED on? Then the function BSP_LED_On() is what you are looking for. There are functions for the LEDs, the pushbuttons, and of course, the BSP version number itself.
In order to compile, you can use most compiler suites. For my tests, I used the GNU ARM compilers, and they work out of the box. It takes mere minutes to get a build environment up and running, while giving you something that isn't that easy to achieve; you get to choose your environment.
STMicroelectronics doesn't stop at the BSP level. There are HAL drivers for the peripherals, and there are a lot of them. DMA, I2C, SPI… Drivers that personally I don't want to develop, and there is no need, they are all there, documented, and ready to use. For a bare-bones developer like myself, this is perfect. Each peripheral is separated from the others, so you only include what you want.
Not everyone develops bare-bone systems, and some people will want an operating system of some sort to handle the hardware for them. The STM32Cube package comes with numerous examples, and some of them are designed for FreeRTOS, which fully supports the STM32F0 series.
My First Program
Reviewing boards isn't really the most emotional job ever. Yes, I'm thrilled to receive parcels, especially some cards that I'm really looking forward to, but that is normally about as far as it goes. Normally.
After playing about with the STM32F0 Discovery, I decided to create a small program, to see just how easy it is to do. With a MQ-2 smoke detector, a breadboard and a few wires, I created a small smoke detection system. I used a 433MHz radio system to send the data back to my computer, where I could analyse the data. In theory, when cooking, the smoke level would increase slightly, and I had even planned on possibly grilling something a little too much, just to see how the system reacted. So, one morning, about an hour before lunch, I went downstairs, installed the system in my kitchen, and went back upstairs. A little tweaking, and I started receiving raw data. Only something was wrong. The MQ-2 was connected to an ADC, and that value was slowly rising. That wasn't normal, so I opened up my IDE, and poured over the code. I couldn't find anything wrong, so I added some debug traces, and went downstairs to retrieve the faulty unit.
It wasn't faulty. There really was a fire in my kitchen. The device was picking up a spatula that had caught fire; one of the halogen hot plates was on, and I didn't notice it. Located immediately above the kitchen is my 5 month old son's bed, who was sleeping peacefully, blissfully unaware of what was happening. A few lines of code really can change your life.
Conclusions
The STMicroelectronics STM32F0 Discovery board is a very good board, but some people might be put off by the development chain. We have become too used to evaluation boards (or even Maker boards) that come with a complete software solution, but this isn't the case. These boards come with a complete solution, but the end user has to make his own chain. Personally, I find this great; it doesn't take long to get a development environment up and running, and free solutions are readily available. It also lets me use my own choice of tools, tools that I am used to, and that help me speed up the development phase.
The board itself is very well build; robust, and with easy access to I/O pins. The prototyping board is a nice addition, and once again lets you get full applications up and running faster.
The most impressive factor is the price itself, less than ten Euros for a Cortex-M0 evaluation board that lets you use every single pin of the chip.
This is an excellent board to learn ARM programming, so long as you have some experience with electronics. The lack of devices on the board itself means you will have to add them using a prototyping board, or a breadboard. The board is also robust enough for more demanding applications, and can easily be used as it is inside a car, house, or remote controlled vehicle, to name but a few.
The board can be purchased directly from Farnell's international site at here or, if you are in the UK, directly from here.