A study on the implementation of one-click Download circuit for CH340 in STM32

Source: Internet
Author: User

Source: About CH340 The research of implementing one-key download circuit in STM32

when doing the STM32-based multi-function MP3 Player's topic, the program downloads this part to draw on the time Atom Development Board on the one-click Download circuit, uses the ch340g this chip design.

In the drawing PCB early schematic part, to adopt ch340g design of one-button download circuit is not very understanding, so spent some time to study this circuit.

One-click Download circuit referencing the right atom:we use the rts# and dtr# two output signals to control the BOOT0 and BOOT1 two pins of the STM32 IC to select the startup mode, as shown in the following table:when the program is written, we want to boot0=1,boot1=0. When the burn is finished we want to boot0=0,boot1=0 (this mode BOOT1 can be 0 can be 1, here we let BOOT1 pull low, that is, the whole process BOOT1 for L grounding, simplifying circuit design). Here we only need to consider the height of the BOOT0.

View STM32 's reference manuals, such as:

Note the first sentence below table 6: "after the system reset, the 4th rising edge of the SYSCLK, the value of the boot pin will be latched. ”

OK, on top of all the complaints, we can get:

1, the system power, BOOT0 need for L, enter the mode one. After power-on reset, on the 4th rising edge of the SYSCLK, the boot pin value will be latched into the main flash memory to execute the code we burned.

2, when we compile a good program, generate hex file. When burning hex file, BOOT0 need to be H, enter mode two. Then, the system must be reset once (since 1 knows that the system is power-up after the default code is executed, i.e. mode one), allowing the system to re-latch the boot pin. The system enters mode two and begins burning hex files. 3, after the completion of burning, we want the system to enter the mode one again, code execution. But the one-click Download circuit of the hot atom does not allow the system to complete the write program and reset the re-latch boot PIN entry mode one again. This should be the Mcuisp software to help us configure, after the completion of the burning write will be reported: "Success starts from 08000000." There is a passage in the reference manual:Understand it from another direction, so to speak: the primary flash memory is accessed from the address (0x0800 0000), whether the system is automatic or software configured, as long as the system pointer jumps toThe main flash memory address (0x0800 0000) starts executing code, so it's up to us. The above is the one-click Download circuit needs to implement the function, the atom brother helped us to design out. If you do not understand, you can refer to my explanation below. We need to note that: Ch340g Power after the dtr# and rts# are high, in the use of mcuisp burning software, we select "DTR low power, RTS high-level bootloader", ch340g IC in the actual operation of the pin change to "dtr# pull high, rts# pull low", that is, the software settings and the actual situation is to take the non-, contrary. draw a sequence diagram that is intuitive:

A study on the implementation of one-click Download circuit for CH340 in STM32 (RPM)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.