
1. Introduction
If you can use the 8051 and write in C, then there is no need to deliberately learn STM32.
What we need to consider is, what can I quickly achieve with STM32? Why use STM32 instead of 8051?
- Is it because the 51’s frequency is too low to meet computational demands?
- Is it because the 51 has too few pins to accommodate numerous peripherals’ I/O?
- Is it because the 51’s power consumption is too high, and the battery can’t hold up?
- Is it because the 51’s functionality is too weak, while you need to use SPI, I2C, ADC, DMA?
- Is it because the 51’s memory is too small while you need to store too much data?
When you need to use certain features of STM32 that the 51 cannot implement, then there is no need to learn STM32; you will directly look for methods to use specific aspects of STM32.
For example, using a network card with SPI protocol, serial communication, using RTOS, etc…
Quick Start Learning Steps
We assume that everyone has a certain understanding of STM32 books or documents. If not, please read the STM32 documentation immediately to acquire the most basic knowledge points.
Students with good English should not think they are great and can only read English documents. After all, you are Chinese, and what you are most familiar with and understand best is still Chinese.
The speed of reading English is still slower than reading Chinese; what we want is the shortest time, not to memorize all the details in a short time. Of course, if it is a paper, it is still beneficial to read the original English version.
When STM32 processors entered the domestic market, ST’s official (or third-party) promotion work was very good. They translated a large number of English documents to cater to the thinking of many domestic engineers.
When learning, focus on two important documents: “STM32F103xxx Reference Manual” and “STM32 Firmware Library User Manual”.
This is for students with ample time and energy; it is recommended to download the documents you need to consult for more information.
When reading the “STM32F103xxx Reference Manual”, be sure to note that you do not need to read it all—there is no time for that.
It is recommended to read selectively, but the first few chapters are a must-read. Pay attention to memory and bus architecture, power control, backup registers, reset and clock control, general and multiplexing function I/O, interrupts, and timers; the first few chapters must be read carefully.
The later chapters discuss specific functional module designs. If we use a certain module, we can read about that module.
For example, when using ADC, you need to read Chapter 10 on ADC. No other examples are given. I believe every beginner has their own research direction and judgment.
Reading the “STM32 Firmware Library User Manual” is mainly to simplify programming. STM32 provides us with a very good firmware function library, and we just need to call it.
Here I emphasize that when reading the “STM32 Firmware Library User Manual”, the first few chapters are also essential reading. For example, the naming conventions and coding rules in the first chapter of the documentation and library specifications are important to note.
The second chapter is the most critical; I hope everyone reads it thoroughly.
After Chapter 4, you can read according to your needs. In fact, the subsequent chapters describe what functions each module has and how to use each function.
Regarding the later chapters, it is recommended to be familiar with GPIO library functions, interrupt library functions, and reset and clock setting library functions, as they are often used.
The two documents mentioned above can provide a wealth of basic knowledge about STM32.
Set a Good Two-Week Introduction Plan
The so-called “introduction” here refers to being able to understand and master some commonly used STM32 peripherals. To truly master a processor, two weeks is not enough to explain anything. It can only be said that you have some understanding. However, this is sufficient for us beginners.
The so-called “two weeks” varies depending on each person’s schedule.
If you have ample time to study every day, you can set a goal to quickly become capable of simple STM32 development independently.
If you only have spare time to learn STM32, it is advisable to arrange your time according to your specific situation.
After all, if the planned time is too tight, it may lead to poor results, creating a vicious cycle that we want to avoid.
However, it is recommended that regardless of whether you have ample time or not, you must make a plan for yourself!
Here is a thought process listed for reference.
Step 1: Set up the environment, install the STM32 learning software, such as J-Link, Keil for ARM (MDK), ISP (if you need to download from the serial port).
Step 2: Get a development board, select some example HEX files, such as the LED example HEX file, download it to the STM32 development board, and observe the running situation.
In fact, the above two steps are just to familiarize yourself with the software tools you will use. This is the stage of getting a feel for it. We haven’t started learning STM32 yet!
Step 3: Prepare several commonly used documents, such as the “STM32 User Manual”, “STM32 Firmware Library User Manual”, etc., for regular reference.
Step 4: Start looking at how the examples are written, see how the examples are written, and whether you can modify the examples to achieve the desired effect?
Step 5: Should you try using RTOS?
Congratulations, at this point, you can independently carry out development. The last step is to set a goal (project) for yourself and implement it!
Again, the above is just a thought process for learning STM32, for everyone’s reference. Below are the key steps listed, hoping everyone can quickly get started.
Step 1: Familiarize Yourself with Debugging Software
For beginners, we need at least a few software: J-Link driver software, ST-Link driver, MDK (formerly Keil) software.
The goal of this step: to familiarize yourself with the debugging software, so that if there are issues with writing HEX, you can simply identify the problem and solve it independently.
Step 2: GPIO Programming
This is the first time you encounter programming with the firmware library, and you must grit your teeth and understand the firmware library. It is recommended that everyone try to use the firmware library.
Common ones include HAL library, LL library, etc.
Instead of avoiding the firmware library and writing code yourself—this can only happen during learning. In actual projects, there are hundreds or thousands of lines of code; how can you write them all yourself?
Using existing stable libraries is the way to go.
Programming GPIO itself is actually very simple:
-
Set the GPIO pin to input or output mode. When we write the code for lighting up, we generally set it to push-pull output mode.
-
Operate the registers, setting bits to 1 or clearing them—this step is already provided by the firmware library with dedicated functions GPIO_SetBits and GPIO_ResetBits, which we just need to call to set and clear the I/O.
-
Implement various patterns of LED blinking to familiarize yourself with the GPIO programming process.
The goal of this step: to familiarize yourself with the debugging software, so that if there are issues with writing HEX, you can simply identify the problem and solve it independently.
Step 3: Start a New In-Depth Study of STM32
After familiarizing yourself with the debugging software and GPIO programming, I believe you have a certain understanding of STM32.
You at least know how to use the STM32 firmware library to write code.
At this stage, you will encounter serial programming, TFT LCD screen driver programming, timer programming, serial peripheral interface SPI programming, memory programming, SD card and file system porting, USB read/write, UCOS porting, etc. If you have the energy, you can also study other peripherals.


Some Screenshots of E-books

【Complete Set of Hardware Learning Materials Collection】
