Zamir's Board

Just record myself

View on GitHub
4 March 2021

Notes for beginning with STM32 - English

by Zamir

This is an English version of the article. I will also write an Chinese version, which provides some suggestions for Chinese readers.

Why

Two years ago, when I was working on my first Home Automation, I start to think that I should learn some embedded development. However I have been too busy (well, I know this is an execuse) and haven’t really do anything meanful till recently.

So when one of my friends asking if I can provide some information about embedded development recently, I start to think about this seriously. At this point, although I don’t have any experience with embedded development, I am not really a total newbie in this area. Inspired by The Best and Worst MCU SDKs, I decide to find the answer by first define some criteria from a newbie perspective, just to make it useful for my friends. Warning, this article is VERY SUBJECTIVE!

I hope:

And I’m currently only thinking about ARM MCUs, so this do reduced the category a lot. Note, the answer to some of these above really varies from country to country.

For the first point, the following comes up to my mind:

Unfornately, I did not find a lot of tutorials for the NXP LPC series. So it fails the 2nd criteria. And it’s complicated to code for cc26xx in Linux and MacOS, this fails the 3rd criteria. It’s hard to say which is better, nRF51/nRF52 or STM32. Both have a lot of tutorials, and they both can be developed under Linux or MacOS. However, I had a bad experience writing and running the blinky for a nRF51 in my very beginning (mostly because I am not using the official development kit along with there are not so many tutorials for writing code for nRF5 under Linux, which makes it harder for me as a newbie) while starting with STM32 is much easier than I expected, especially with the STM32CubeIDE. So I decide to suggest STM32 series.

Suggested materials for STM32

In my opinion, to learn embedded software development, one should firstly know how to read basic circuit. Then knowing common periphrals and their differences will make the learning process easier. As a newbie, a hands-on guide which begins with introducing IDE and the basic ideas will be much benefical. Last but not least, a development board is also required.

I write this section aiming at providing some basic information as a beginning to the friend who asked me. So it might not the best fit for you.

Learning to read circuit

You’d better to have some basic knowledge about circuits in order to learn embedded easier. Knowing how to read circuit should be sufficient in the beginning (at least this is the case for me). You can learn this in various ways. If you really want some suggestion, the episode 1 to 21 of Beginner Electronics can be a good reference. If you have subscription to LinkedIn Learning, there are a series of well organized courses there.

Learning to use the IDE

A good IDE makes the start much easier. In my case, I suggest to start with STM32CubeIDE to work with STM32 series. There is a really useful blog that I think beginners should read. If you are still not satisfied, or you want more challenge, STMicroelectronics also published MOOC - STM32CubeIDE basics on Youtube. It introduces not only the IDE itself, but also several lab exercises organized by different periphral.

Find the tutorial that fits you

Disclaimer: I did not read any of the suggested tutorial in details because I am still learning. Suggestions here are merely based on my first experience.

For English-speaking readers, if you want to read written materials, there are a lot of books available in Amazon. For example, “Programming with STM32: Getting Started with the Nucleo Board and C/C++” by Donald Norris. I read the samples in Kindle and feel it looks good, as it uses STM32CubeMX to generate the basic codes and also did some short explain on the functions generated by STM32CubeMX. If you prefer video tutorials, ST provided MOOC courses like MOOC - STM32CubeIDE basics and MOOC - STM32CubeMX and STM32Cube HAL basics can be a good choice.

Hardware

Why I only talk about hardware here? Because as a beginner, one might made mistakes in purchasing development boards. Sometimes it will result in a waste of money. So if you’ve already take a quick look at the learning materials you’ve chosen, you probably want to buy exactly the same development board, or at least have some basic ideas for how to choose a board.

If one of your friend happen to be familiar with embedded software development (in this case, STM32 development), you’d better ask him for suggestions before purchasing a board, as there are a lot of boards available in the market. Some of the boards requires standalone debugger tool and some have one integrated. If you are learning alone, I would suggest either use the development boards made by STMicroelectronics, or a board with learning materials.

STMicroelectronics have Nucleo development boards, which is affordable and easy to use. It already have the official debugger - ST Link embedded on board. So you can plug it into your computer and start playing with it immediately, without the need of leaning how to connect a debugger. However, it do not have a lot of on-board devices to play with. The more feature-rich choice is STM32 Discovery Kits, which ST call it a complete solution for evaluating STM32 MCUs. Of course there are other vendors building their own development kits. It’s really up to yourself when choosing development boards.

tags: