Single-chip microcomputer program downloading circuit free of cold start
By designing a USB interface circuit, a serial port download circuit, and a cold start-free circuit, the power-off and power-on operations of the microcontroller are automatically completed, solving the problem of cold start failure in microcontroller program download and realizing a stable and reliable program download process.
Patent Information
- Application Number
- CN202520016947.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2035-01-03
AI Technical Summary
In existing technologies, microcontroller program downloading requires a cold start, which leads to a high probability of download failure, reduces development efficiency, and increases costs.
A microcontroller program download circuit was designed, which includes a USB interface circuit, a serial port download circuit, and a cold start-free circuit. The CH340 series chip is used to realize data conversion and control signals, automatically complete power-off and power-on operations, and enter the download mode.
It achieves 100% successful download without manual cold start, ensuring the stability and reliability of program download, improving development efficiency and reducing costs.
Smart Images

Figure CN223582471U_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The utility model relates to electronic technical field, more specifically, relate to a kind of single-chip microcontroller program download circuit of free cold start. BACKGROUND
[0002] Single-chip microcontroller program download circuit refers to the hardware circuit for downloading the program (firmware) written to the internal memory of single-chip microcontroller (microcontroller). This process is also commonly known as programming or burning, and is a key step in single-chip microcontroller software development.
[0003] In the prior art, during the use of single-chip microcontrollers that require cold start (re-powering) to download programs, it was found that each time the program was downloaded, a cold start was required, i.e., the power was turned off or disconnected and then restarted. Often, the cold start could not enter the download mode, resulting in a download failure. This would inevitably reduce development efficiency and increase development costs. SUMMARY
[0004] To overcome the above-mentioned defects of the prior art, the utility model provides a single-chip microcontroller program download circuit without cold start, comprising:
[0005] The USB interface circuit, serial port download circuit and cold start-free circuit are electrically connected. The USB interface circuit is connected to the serial port download circuit, and the cold start-free circuit is connected to the serial port download circuit. The USB interface circuit is used for communication with a computer. The serial port download circuit is used for converting data transmitted by the computer into TTL serial port signals to communicate with the single-chip microcontroller and download programs. The cold start-free circuit is used to achieve the same effect as cold start to enter the download mode of the single-chip microcontroller.
[0006] Preferably, the USB interface circuit comprises: a pin B5 of a USB interface USB1 connected to one end of a resistor R1, the other end of the resistor R1 connected to a pin B12 of the USB interface USB1, a pin A1 of the USB interface USB1, one end of a resistor R2 and ground, the other end of the resistor R2 connected to a pin A5 of the USB interface USB1, a pin B4 of the USB interface USB1 connected to a pin B9 of the USB interface USB1, a pin A4 of the USB interface USB1, a positive electrode of a diode D01 and a pin A9 of the USB interface USB1, a negative electrode of the diode D01 connected to one end of a capacitor C01, and the other end of the capacitor C01 grounded.
[0007] Preferably, the serial port download circuit comprises: a pin 11 of a USB-to-serial controller U1 connected to one end of a capacitor C1, the other end of the capacitor C1 connected to a pin 10 of the USB-to-serial controller U1, and a pin 7 of the USB-to-serial controller U1 connected to one end of a capacitor C2.
[0008] Preferably, the cold start free circuit comprises: the source of PMOS Q1 is connected with the source of PMOS Q2, the gate of PMOS Q1 is connected with one end of resistor R6 and one end of resistor R7 respectively, the other end of resistor R7 is connected with one end of resistor R8 and grounded, the other end of resistor R8 is connected with one end of capacitor C3, one end of resistor R4 and the other end of resistor R6 respectively, the other end of resistor R4 is connected with the other end of capacitor C3 and the drain of PMOS Q2 respectively, and the gate of PMOS Q2 is connected with one end of resistor R5.
[0009] Preferably, the USB to serial controller U1 comprises any one of CH340, PL2303, CP2102 or FT232.
[0010] Preferably, the cold start free MCU program download circuit further comprises a debugging interface circuit.
[0011] Preferably, the cold start free MCU program download circuit further comprises an indicator light circuit.
[0012] Preferably, the cold start free MCU program download circuit further comprises a protection circuit.
[0013] Preferably, the debugging interface circuit comprises a JTAG interface or a SWD interface.
[0014] Preferably, the indicator light circuit comprises an LED indicator light.
[0015] The cold start free MCU program download circuit of the utility model has the following beneficial effects: by setting the USB interface circuit, the serial download circuit and the cold start free circuit connected by electricity, the USB interface is connected with the serial download circuit, the cold start free circuit is connected with the serial download circuit, the USB interface is used for communicating with the computer, the serial download circuit is used for converting the data transmitted by the computer into TTL serial signals to communicate with the MCU, download programs, and the cold start free circuit is used for realizing the equivalent effect of cold start to enter the download mode of the MCU; the step of manual cold start is omitted, the download is successful at 100%, a stable and reliable program download process can be realized, and strong support is provided for the development and application of the MCU. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical scheme in the embodiments of the utility model or the prior art, the following will briefly introduce the drawings needed to be used in the embodiment or the prior art description, and obviously, the drawings in the following description are only some embodiments of the utility model, and for those skilled in the art, other drawings can be obtained from the structures shown in the drawings without creative labor. The utility model will be further described below in combination with the drawings and embodiments, and in the drawings:
[0017] Figure 1 is the constituting block diagram of the single-chip microcomputer program download circuit of the utility model free from cold start;
[0018] Figure 2 is the USB interface circuit circuit diagram in the single-chip microcomputer program download circuit of the utility model free from cold start;
[0019] Figure 3 is the serial port download circuit circuit diagram in the single-chip microcomputer program download circuit of the utility model free from cold start;
[0020] Figure 4 is the free cold start circuit circuit diagram in the single-chip microcomputer program download circuit of the utility model free from cold start. DETAILED DESCRIPTION
[0021] The technical solutions in the embodiments of the utility model will be clearly and completely described below with reference to the drawings in the embodiments of the utility model. Obviously, the described embodiments are only part of the embodiments of the utility model, rather than all the embodiments. Based on the embodiments in the utility model, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the utility model.
[0022] It should be noted that if the embodiments of the utility model involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement condition, etc. between components in a certain specific posture (as shown in the drawings), and if the specific posture changes, the directional indications also change accordingly.
[0023] In addition, if the embodiments of the utility model involve descriptions of "first", "second", etc., the descriptions of "first", "second", etc. are only for description purposes, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features with "first", "second" can explicitly or implicitly include at least one of the features. In addition, the technical solutions of each embodiment can be combined with each other, but it must be based on the realization of the ordinary skilled in the art, and when the combination of technical solutions appears contradictory or unachievable, it should be considered that the combination of technical solutions does not exist, and is not within the protection scope required by the utility model.
[0024] Please refer to Figure 1 is the constituting block diagram of the single-chip microcomputer program download circuit of the utility model free from cold start. As Figure 1As shown in the utility model first embodiment provides the singlechip program download circuit of free cold start, at least includes, through the USB interface circuit, serial download circuit and free cold start circuit of electrical connection, USB interface circuit and serial download circuit are connected, free cold start circuit and serial download circuit are connected, USB interface circuit is used for with computer communication, serial download circuit is used to convert the data transmitted by computer into TTL serial signal and carries out communication with singlechip, downloads program, free cold start circuit is used to realize the equivalent effect of cold start to enter the download mode of singlechip.
[0025] Figure 2 It is the USB interface circuit circuit diagram in the utility model singlechip program download circuit of free cold start. Figure 2 As shown in the utility model, the pin B5 of USB interface USB1 is connected with one end of resistance R1, the other end of resistance R1 is connected with the pin B12 of USB interface USB1, the pin A1 of USB interface USB1, one end of resistance R2 and ground respectively, the other end of resistance R2 is connected with the pin A5 of USB interface USB1, the pin B4 of USB interface USB1 is connected with the pin B9 of USB interface USB1, the pin A4 of USB interface USB1, the anode of diode D01 and the pin A9 of USB interface USB1 respectively, the cathode of diode D01 is connected with one end of capacitor C01, and the other end of capacitor C01 is grounded.
[0026] The USB interface includes Type-A interface, Type-B interface, Mini USB interface, Micro USB interface and Type-C interface, etc.Type-A interface is usually used for connecting mouse, keyboard, U disk and other equipment.Type-A interface is rectangular in shape, and is widely used in host, notebook computer and various chargers.Type-B interface is relatively small, and is mainly used in printers, fax machines, scanners and other equipment.Mini USB interface is mainly used in early mobile hard drives, MP3 players and other equipment.Mini USB interface adds ID pin, supports OTG function, and allows data transmission between devices without host.Micro USB interface is widely used in early smart phones, such as Nokia, HTC and other brands.However, since it does not support positive and negative plugging, it is gradually replaced by Type-C interface.Type-C interface supports positive and negative plugging, which is convenient for users.Type-C interface has been widely used in Android phones and gradually replaced other types of USB interfaces.In addition, Type-C interface also supports high-speed data transmission and charging, as well as functions such as projecting mobile phones to televisions through conversion lines.
[0027] In specific implementation, the USB interface USB1 in the embodiment is selected as a Type-C interface, the Type-C interface is one of standard interfaces of modern computers, has the advantages of plug and play, fast transmission speed, convenient power supply and the like, and is widely applied in single-chip program download circuits.
[0028] Figure 3 is a serial port download circuit circuit diagram in the single-chip program download circuit without cold start of the utility model. Figure 3 As shown in the figure, the serial port download circuit comprises that the pin 11 of the USB-to-serial port controller U1 is connected with one end of the capacitor C1, the other end of the capacitor C1 is connected with the pin 10 of the USB-to-serial port controller U1, the pin 7 of the USB-to-serial port controller U1 is connected with one end of the capacitor C2.
[0029] The USB signal is a differential signal, which is composed of two signal lines of D+ and D-, and is incompatible with the TTL level. Therefore, the USB-to-serial port controller U1 is needed to convert the USB signal into the TTL level so as to be received by the single-chip microcomputer. In specific implementation, the USB-to-serial port controller U1 can but is not limited to comprise any one of CH340, PL2303, CP2102 or FT232. In the embodiment, the USB-to-serial port controller U1 is selected as CH340. The CH340 directly converts the USB signal into the TTL level and supports multiple baud rates, and is widely applied in single-chip microcomputer development boards.
[0030] The serial port is a kind of communication interface between the computer and the single-chip microcomputer, and has the characteristics of simple structure and high reliability.
[0031] The serial port communication interface comprises RXD (receiving pin) and TXD (transmitting pin). The two pins are connected with the serial port of the computer in a cross-connection mode, that is, the RXD of the computer is connected with the TXD of the single-chip microcomputer, and the TXD of the computer is connected with the RXD of the single-chip microcomputer, to realize full-duplex communication.
[0032] Figure 4 is a cold start-free circuit circuit diagram in the single-chip program download circuit without cold start of the utility model. Figure 4 As shown in the figure, the cold start-free circuit comprises that the source of the PMOS tube Q1 is connected with the source of the PMOS tube Q2, the gate of the PMOS tube Q1 is connected with one end of the resistor R6 and one end of the resistor R7 respectively, the other end of the resistor R7 is connected with one end of the resistor R8 and grounded, the other end of the resistor R8 is connected with one end of the capacitor C3, one end of the resistor R4 and the other end of the resistor R6 respectively, the other end of the resistor R4 is connected with the other end of the capacitor C3 and the drain of the PMOS tube Q2 respectively, and the gate of the PMOS tube Q2 is connected with one end of the resistor R5.
[0033] Cold start refers to that the single-chip microcomputer will detect whether there is a legal data stream when being powered on again, and if yes, enters the ISP (In-System Programming) download mode, otherwise executes the program. The cold start free circuit can automatically complete the power-off and power-on operation during the program download process, without manually switching the power supply.
[0034] In addition to completing the conversion from USB to TTL level, the CH340 chip can also control the power-off and power-on of the single-chip microcomputer by using its DTR (Data Terminal Ready) and RTS (Request To Send) pins. When the download button of the host computer is clicked, the levels of the DTR and RTS pins change, and this change can be used to trigger a signal to control the power-off of the single-chip microcomputer, and then power it on after a certain period of time.
[0035] In some optional implementations, the cold start free single-chip microcomputer program download circuit can also include a debugging interface circuit. The debugging interface circuit is used to connect external debuggers / programmers such as ST-Link, J-Link, etc. for program download and debugging. In specific implementation, the debugging interface circuit includes a JTAG interface or a SWD interface.
[0036] The JTAG interface requires at least 4 pins (TMS, TCK, TDI, TDO), plus an optional reset pin (nTRST). The JTAG interface provides full access to all functions of the single-chip microcomputer, including chip-level testing and debugging, but has many pins, occupying many I / O resources.
[0037] The SWD interface is a two-wire debugging protocol introduced by ARM, which only uses two lines of SWCLK (clock signal line) and SWDIO (bidirectional data line). The SWD interface has the advantages of few lines, high data transmission efficiency, simple protocol, etc., and is widely used in ARM Cortex series microcontrollers.
[0038] In some optional implementations, the cold start free single-chip microcomputer program download circuit can also include an indicator circuit. The indicator circuit is used to indicate the power state, download state, etc. of the single-chip microcomputer. The indicator circuit includes: an LED indicator. The LED indicator is connected to the cold start free single-chip microcomputer program download circuit of the utility model through a series resistor, and the LED indicator is lit when the single-chip microcomputer power is turned on or the download is successful.
[0039] In some alternative implementations, the cold start-free single-chip microcomputer program download circuit can further include a protection circuit. The protection circuit is used to prevent the single-chip microcomputer from being damaged due to insufficient power supply or reverse connection during the download process. In specific implementation, the protection circuit includes an anti-reverse diode or a current-limiting resistor. An anti-reverse diode is connected in series at the power supply to prevent reverse connection of the power supply. It should be noted that the forward voltage drop of the diode can cause insufficient power supply of the single-chip microcomputer, and therefore a diode with a small forward voltage drop or a 0-ohm resistor can be selected. A current-limiting resistor is connected in series at the power supply input or signal input to prevent excessive current from damaging the single-chip microcomputer.
[0040] The working principle of the cold start-free single-chip microcomputer program download circuit is as follows:
[0041] When the computer downloads the program for the single-chip microcomputer through the USB interface, the RTS# pin of the CH340 series chip is at a low level, the PMOS tube Q2 is turned on, the PMOS tube Q2 is turned on in an instant, the capacitor C3 is charged, which can be regarded as a short circuit, the gate G of the PMOS tube Q1 is at a high level, the PMOS tube Q1 is cut off, and 5V_IN is 0V. When the capacitor C3 is fully charged, the gate G of the PMOS tube Q1 is at a low level, the PMOS tube Q1 changes from the cut-off state to the conductive state, 5V_IN is connected with VCC, that is, 5V_IN realizes power-off and then power-on, that is, the cold start process is automatically realized by hardware.
[0042] The working process of the cold start-free single-chip microcomputer program download circuit is as follows:
[0043] (1) Level conversion: the USB signal or RS232 signal on the computer is converted into a TTL level signal recognizable by the single-chip microcomputer through the CH340 series chip.
[0044] (2) Serial communication: the computer communicates with the single-chip microcomputer through the serial port and sends program data to the single-chip microcomputer.
[0045] (3) Cold start-free control: the DTR and RTS pins or other control signals of the CH340 series chip are used to trigger the monostable timer circuit to generate a control signal to drive the relay to complete the power-off and power-on operation of the single-chip microcomputer.
[0046] (4) Program download: after the single-chip microcomputer is powered on again, it enters the ISP download mode to receive and store program data from the computer.
[0047] (5) State indication: the power supply state, download state and other information of the single-chip microcomputer are displayed through the indicator light circuit.
[0048] (6) Protection circuit: ensures that the single-chip microcomputer will not be damaged due to insufficient power supply or reverse connection during the download process.
[0049] The utility model discloses a through the design of above -mentioned embodiment, its beneficial effect is: through setting through electrical connection's USB interface circuit, serial download circuit and exempt from cold starting circuit, USB interface is connected with serial download circuit, exempt from cold starting circuit is connected with serial download circuit, and USB interface is used for with computer communication, and serial download circuit is used for converting the data of computer transmission into TTL serial port signal and singlechip communication, downloads procedure, and exempt from cold starting circuit is used for realizing the equivalent effect of cold starting to enter the download mode of singlechip, the step of manual cold starting is saved, and 100% download success can realize stable, reliable program download process, and provide strong support for the development and application of singlechip.
[0050] The utility model is described according to specific embodiments, but those skilled in the art should understand that various changes and equivalent replacements can be carried out without departing from the scope of the utility model. In addition, in order to adapt to specific occasions of the utility model technology, the utility model can be modified in many ways without departing from the protection scope. Therefore, the utility model is not limited to the specific embodiments disclosed herein, but includes all embodiments falling within the protection scope of the claims.
Claims
1. A microcontroller program download circuit that eliminates the need for cold starts, characterized in that, include: The microcontroller is electrically connected to a USB interface circuit, a serial port download circuit, and a cold-start-free circuit. The USB interface circuit is connected to the serial port download circuit, and the cold-start-free circuit is connected to the serial port download circuit. The USB interface circuit is used to communicate with a computer. The serial port download circuit is used to convert the data transmitted from the computer into a TTL serial port signal to communicate with the microcontroller and download the program. The cold-start-free circuit is used to achieve the same effect as a cold start, thereby entering the microcontroller's download mode.
2. The cold-start-free microcontroller program download circuit according to claim 1, characterized in that, The USB interface circuit includes: pin B5 of USB interface USB1 is connected to one end of resistor R1; the other end of resistor R1 is connected to pin B12 of USB interface USB1, pin A1 of USB interface USB1, and one end of resistor R2 and grounded; the other end of resistor R2 is connected to pin A5 of USB interface USB1; pin B4 of USB interface USB1 is connected to pin B9 of USB interface USB1, pin A4 of USB interface USB1, the positive terminal of diode D01, and pin A9 of USB interface USB1; the negative terminal of diode D01 is connected to one end of capacitor C01; and the other end of capacitor C01 is grounded.
3. The cold-start-free microcontroller program download circuit according to claim 1, characterized in that, The serial port download circuit includes: pin 11 of the USB to serial port controller U1 is connected to one end of capacitor C1, the other end of capacitor C1 is connected to pin 10 of the USB to serial port controller U1, and pin 7 of the USB to serial port controller U1 is connected to one end of capacitor C2.
4. The cold-start-free microcontroller program download circuit according to claim 1, characterized in that, The cold-start-free circuit includes: the source of PMOS transistor Q1 is connected to the source of PMOS transistor Q2; the gate of PMOS transistor Q1 is connected to one end of resistor R6 and one end of resistor R7; the other end of resistor R7 is connected to one end of resistor R8 and grounded; the other end of resistor R8 is connected to one end of capacitor C3, one end of resistor R4, and the other end of resistor R6; the other end of resistor R4 is connected to the other end of capacitor C3 and the drain of PMOS transistor Q2; and the gate of PMOS transistor Q2 is connected to one end of resistor R5.
5. The cold-start-free microcontroller program download circuit according to claim 3, characterized in that, The USB to serial port controller U1 includes any one of CH340, PL2303, CP2102 or FT232.
6. The cold-start-free microcontroller program download circuit according to any one of claims 1 to 5, characterized in that, The cold-start-free microcontroller program download circuit also includes a debugging interface circuit.
7. The cold-start-free microcontroller program download circuit according to any one of claims 1 to 5, characterized in that, The cold-start-free microcontroller program download circuit also includes an indicator light circuit.
8. The cold-start-free microcontroller program download circuit according to any one of claims 1 to 5, characterized in that, The cold-start-free microcontroller program download circuit also includes a protection circuit.
9. The cold-start-free microcontroller program download circuit according to claim 6, characterized in that, The debugging interface circuit includes a JTAG interface or an SWD interface.
10. The cold-start-free microcontroller program download circuit according to claim 7, characterized in that, The indicator circuit includes: LED indicator lights.