“Here is a detailed explanation of the one-key download circuit and operation method of the STM32 microcontroller serial port.
Here is a detailed explanation of the one-key download circuit and operation method of the STM32 microcontroller serial port.
The storage media corresponding to the three startup modes of STM32 are all built-in chips. They are:
1) User flash memory = Flash built into the chip.
2) SRAM = RAM area built into the chip, which is memory.
3) System memory = a specific area inside the chip. When the chip leaves the factory, a Bootloader is preset in this area, which is usually called the ISP program. The contents of this area cannot be modified or erased by anyone after the chip leaves the factory, that is, it is a ROM area.
To understand several boot modes of STM32.
BOOT0 is connected to GND, BOOT1 is connected to GND. That is the normal startup mode, loading code from flash. And BOOT0 is connected to V3.3, BOOT1 is connected to GND. It is ISP mode, which is the serial port update code.
Second, you need to understand the process of downloading the code from the STM32 ISP.
First, BOOT0 is connected to V3.3, and then reset STM32. STM32 will load the ISP code (solidified and stored internally), thus entering the ISP mode. At this time, the program can be downloaded through the serial port.
Finally, let’s see how the one-click download is achieved?
It can be seen from the schematic diagram that the RTS of the DB9 serial port controls BOOT0, and the DTR controls RST. To achieve the purpose of downloading, we must first let RTS pull up BOOT0 (set BOOT0 to 1), and then let DTR control RST to be low (STM32 is low-level reset). Then release RTS to high (stop reset), and then start serial port download code (BOOT0 can be high or low at this time).
So we see that the mcuisp connection process is:
DTR level is set high (3-12V), reset (DTR is connected to RST), RTS is set low (-3-12V), select to enter BootLoader (RTS is connected to BOOT0)… delay 100 milliseconds
RTS level becomes high (+3-+12V) to release reset (release reset, but BOOT0 is high at this time, so enter ISP mode)
Start connection…, Received: 1F (connected successfully), successfully connected on the serial port [email protected], it took 437 milliseconds.
DTR remains high[it should be noted that DTR_N is the inversion level of DTR, and RTS_N is the inversion level of RTS]
Note: This circuit does not need a USB to serial port chip, as long as an ordinary DB9 serial port can complete the program download work. It is undoubtedly a perfect choice for those microcontroller control boards that only have serial ports.