MCU download program circuit principle USB to serial port line, CH340, PL2303, MAX2

Publisher:SunshineHopeLatest update time:2015-10-10 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

        The first step in microcontroller software development is to download the program. If there is a problem with this step, then everything else will be out of the question. Today, I will give a detailed explanation of the problem of downloading programs for commonly used 51 microcontrollers. If there are any mistakes, I hope you can point them out!

Principle: TXD and RXD of the microcontroller are TTL level, so you have to convert other signals into TTL level. Only in this way can you download the program to the microcontroller successfully! Among them, chips such as CH340 and PL2303 directly convert USB signals into TTL level, while chips such as MAX232 convert TTL to RS232 signals or RS232 signals to TTL. Please see the following two common methods using this principle:

method one:       

        Please see Figure 1, which is a common single-chip computer download circuit. Among them, from ② to ⑥ are commonly used USB to serial port cables. The advantage of using this solution is that if your PC has a serial port (even very old machines do not have USB interfaces), you can directly download programs to the single-chip computer development board, because the development board using this method must have a serial port interface. Of course, if there is no serial port, you can only find a USB to serial port cable (the circuit principle is ② to ⑥ in the figure). It is recommended to use the USB to serial port cable of the CH340 chip instead of the USB to serial port cable of the PL2303, because the PL2303 is cheap, so there are many counterfeit parallel imports, which will cause the download circuit to be unstable or even unable to download normally. At the same time, the disadvantage of this solution is that a 9-pin serial port interface must be made on the circuit board, which is a bit troublesome.

Method Two: 

        Please see Figure 2, this is the single chip computer download circuit. The effect is very good! Its advantage is that you only need to find an ordinary USB2.0 cable (as shown in Figure 2②) to download, which is much easier than finding a USB to serial cable. At the same time, because the serial port 9-pin interface is replaced by a USB interface, the volume and weight of the circuit board are also reduced a lot, and it also looks more beautiful and fashionable, hehe. Here I emphasize one point: it is recommended to use the CH340 chip (CH340G can be used, it has a large pin spacing and is easy to weld) instead of PL2303. Moreover, the peripheral circuit of PL2303 is relatively complex, which also increases the difficulty of debugging the hardware circuit. Of course, it is understandable to use PL2303. The circuit structure of Figure 2 is much simpler than that of Figure 1, so does it mean that the performance of Figure 2 is better than that of Figure 1? It should be! The probability of problems with simple structures is of course smaller!

        It is worth mentioning that when using CH340, there are some issues that need to be paid attention to, because many students fail to download programs using CH340. There are three common reasons:

        1. Some of the CH340 pins supply power to the MCU, causing the MCU to not be completely powered off (downloading the program requires powering off and restarting), which results in the inability to download the program. Solution: Connect a diode in series with the TXD pin of the CH340 (Schottky diode is recommended) and a resistor of about 300 ohms in series with the RXD pin of the CH340. In this way, the MCU can be completely powered off and the problem is solved! ! (Special note: This situation does not apply to chips such as stm32)

        2. When some students power the microcontroller, in order to prevent the reverse connection protection circuit, they connect a diode in series at the power supply. Due to the forward voltage drop of the diode, the microcontroller is underpowered, which makes the program unable to download. Solution: Replace the diode with a 0 ohm resistor or use a diode with a very small forward voltage drop to ensure the normal power supply of the microcontroller. Problem solved! !

              3. Also pay attention to the TXD pin and RXD pin. The correct connection method is to connect the TXD pin of CH340 to the RXD pin of the microcontroller, and the RXD pin to the TXD pin of the microcontroller.

        Finally, a typical application diagram of CH340 (taken from STC's document) is attached for reference!

     Let me share the USB serial port download circuit of STM32

[Reprint] Principle of single-chip computer download program circuit USB to serial port line, CH340, PL2303, MAX2

Keywords:MCU Reference address:MCU download program circuit principle USB to serial port line, CH340, PL2303, MAX2

Previous article:About the Implementation of PID Algorithm of Single Chip Microcomputer
Next article:The principle and function of watchdog

Recommended ReadingLatest update time:2024-11-17 01:31

What is the difference between ARM and MCU?
1. Software This is probably the biggest difference. The operating system was introduced. Why was the operating system introduced? What are the benefits? 1) Convenience. This is mainly reflected in the later development, that is, developing applications directly on the operating system. Unlike a single-chip microcom
[Microcontroller]
51 microcontroller realizes 4 buttons to control 8 LED lights in four states
Circuit diagram Parts list Program (C language) #include reg51.h sbit p3_0=P3^0; sbit p3_1=P3^1; sbit p3_2=P3^2; sbit p3_3=P3^3; void delay(unsigned char i); void main() {    unsigned char ledctr;   P3=0xff;   while(1)   {     ledctr=P3; switch(ledctr) {   case 0xff:P1=0x00;break;   case 0xfe:P1=0xff;bre
[Microcontroller]
51 microcontroller realizes 4 buttons to control 8 LED lights in four states
51 MCU Study Notes 6 -- Timer Interrupt
1. Pin multiplexing From the schematic diagram, we can find that timer 0 (T0) and timer 1 (T1) are multiplexed functions of P3.4 and P3.5. When these two pins are configured as timer functions, the sensors (modules) connected to the pins will not be used normally, that is, the pins can only be used as one function at
[Microcontroller]
51 MCU Study Notes 6 -- Timer Interrupt
Using a single chip microcomputer to control the LED on and off
1. Experimental task As shown in the figure, monitor the switch K1 (connected to the P3.0 port), and use the light-emitting diode L1 (connected to the P1.0 port of the microcontroller) to display the switch status. If the switch is closed, L1 is on, and if the switch is open, L1 is off. 2. Circuit diagram   3. Ha
[Microcontroller]
Using a single chip microcomputer to control the LED on and off
What is the difference between Atmega16 and 51 microcontrollers? Analysis from both software and hardware aspects
1. Introduction to Atmega16 microcontroller Today our topic is microcontrollers. When you talk about microcontrollers, you may first think of the 51 microcontroller, and then use external digital circuits and analog circuits to control peripheral hardware, such as PWM, ADC, I2C, etc. So what are we talking about today
[Microcontroller]
What is the difference between Atmega16 and 51 microcontrollers? Analysis from both software and hardware aspects
Research on Fast Algorithm for Audio Frequency Spectrum Display Using Single Chip Microcomputer
1 Introduction In home theater, karaoke and other audio systems, real-time display of the spectrum of music signals will add a lot of color to the audio system. At present, most of the actual audio system products use the following two methods to realize audio spectrum display: one is to use hardware filter
[Microcontroller]
Design of Arbitrary Waveform Generator Based on CPLD and Single Chip Microcomputer
introduction In the design and testing of electronic sub-engineering, some complex signals with special requirements are often needed, requiring that their waveforms can be generated arbitrarily and the frequency can be easily adjusted. It is difficult for ordinary signal generators to meet the requirements, and t
[Test Measurement]
Design of Arbitrary Waveform Generator Based on CPLD and Single Chip Microcomputer
High-performance single-chip microcomputer ADuC824 and its application in intelligent sensors
1 Introduction The measurement and control system is developing towards automation and intelligence. This not only places higher and higher requirements on the accuracy, reliability and stability of sensors, but also requires sensors to have certain data processing capabilities and be able to perform automatic detect
[Microcontroller]
High-performance single-chip microcomputer ADuC824 and its application in intelligent sensors
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号