STM32 supports emulator and serial port downloader. The content to be introduced belongs to serial port download, which is what we usually call ISP download.
We already know that manual ISP download program can be realized by controlling BOOT0 pin. When STM32 is powered on, it will automatically detect the level of BOOT0 pin. If it is high level, it will wait for the user to download the program; if it is low level, it will run the program previously downloaded to the microcontroller by the user. So we need to lead out the BOOT0 pin, and then control it to ground or connect to VCC to download or run the program. During the debugging process, we need to constantly control BOOT0, which is very troublesome. Then, automatic ISP should come into play.
Automatic ISP, connect BOOT0 directly to the ground, then the program will run every time the power is turned on, and as long as you click the "Download" button on the computer, the program will start downloading, and after the program is downloaded, it will start executing. To achieve this goal, you need to use the serial port handshake signals DTR and RTS.
The following is the free ISP download software developed by Shenzhen Pengyuan Diantong Technology Co., Ltd. Please see the part in the red box.
DTR is connected to RESET (reset pin) to control reset, and RTS is connected to BOOT0 to control program running or waiting for downloading.
The following describes how to use the USB to TTL chip to implement STM32 automatic ISP. The CH340 chip is shown in the figure below:
In CH340 chip, DTR and RTS pins are usually high level and low level is effective. Because the RESET pin of STM32 is also usually high level and low level is reset, DTR can be directly connected to RESET. However, BOOT0 is high level to download the program and low level to run the program, which is exactly the opposite of RTS, so we need to invert it and add an NPN transistor. The circuit is shown in the figure below:
ISP software selection:
After seeing the options in the above picture, some people will have doubts. In theory, it should be a low-level reset, and then a low-level entry into the BOOTLoader. However, one thing needs to be noted, the high and low levels mentioned here are for the original 9-pin serial port of the computer, that is, "232 level", and the USB to TTL chip we use is "TTL level", which is exactly the opposite. For this part, you can refer to another article I wrote: http://www.rationmcu.com/elecjc/947.html
The download process and results are shown in the following figure:
Note: When CH340 is just powered on, it takes a few seconds to stabilize. During this period, the DTR pin will become low twice or three times, which will cause the microcontroller to reset two or three times after powering on. After stabilization, it will not affect the program operation. If you do not want the microcontroller to reset several times after powering on, just disconnect DTR and RESET when powering on.
Previous article:assert_param and assert_failed in STM32 library functions
Next article:Why does the register address of ARM microcontroller differ by 4?
Recommended ReadingLatest update time:2024-11-16 15:30
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Classic pictures of the past
- How to implement ship mode in Li-ion battery designs
- TI E2E Chinese Community celebrates its 8th anniversary, with 8 technical collections for you who love technology!
- Several issues with the tps65130 chip
- Share the November 2018 STMicroelectronics-Shunde Motor Control Roadshow Conference Brochure
- My Journey of MCU Development (V)
- Why should we apply synchronous rectification technology?
- LTC3613DC/DC has a strange phenomenon, I hope the experts can answer it
- Understand the performance test of 18650 lithium battery - cycle test
- Sinlinx A64 Linux writes LED driver through device tree (with reference code, not tested)