DAP simulation downloading device supporting multi-power system
By designing a multi-functional CMSIS DAP simulation download device, the problems of poor compatibility and high development cost of MCU chip simulation downloaders are solved, automatic power switching and signal level conversion are realized, multi-power supply systems are supported, and USB-to-UART serial communication is integrated , only one USB and one cable can be used to achieve JTAG/SWD online debugging and serial communication, reducing costs and improving compatibility and convenience of use.
Patent Information
- Application Number
- CN202410807953.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-09-13
AI Technical Summary
Existing MCU chip simulation downloaders have poor compatibility, high development costs, and inconvenience to use. In particular, there are compatibility issues between chips and power systems from different manufacturers, and they need to occupy multiple USB interfaces for debugging and serial communication.
A multi-functional CMSIS DAP simulation download device is designed. It uses an adaptive module, a signal level conversion module and an interface module to realize automatic power switching and signal level conversion. It supports multiple power supply systems and integrates a USB to UART serial port. For communication, only one USB and one cable can be used to realize JTAG/SWD online debugging and serial communication.
It realizes online debugging and program downloading functions for almost all MCU chips, reduces costs, is automatically compatible with 5V and 3.3V power supplies, avoids power backflow problems, and improves compatibility and convenience of use.
Smart Images

Figure CN118642406A
Abstract
Description
Technical Field
[0001] The present invention relates to a code debugging and downloading tool for programmable devices such as MCU, DSP, FPGA, etc., and in particular to a multifunctional, low-cost CMSIS DAP online simulation downloading tool that supports SWD / JTAG communication protocol, USB to UART serial port communication, and multiple power supply systems. Background Art
[0002] When programming, debugging and downloading programs for MCU, DSP, FPGA and other devices, emulators and downloaders are indispensable tools. There are many types of emulators. The mainstream ones on the market are: ST-LINK, an emulator officially published by STMicroelectronics, which is mainly for STMicroelectronics STM8 and STM32 series chips and supports SWIM / JTAG / SWD downloads; ULINK, an emulator from ARM / KEIL, which only supports use on Keil software and supports JTAG / SWD downloads; J-Link, an emulator from German SEGGER, which supports SWIM / JTAG / SWD downloads.
[0003] The currently mainstream simulation downloaders JLINK, ULINK, and STLINK are not compatible with each other. For example, STLINK is mainly used for ST's STM8 and STM32 series chip development and only supports 3.3V power supply systems. When used on a 5V development board, there is a risk of power reverse supply and current backflow; ULINK mainly supports use on the Keil compiler and is incompatible with other compiler environments such as ADS and IAR; and JLINK's 20PIN JTAG interface provides power to the target board from pin 19, while other simulators mainly use pins 1 and 2 for power supply, and the hardware interface is incompatible. When in use, the target board needs to be powered separately for downloading.
[0004] The official simulation downloaders of the mainstream MCU chips currently in use are relatively expensive. In addition, due to the low compatibility among manufacturers, if MCU chips from different manufacturers are used in actual application development, it is necessary to purchase multiple downloaders to meet usage requirements, which also increases development costs.
[0005] During software development and actual debugging, it is usually necessary to perform online simulation debugging of the code and print test results through serial communication at the same time. Two USB cables are required to connect the emulator and the USB-to-serial tool respectively, thus occupying two USB ports of the computer. Especially when using a laptop, debugging and testing are inconvenient due to the limited USB port resources. Summary of the invention
[0006] To overcome the above-mentioned deficiencies of the prior art, the present invention provides a DAP simulation download device that supports multiple power supply systems. By cooperating with an adaptive module, a signal level conversion module, and an interface module, the problem that the existing simulator is difficult to be compatible with chips from different chip manufacturers is solved.
[0007] The present invention is achieved according to the following technical solutions: A DAP simulation download device supporting multiple power supply systems includes: an MCU module, a USB interface module, an LDO module, an adaptive module, a signal level conversion module, a debugging and serial communication interface module; wherein, The MCU module is connected to the peripherals via the USB interface module and is used for data conversion between the peripherals and the simulation download device and the target board; The USB interface module is connected to the peripheral device and the simulation download device respectively, and is used for data transmission between the peripheral device and the simulation download device; The adaptive module is connected to the LDO module and the debugging and serial communication interface module respectively, and is used to realize automatic switching of the power supply of the simulation download device according to the power supply of the target board, and to provide the power supply of the LDO module to the target board; The signal level conversion module is connected to the MCU module and the debugging and serial communication interface module respectively, and is used to perform unidirectional or bidirectional conversion of the power signal level between the simulation download device and the target board; The debugging and serial communication interface module is connected to the target board and the simulation download device respectively, and is used to realize online simulation debugging and serial communication at the same time.
[0008] As a further technical solution, the LDO module is also connected to the USB interface module and the MCU module to provide power to the simulation download device and the MCU module respectively.
[0009] As a further technical solution, the MCU module is also connected to a SWD firmware upgrade interface module for performing firmware upgrade and expansion on the MCU module.
[0010] As a further technical solution, the adaptive module includes two MOS tubes, wherein the drain of the NMOS tube is connected to the first power supply, the source is connected to the target board power supply, and the gate is connected to the drain of the PMOS tube; the source of the PMOS tube is connected to the second power supply, and the gate is connected to the target board power supply.
[0011] As a further technical solution, the first power supply is smaller than the second power supply.
[0012] As a further technical solution, the first power supply and the second power supply are both provided by LDO modules.
[0013] As a further technical solution, when the target board is powered by the second power supply, the PMOS tube and the NMOS tube are both turned off; when the target board is powered by the first power supply or the power is provided by the simulation download device, the PMOS tube and the NMOS tube are both turned on.
[0014] As a further technical solution, the signal level conversion module uses a diode to achieve unidirectional conversion of the level signal between the simulation download device and the target board.
[0015] As a further technical solution, the signal level conversion module uses a voltage-dropping resistor to achieve bidirectional conversion of level signals between the simulation download device and the target board.
[0016] As a further technical solution, the debugging and serial communication interface module is configured with 20 pins, which are respectively used for simulation debugging in SWD mode / JTAG mode and UART serial communication.
[0017] Compared with the prior art, the present invention has the following beneficial effects: 1. The circuit of the present invention is simple. Except for the MCU chip, simple MOSFET and diode discrete devices are used to realize it. The cost is extremely low, and it can meet the online debugging and program downloading functions of almost all MCU chips on the ARM platform. Compared with the simulation downloaders such as JLINK that use MCU chips, operational amplifier chips, multiple Level shifter chips, and multiple LDO power chips to realize online debugging, the present invention has the advantages of simple circuit and low cost.
[0018] 2. The present invention integrates a UART serial port in the JTAG / SWD interface, and only one USB and one flat cable are needed to simultaneously realize JTAG or SWD online debugging and downloading and serial communication debugging. Compared with existing embedded software and hardware development, the present invention has the advantages of supporting multiple communication protocols and being easy to use.
[0019] 3. The present invention is automatically compatible with 5V and 3.3V power supplies, and is also compatible with 1.8V and 3.3V power supplies. The signal automatically converts the level following the system power supply, and there is no problem of power backflow, which effectively improves the reliability and service life of DAPLINK. Compared with existing emulators, the present invention has the advantages of being compatible with chips from different manufacturers and supporting multiple power supply systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 Schematic diagram of the circuit structure of a DAP simulation download device supporting multiple power supply systems according to an embodiment of the present invention.
[0021] Figure 2 Schematic diagram of interface signals of a debugging and serial communication interface module according to an embodiment of the present invention.
[0022] Figure 3 Schematic diagram of SWD firmware upgrade interface signals according to an embodiment of the present invention.
[0023] Figure 4 FIG. 4 is a schematic diagram of an adaptive module circuit according to an embodiment of the present invention.
[0024] Figure 5 FIG. 4 is a schematic diagram of a unidirectional level conversion circuit according to an embodiment of the present invention.
[0025] Figure 6 Schematic diagram of a bidirectional level conversion circuit according to an embodiment of the present invention.
[0026] Figure 7 FIG. 4 is a schematic diagram of an adaptive module simulation circuit according to an embodiment of the present invention.
[0027] Figure 8 Schematic diagram of simulation effect of an adaptive module according to an embodiment of the present invention.
[0028] Fig. 9 FIG. 4 is a schematic diagram of a unidirectional level conversion simulation circuit according to an embodiment of the present invention.
[0029] Fig.10 FIG. 4 is a schematic diagram of a simulation effect of a unidirectional level conversion according to an embodiment of the present invention.
[0030] Fig.11 Schematic diagram of a bidirectional level conversion simulation circuit according to an embodiment of the present invention.
[0031] Fig.12 Schematic diagram of bidirectional level conversion simulation effect according to an embodiment of the present invention. DETAILED DESCRIPTION
[0032] Aiming at the current situation that the existing simulation downloaders have poor compatibility, high development cost and inconvenience in use, the present invention designs a multifunctional CMSIS-DAP simulation download device supporting multiple power supply systems. Firstly, it has high compatibility, low development cost, adapts to chips from different manufacturers, supports multiple power supply systems, can adapt to the power supply voltage of the target board MCU, can provide 3.3V or 5V power supply to the target board, and can provide a maximum current of 200mA. In actual use, the target board can download software in the powered or unpowered state, and can automatically be compatible with 5V and 3.3V levels during online debugging. Moreover, when the target board is powered on but the downloader is not powered on, there will be no risk of backflow current affecting the service life of the simulator or even causing damage. Secondly, it is easy to use, and the serial port is integrated in the 20PIN interface. Only one flat cable and one USB cable are needed to simultaneously connect the JTAG or SWD and serial port of the target board to the computer, and the online debugging of JTAG or SWD and the serial port communication functions are performed at the same time, so the debugging is very convenient.
[0033] The following will clearly and completely describe the technical solutions of various embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0034] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection, or mutual communication; it can be a direct connection, or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0035] like Figure 1 As shown, the present invention provides a DAP simulation download device supporting multiple power supply systems, including: an MCU module, a USB interface module, an LDO module, an adaptive module, a signal level conversion module, and a debugging and serial communication interface module.
[0036] The MCU module is connected to the peripherals via the USB interface module and is used for data conversion between the peripheral PC and the simulation download device and the target board.
[0037] Specifically, the MCU module contains a USB peripheral interface, a GPIO function interface, and a UART serial communication interface. The MCU module converts the USB protocol data from the peripheral PC into JTAG or SWD communication protocol data simulated by GPIO to achieve data downlink; and the JTAG or SWD communication protocol data of the MCU of the target board is simulated into USB protocol data through GPIO and finally uploaded to the PC.
[0038] Similarly, the MCU also implements bidirectional USB-UART serial port data conversion, allowing the target board MCU to communicate with the PC.
[0039] The USB interface module is connected to the peripheral PC and the simulation download device respectively, and is used for data transmission between the peripheral PC and the simulation download device.
[0040] The USB interface module is connected to the PC externally and to the LDO module inside the simulation download device to provide power and data transmission for the simulator. The DP and DN interfaces of the USB interface module are connected to the USB peripheral interface of the MCU module of the simulation download device, and the VBUS and GND interfaces of the USB interface module are connected to the LDO module to provide input power.
[0041] The LDO module provides power to the MCU module, and can also provide power to the target board through the 5V / 3.3V adaptive module.
[0042] The adaptive module is connected to the LDO module and the debugging and serial communication interface module respectively, and is used to realize automatic switching of the power supply of the simulation download device according to the power supply of the target board, and to provide the power supply of the LDO module to the target board.
[0043] As an implementation method, a 5V / 3.3V adaptive module is used to realize automatic switching between a 5V power supply and a 3.3V power supply.
[0044] When the target board is not powered on or powered by 3.3V, the simulation download device powers the target board or both are powered by 3.3V. When the target board is powered by 5V, the 5V / 3.3V adaptive module can automatically cut off the power supply path between DAPLINK and the target board to prevent the 5V voltage from flowing back to the simulation download device and affecting the reliability and life of the simulation download device.
[0045] It should be noted that the above adaptive circuit is also applicable to the level adaptive compatibility problem of MCU 3.3V and 1.8V power supply and signal. The power adaptive switching and level adaptive compatibility of multi-power supply system can be regarded as the scope covered by the present invention.
[0046] The signal level conversion module is connected to the MCU module and the debugging and serial communication interface module respectively, and is used for unidirectional or bidirectional conversion of the power signal level between the simulation download device and the target board.
[0047] The 3.3V signal level of the simulation download device and the 5V level signal required by the target board are converted unidirectionally or bidirectionally to improve the compatibility of the simulation download device. For example, the CLK signal, TDI signal, TDO signal of JTAG or SWD, TX and RX signals of UART need to be converted unidirectionally, while the SWDIO signal of SWD needs to be converted bidirectionally.
[0048] The debugging and serial communication interface module is connected to the target board and the simulation download device respectively, and is used to realize online simulation debugging and serial communication at the same time.
[0049] The signal interface definition of the debugging and serial communication interface module is as follows: Figure 2As shown in the figure, the UART-RX and UART-TX signals are integrated in the ARM standard interface definition, and the connection of the two communication interfaces is realized through a flat cable. It should be noted that the TAG / SWD and UART serial port functions are completely independent physically and can be used at the same time.
[0050] The MCU module is also connected to a SWD firmware upgrade interface, which can perform firmware upgrade expansion on the MCU module of the simulation download device. Figure 3 shown.
[0051] In one embodiment, a USB cable is used to connect the USB interface of the computer and the simulation download device, and the JTAG & SWD interface of the target board is connected to the JTAG & SWD interface of the simulation download device, such as Figure 2 The interface definition has been completed, that is, the connection of JTAG&SWD and UART interfaces, as well as the connection of the power interface, has been completed. After normal connection, the simulation download device lights up green, indicating that the simulation download device is working normally. If abnormal, the simulation download device lights up red.
[0052] When the target board is not powered by a separate power supply or uses a 3.3V power supply, the simulation download device powers the target board through the JTAG&SWD interface. At this time, the target board MCU and the simulation download device MCU share the same power supply system. When the target board uses a 5V power supply system, the external power backflow path is cut off.
[0053] The specific implementation method is as follows Figure 4 As shown in the figure, when the target board is not powered separately or is powered by 3.3V, Q2 PMOS is turned on, Q1NMOS is also turned on, and 3.3V voltage is used to power the target board through R1; when the target board is powered by 5V, Q2 is turned off, Q1 is also turned off, and the 5V voltage of the target board will not flow back to 3.3V, so there is no risk of damaging the simulation download device. This circuit realizes the automatic switching of 5V / 3.3V power domains, and there is no need to manually select the power supply.
[0054] For illustrative purposes only, the typical model of the Q1 N-channel MOSFET in the circuit diagram is LN2302BLT1G; the typical model of the Q2 P-channel MOSFET is BSS84.
[0055] In one embodiment, when the target board signal level is incompatible with the signal level of the emulation download device, the following is adopted: Figure 5The circuit shown in the figure realizes unidirectional level conversion. When the MCU of the simulation download device outputs a high level, VOUT is increased to about 4V, which meets the high level threshold of the 5V power supply system; when the MCU of the simulation download device outputs a low level, the VOUT voltage is clamped to about 0.7V by the D1 diode, which meets the low level threshold of the 5V power supply, thereby realizing unidirectional level conversion.
[0056] In one implementation, when bidirectional level conversion is required, such as a SWDDIO signal, the following may be used: Figure 6 The bidirectional level conversion circuit shown in the figure. The specific principle is that when the simulation download device is the input end, the target board outputs a 5V high level, and the simulation download device can receive a 5V high level (the MCU part IO of the simulation download device can withstand a 5V power supply). When the target board outputs a 0V low level, the MCU of the simulation download device receives a 0V low level. Conversely, when the target board is used as the input, the simulation download device outputs a 3.3V high level. Due to the voltage drop of the R6 resistor, the target board can receive a 3.3V+R6 voltage drop. The high level threshold of the 5V power supply system can be met by adjusting the R6 resistance value. When the simulation download device outputs a 0V low level, the voltage at the target board end is the R6 resistor voltage drop. The low level threshold requirement can be met by setting a suitable R6 resistor.
[0057] Through the above method, the connection of JTAG&SWD interface, UART interface and power supply system is realized, and the adaptation of 3.3V and 5V power supplies is realized, and the automatic compatibility of signal levels is also realized.
[0058] For illustrative purposes only, in the above circuit diagram: the typical model of D1 fast switching diode is 1N4148; the resistance of R1 is 2Ω; the resistance of R2 is 51 kΩ; the resistance of R3 is 2 kΩ; the resistance of R4 is 1.5 kΩ; the resistance of R5 is 1.5 kΩ; and the resistance of R6 is 330Ω.
[0059] Figure 7 and Figure 8 The schematic diagram of the adaptive module simulation circuit and the schematic diagram of the simulation effect are given respectively, among which, Figure 8 The blue waveform in the middle shows that when the external target board is not powered on, the target board power supply voltage is 3.3V. When the target board is powered on to 5V, the red waveform (the internal working voltage of the CMSIS-DAP debugger) maintains a stable 3.3V voltage before and after the target board is powered on, and there is no voltage increase. The green waveform shows that when the target board is powered on to 5V and the Q2 MOS tube is turned off, there is a small voltage fluctuation at the S pole of the MOS, but it is quickly blocked by the MOS shutdown and restored to 3.3V voltage, which will not affect the power supply of the CMSIS-DAP debugger.
[0060] Fig. 9 and Fig.10 The unidirectional level conversion simulation circuit and simulation effect diagram are given respectively. Fig.10 The red waveform in the middle is the data signal of the 5V power supply system converted into the data signal of the 3.3V power supply system, realizing the unidirectional level conversion of the data.
[0061] Fig.11 and Fig.12 The bidirectional level conversion simulation circuit and simulation effect diagram are given respectively. Fig.12 The red waveform in the middle is a 3.3V data signal converted into a green 3.6V data signal waveform to meet the level requirements of the 5V power supply system and achieve bidirectional level conversion.
[0062] In summary, the present invention has the following advantages: 1. The present invention solves the level compatibility problem of MCU 5V and 3.3V power supply and signal, realizes adaptive 5V and 3.3V power supply, does not need manual switching, and can prevent power backflow, thereby improving the compatibility and reliability of the product.
[0063] 2. The circuit method provided by the present invention is also applicable to the level adaptation compatibility problem of MCU 3.3V and 1.8V power supply and signal, and this application scenario also falls within the protection scope of this patent.
[0064] 3. The present invention integrates the USB to UART serial port function into the emulator, and can realize the online debugging and downloading of JTAG&SWD and the serial port debugging function of UART through only one USB cable and one flat cable, providing high convenience of use.
[0065] 4. The present invention realizes the emulator function of JTAG&SWD and the serial port function of UART by using only one MCU chip and a small number of discrete devices internally, and has a high cost advantage.
[0066] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.
Claims
1. A DAP simulation download device supporting multiple power supply systems, characterized in that: include: MCU module, USB interface module, LDO module, adaptive module, signal level conversion module, debugging and serial communication interface module; among them, The MCU module is connected to the peripherals via the USB interface module and is used for data conversion between the peripherals and the simulation download device and the target board; The USB interface module is connected to the peripheral device and the simulation download device respectively, and is used for data transmission between the peripheral device and the simulation download device; The adaptive module is connected to the LDO module and the debugging and serial communication interface module respectively, and is used to realize automatic switching of the power supply of the simulation download device according to the power supply of the target board, and to provide the power supply of the LDO module to the target board; The signal level conversion module is connected to the MCU module and the debugging and serial communication interface module respectively, and is used to perform unidirectional or bidirectional conversion of the power signal level between the simulation download device and the target board; The debugging and serial communication interface module is connected to the target board and the simulation download device respectively, and is used to realize online simulation debugging and serial communication at the same time.
2. A DAP simulation download device supporting multiple power supply systems according to claim 1, characterized in that: The LDO module is also connected to the USB interface module and the MCU module, and is used to provide power to the simulation download device and the MCU module respectively.
3. The DAP simulation download device supporting multiple power supply systems according to claim 1, characterized in that: The MCU module is also connected to the SWD firmware upgrade interface module for performing firmware upgrade and expansion on the MCU module.
4. The DAP simulation download device supporting multiple power supply systems according to claim 1, characterized in that: The adaptive module includes two MOS tubes, wherein the drain of the NMOS tube is connected to the first power supply, the source is connected to the target board power supply, and the gate is connected to the drain of the PMOS tube; the source of the PMOS tube is connected to the second power supply, and the gate is connected to the target board power supply.
5. A DAP simulation download device supporting multiple power supply systems according to claim 4, characterized in that: The first power source is smaller than the second power source.
6. A DAP simulation download device supporting multiple power supply systems according to claim 4, characterized in that: The first power supply and the second power supply are both provided by an LDO module.
7. A DAP simulation download device supporting multiple power supply systems according to any one of claims 4 to 6, characterized in that: When the target board is powered by the second power supply, the PMOS tube and the NMOS tube are both turned off; when the target board is powered by the first power supply or the power is provided by the simulation download device, the PMOS tube and the NMOS tube are both turned on.
8. The DAP simulation download device supporting multiple power supply systems according to claim 1, characterized in that: The signal level conversion module uses a diode to achieve unidirectional conversion of the level signal between the simulation download device and the target board.
9. The DAP simulation download device supporting multiple power supply systems according to claim 1, characterized in that: The signal level conversion module uses a voltage-dropping resistor to achieve bidirectional conversion of level signals between the simulation download device and the target board.
10. The DAP simulation download device supporting multiple power supply systems according to claim 1, characterized in that: The debugging and serial communication interface module is configured with 20 pins, which are respectively used for simulation debugging in SWD mode / JTAG mode and UART serial communication.
