Some time ago, an interesting book “STM32 Microcontrollers for Beginners” from BTC Publishing appeared on the market. To my knowledge, this is the first widely released book that fully relies on the HAL libraries and is aimed at those who want to start their adventure with our favorite microcontrollers. For that reason, I was very curious to see what the author had to say.
I didn’t have to think long about buying the book for review because shortly after the release, the company Kamami offered to send me a set with the KA-NUCLEO-F411CEv2 development board, on which the examples in the book are based. Very kind of them, I appreciate it 🙂
KA-NUCLEO-F411CEv2 evaluation board
The PCB is modeled after the popular Arduino. The same connectors as in the Arduino Uno have been brought out for the user. Similarly, there’s an ST-Link programmer already on the development board. Thanks to it, you don’t have to worry about additional components. Working with the kit is therefore convenient and boils down to USB communication.
The PCB is populated with an STM32F411CE microcontroller. It’s an interesting choice, if only because it comes in a UFQFPN48 package, while classic Nucleo boards from ST are based on STM32F411RE in LQFP64 packages. What are the consequences? Namely, the user has fewer I/O pins at their disposal. Is that a drawback? In a way, yes, but admit it—how many beginner programmers need all the pins from a Nucleo right away? The limitation of outputs can have its advantage in the form of avoiding confusion in their configuration by a still inexperienced embedded developer. Especially since STM32s offer far more peripherals than an Arduino. Apart from the number of I/O, the chips don’t differ in anything special according to ST Finder.
So we have 512 kB of Flash memory, 128 kB of RAM, and the entire chip can run at a maximum frequency of 100 MHz. It’s a little beast for a beginner—and that’s great.
The book “STM32 Microcontrollers for Beginners”
The author of today’s book is Aleksander Kurczyk. He gets a plus from me right from the start because Olek studies at the university I graduated from myself—Wrocław University of Science and Technology. And on the same faculty, no less. He’s currently in his final semester, so I’m keeping my fingers crossed for his master’s defense 🙂 Interestingly, he is the author of numerous publications in magazines, including articles in “Elektronika Praktyczna.” I’m very pleased that there are still people who are eager to share their interests and skills with a wider audience. Olek is also a budding entrepreneur and, together with friends, runs a company in the IT industry.
Right from the introduction, the author clearly states who this book is for and what you will learn from it. If you are looking for a book that describes the C language from scratch, unfortunately this isn’t it. Same with explaining the ARM architecture and the components contained in SMT32. The author doesn’t needlessly confuse the reader at the very beginning.
Instead, the book guides you step-by-step through the tools and IDE provided by ST Microelectronics for their microcontrollers. Unfortunately for the author, at the time the book was published, ST bumped the STM32CubeMX version while redesigning the graphical appearance of the entire tool. Therefore, the screenshots from STM32CubeMX will not be identical to the latest version of the tool. However, anyone who can use a computer should cope just fine. These aren’t drastic changes, and from a project configuration standpoint, in my opinion it’s mostly cosmetic.
The IDE used in the book is Atollic TrueStudio, acquired by ST. By the way, I myself was so deeply sunk in the old SW4STM32 that I missed the fact that Atollic had been bought by ST. Today it’s the official and recommended environment. I’ve already made the switch 🙂
The second chapter is key for later work. In it, Olek presents the process of creating a project from scratch in the STM32CubeMX tool. He describes pin configuration in a simple way—in this case, GPIO. Of course, the perfect project for this is blinking an LED. I can’t imagine another “Hello World,” and that’s how it is in the book. After a moment, he expands the example with button handling, then smoothly in the next chapter moves on to handling PWM on the same LED. He spices up timer operations with gamma correction.
What I noticed when reading this book is that after the LED introduction, it immediately moves on to the UART interface. When I was learning microcontrollers, I remember that UART was relatively far back in my books. That was a serious mistake because it’s a very useful interface for both beginners and advanced programmers. During the learning stage, everything we do in the MCU can be printed to a terminal on the PC. Thanks to this, simple debugging or logging code behavior is pleasant. Kudos to the author for presenting a project with UART so early.
Only after a more elaborate example using UART with a GPS receiver does it move on to SPI and I2C. And here’s another surprise: the first SPI example is the addressable WS2812B LEDs, which are not controlled by this interface. The topic is tackled very similarly to one of my articles (link), but ultimately without using DMA.
Next, I would expect a trivial classic in the form of a shift register on SPI. However, here comes another surprise, because a TFT display is employed as an example of a “classic” use of the SPI interface! What’s more, with a touch panel, although it’s only resistive, while we’re surrounded everywhere by capacitive ones. The discussion of the touch panel is separated from handling the TFT, which adds clarity.
For the I2C bus, the projects are more classic examples: the popular BMP180 and BME280 pressure sensors. I’m trying to recall whether I’ve seen any spectacular I2C device and I can’t come up with one. In general, this interface serves precisely to handle various sensors.
The next element discussed is the analog-to-digital converter built into the STM32F411CE. Interestingly, the ADC measurement is taken on the MCU’s built-in analog temperature sensor, so doing the exercises doesn’t require connecting an external circuit. A plus here is showing two reading methods. The simplest, i.e., polling—‘manually’ querying the ADC for the converted value—and the more interesting DMA mode, i.e., automatically reading results without CPU involvement. It’s a pity that there’s only this much about DMA in the book, because it’s a very useful microcontroller component.
Near the end of the book, a project appeared that interested me the most. It’s WiFi realized on the ESP8266 module. These modules can indeed work as standalone microcontrollers, but they also perform great as a WiFi card. Especially the module variant used in the project. A simple project of modifying the color of the development kit’s built-in LED plants a seed of curiosity in me. I will definitely explore the ESP8266 further as a WiFi module for STMs.
In the next chapter, we see UART in action again. This time it’s the popular HC-06 Bluetooth module. Unfortunately, I greatly lament that the code listings in this chapter are incorrect. Every project file in the book is the same—the code for main.c has been duplicated. I hope this will be corrected in the next edition. By the way, I think printing many pages of code in a book is not the best idea. I much prefer inserting very short links to external materials, as Michał Szafrański does in his books. I also didn’t notice any mention in today’s discussed book of an online place with all the projects. A pity, because I myself eagerly read such projects in a “full” form. Maybe BTC Publishing will consider such an approach to codes/projects?
At the very end of the book, another surprise. The last section touches on real-time operating systems. In this case, it’s freeRTOS provided with STM32CubeMX. This is somewhat what all newbies on Arduino ask: “how to do two things at once?”. With the help of an RTOS it’s easier, but it can be dangerous, which the author fortunately mentions. It’s about race conditions, and Olek immediately presents two mechanisms to control this problem—semaphores and queues. Generally, the book is really just a teaser when it comes to RTOS, but sufficient enough to get interested in the topic and consult other sources and books.
Summary
The book isn’t thick, so it reads quickly. It has about 230 pages, where quite a large part is screenshots or code listings. It doesn’t drill deep into each discussed topic, so there’s no information overload. Someone who wants to move to SMT32 won’t be overwhelmed by the amount of information. In fact, this book gently introduces the ST ecosystem. It allows you to smoothly start working in STM32CubeMX and Atollic TrueStudio without obstacles.
This title will be good for you if you’re already somewhat familiar with the C language and microcontrollers, e.g., transitioning from Arduino. I’ll say right away that if you’re the type who likes to squeeze the maximum knowledge out of every topic, you may feel unsatisfied. In many places, the author takes shortcuts, discussing only what’s necessary to implement the described project.
If you already fluently create complex projects and write your own libraries, you won’t be satisfied with the reading, although not every advanced user has used a WiFi module, which, for example, interested me in this book. On the other hand, I don’t know if I would call myself that advanced 🙂 However, people at a high level of expertise should probably skip this book. After all, the title directly indicates who it’s for.
Would I recommend this book? Absolutely. It’s written in a simple language, which made it one of the more pleasant reads on programming for me. However, learning doesn’t end with this book. You have to keep learning—whoever stands still moves backward!
It’s worth keeping in mind that an e-book is also available. That’s for those who like to work with a book on screen with multiple monitors or who simply prefer digital versions.
Contest
Would you like to win the set I described today, i.e., the book “STM32 Microcontrollers for Beginners” along with the KA-NUCLEO-F411CEv2 board? The rules will be simple and will consist of a few steps:
- You must be a subscriber to the blog’s newsletter (content in Polish).
- Like my Facebook fanpage — Fanpage msalamon.pl
- Write a comment with the hashtag #konkurs under the Facebook post promoting the review, in which you write about how you are starting or want to start with microcontrollers — link
- Publicly share on your profile the post promoting the review — the same post as in item 3
- Let me know in a comment under this article how you liked the review and whether you’d like to see more of this type of material here.
Huh, it turned out to be a few points, but the prize is solid too, so I think it’s worth it 🙂 From among the people who meet the conditions, I will choose a winner with the most interesting answers and send them the book + board. What’s more! The company Kamami will additionally gift 3 people with the same set! In total, there will be four winners.
The contest lasts until just before the publication of the next post, i.e., until April 3, 2019 at 7:00 p.m. There’s plenty of time; you can think your answer through 🙂
P.S. I would like to give the books to people who are actually taking their first steps with STM32 microcontrollers or are at the early stages of learning. I would ask those hungry for free goodies to refrain from participating in the contest. It’s enough, for example, not to include the hashtag in your comment on Facebook, or to write on the blog that you don’t want to participate in the contest.



0 Comments