STM32 single-chip serial port one-click download circuit and operation method detailed

share picture

< img alt="Share pictures" src="/wp-content/uploads/images/hardware/motherboard/1626799313632.jpg" >

The storage media corresponding to the three boot modes of STM32 are all built-in chips. They are:
1) User flash memory = Flash built into the chip.
2) SRAM = The RAM area built into the chip is the memory.
3) System memory = A specific area inside the chip. A section of Bootloader is preset in this area when the chip leaves the factory, which is usually called ISP program. No one can modify or erase the content of this area after the chip leaves the factory, that is, it is a ROM area.

To understand the several startup modes of STM32. BOOT0 is connected to GND, BOOT1 is connected to GND. That is the normal startup mode, load the code from flash. And BOOT0 is connected to V3.3, BOOT1 is connected to GND. It is the ISP mode, that is, the serial port update code. Secondly, you need to understand the process of downloading the code of STM32 ISP. First, connect BOOT0 to V3.3, and then reset STM32. STM32 will load the ISP code (solidified and stored internally) , So as to enter the ISP mode. At this time, you can download the program through the serial port. Finally, let’s see how the one-click download is realized. From the schematic diagram, we can see that the RTS of the DB9 serial port controls BOOT0, and DTR controls RST. We want to achieve the download For the purpose, you must first let RTS pull BOOT0 (set BOOT0 to 1), and then let DTR control RST to low (STM32 is low-level reset). Then release RTS to high (stop reset), and then start serial download Code (BOOT0 can be high or low at this time). So we see that the connection process of mcuisp 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) release reset (release reset, but BOOT0 is high at this time, so enter ISP mode) start Connection…4, received: 1F (connection successful) successfully connected to the serial port COM0@230400bps, it took 437 milliseconds for DTR to stay high [It should be noted that DTR_N is the inverted level of DTR RTS_N is the inverted 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 downloading work. It is undoubtedly a perfect choice for those MCU control boards that only have serial ports.

Leave a Comment

Your email address will not be published.