Detailed explanation of STM32 startup method

Introduction to STM32 Minimal System

This article uses the STM32F103 core board as an example to illustrate the detailed description of the STM32 startup method. The minimum system board is often used by many makers in the market, including myself, but many novice customers will use the minimum system board to learn as soon as they get started. When encountering problems related to downloading programs, this is also the debugging skills that must be learned in the first step of getting started with STM32. The more you need to understand the relevant principles, the minimum system board I use is shown in the figure below.

insert image description here

Click image to buy

3 startup methods of STM32F103

insert image description here
From the above figure, we can see that there are three startup methods. The first one is that when we use JTAG or SWD to debug directly in MDK software, we can start it directly after downloading and running it in MDK software. The program has been downloaded, and the specific configuration is shown in the following figure.insert image description here

It must be noted that in this method, you must not connect the wrong wire when using it. When using the SW mode to debug the smallest system board, pay attention to select the SW mode, otherwise the chip will not be recognized. Due to the relatively expensive simulation debugging tools, the first sense of achievement in getting familiar with the board comes from programming a program to light up the LED (the first step of getting started with the microcontroller - Master Yideng ). We generally choose a cheap and smaller USB to TTL module to use the serial download method.
insert image description here

Click image to buy

Serial download start details

The serial port download method is to select the system memory to be selected as the startup area, and start from the system memory. The program function of this mode is set by the manufacturer. Generally speaking, this startup method is rarely used. The system memory is a specific area inside the chip. When the STM32 leaves the factory, a BootLoader is preset in this area by ST, which is the ISP program we often say. This is a ROM that cannot be modified after leaving the factory. Generally speaking, when we choose this startup mode, it is to download the program from the serial port, because the BootLoader provided by the manufacturer provides the firmware of the serial port download program, and the program can be downloaded to the system Flash through this BootLoader. But this download method requires the following steps:
Step1:
Set BOOT0 to 1, BOOT1 to 0, and then press the reset button, so that BootLoader can be started from the system memory
Step2:
Finally, with the help of BootLoader, download the program to the Flash through the serial port
Step3:
After the program download is completed, it is necessary to set BOOT0 to GND and reset it manually, so that the STM32 can be started from the Flash. As you can see, it is quite troublesome to download the program using the serial port. However, there are also some development boards on the market with automatic downloads that do not require you to plug and unplug the jumper cap yourself to try manually setting BOOT0 to 1. However, it is more expensive than the core board. It has a CH340-to-serial download chip onboard. At the same time, we need to remember the following picture. Some parameters are configured in the serial port download software written by others. We should pay attention to the configuration when using it. As shown below:insert image description here

Summarize

This section describes the theory and other knowledge points under its various startup methods. Friends who like to learn STM32 can pay attention. I will continue to update the STM32 column on the programming of STM32 microcontroller and the combination of theory to update the blog.

Guess you like

Origin blog.csdn.net/qq_42250136/article/details/122452658