A USB interface circuit for automatically controlling an MCU to enter a DFU mode
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-07
- Publication Date
- 2026-08-11
AI Technical Summary
[0010]然而,上述的切换操作需要人工手动控制单刀双掷开关,实际操作时,可能存在人工忘记切换单刀双掷开关而导致宿主机未达到切换目的,而且长期切换单刀双掷开关,也需要对其进行维护和管理,增加了管控的成本
[0033]1.当USB接口与外部设备连接时,由外部设备为USB接口供电,USB接口通电时将电压传输至分压子模块和调压子模块中,分压子模块通电使BOOT0引脚接到高电压,而BOOT1接地,所以BOOT0=1,BOOT1=0,又MCU芯片通过调压子模块也获取到电压,所以MCU芯片通电并在自动控制模块的驱动下进入DFU模式中。而当USB接口断开与外部设备的连接时,分压子模块也处于断电状态,使得BOOT0引脚的电压为低电压,即BOOT0=0,BOOT1=0,所以此时只要给宿主机供电,则宿主机处于正常运行状态,但是MCU芯片未处于DFU模式中。由此可知,本申请通过设置自动控制模块能够自动切换MCU芯片的工作模式,而无需人工切换单刀双掷开关,也无需再维护频繁切换的单刀双掷开关,从而实现了降低管控MCU芯片的成本的目的;
Smart Images

Figure CN115757254B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of chip control, and in particular to a USB interface circuit for automatically controlling an MCU to enter DFU mode. Background Technology
[0002] MCU (Microcontroller Unit) is short for Microcontroller Unit. Microcontroller Unit can also be called a single-chip microcomputer. MCU chips provide a variety of firmware upgrade methods, such as ISP, ICP, and IAP.
[0003] USB (Universal Serial Bus) is short for Universal Serial Bus. Universal Serial Bus is a serial bus standard and a technical specification for input / output interfaces. It is used to standardize the connection and communication between the host machine and external devices, such as intelligent devices like memory, controllers, and processors.
[0004] For smart devices that integrate a USB interface and use an MCU chip as a processor, DFU (Device Firmware Upgrade) is a simpler firmware upgrade method compared to the aforementioned ISP, ICP, and IAP methods. Existing technologies include methods for driving the MCU chip into DFU mode such as... Figure 1 As shown:
[0005] The host device includes an MCU chip and a USB interface. The MCU chip includes BOOT0 and BOOT1 pins. When:
[0006] BOOT0=0, BOOT1=X, where X can be either high or low level, indicating that the host machine's main flash memory has been selected as the boot area, and the host machine is in normal working condition at this time;
[0007] When BOOT0=1 and BOOT1=0, it means that the host machine's system memory has been selected as the boot area, and the host machine's MCU chip enters DFU mode.
[0008] When BOOT0=1 and BOOT1=1, it means that SRAM is selected as the boot region. This connection method is used when debugging the host machine.
[0009] Therefore, in order to ensure the normal operation of the host machine and the switching between the host machine's MCU chip entering DFU mode, the existing technology has a high-voltage 3V power supply module and a low-voltage ground power supply module on the circuit board, and a single-pole double-throw switch is set on the BOOT0 pin. The single-pole double-throw switch can switch the BOOT0 to be powered by different power supply modules, while keeping the BOOT0 grounded for a long time, thereby realizing the above-mentioned switching function.
[0010] However, the above-mentioned switching operation requires manual control of the single-pole double-throw switch. In actual operation, there may be instances where the operator forgets to switch the single-pole double-throw switch, resulting in the host machine failing to achieve the switching purpose. Moreover, long-term switching of the single-pole double-throw switch also requires maintenance and management, increasing the cost of control. Summary of the Invention
[0011] This application provides a USB interface circuit for automatically controlling an MCU to enter DFU mode, which has the advantage of reducing the cost of the MCU chip.
[0012] The purpose of this application is to provide a USB interface circuit for automatically controlling an MCU to enter DFU mode.
[0013] The aforementioned objective of this application is achieved through the following technical solution:
[0014] A USB interface circuit for automatically controlling an MCU to enter DFU mode includes an MCU chip, a USB interface module, and an automatic control module.
[0015] The MCU chip includes a BOOT0 pin, a BOOT1 pin, and a VDD pin, with the BOOT1 pin grounded.
[0016] The USB interface module includes a USB interface for connecting to an external device, and the USB interface includes a first pin;
[0017] The automatic control module includes a voltage dividing submodule and a voltage regulating submodule connected in parallel;
[0018] One end of the voltage divider submodule is coupled to one end of the voltage regulator submodule, and the coupled node is also connected to the first pin;
[0019] The end of the voltage divider submodule furthest from the coupled node is connected to the BOOT0 pin;
[0020] The end of the voltage regulation submodule furthest from the coupled node is connected to the VDD pin.
[0021] By adopting the above technical solution, when the USB interface is connected to an external device, the external device supplies power to the USB interface. When the USB interface is powered on, the voltage is transmitted to the voltage divider and voltage regulation submodules. The voltage divider submodule is powered on, causing the BOOT0 pin to be connected to a high voltage, while BOOT1 is grounded, so BOOT0=1 and BOOT1=0. The MCU chip also obtains voltage through the voltage regulation submodule, so the MCU chip is powered on and enters DFU mode under the drive of the automatic control module. When the USB interface is disconnected from the external device, the voltage divider submodule is also powered off, causing the voltage of the BOOT0 pin to be low, i.e., BOOT0=0 and BOOT1=0. Therefore, as long as the host machine is powered on, the host machine is in normal operation, but the MCU chip is not in DFU mode. Thus, this application can automatically switch the operating mode of the MCU chip by setting an automatic control module, without the need for manual switching of the single-pole double-throw switch or maintenance of frequently switched single-pole double-throw switches, thereby achieving the goal of reducing the cost of controlling the MCU chip.
[0022] In a preferred embodiment, this application may be further configured such that: the voltage divider submodule includes a first fixed resistor R1 and a second fixed resistor R2, the first fixed resistor R1 and the second fixed resistor R2 are connected in series, and the node where the BOOT0 pin is connected to the voltage divider submodule is located between the first fixed resistor R1 and the second fixed resistor R2.
[0023] By adopting the above technical solution, since the voltage sent when the USB interface is powered on may not fall within the voltage range that the BOOT0 pin can withstand, the first fixed resistor R1 and the second fixed resistor R2 are used to adjust the voltage input to the BOOT0 pin, so as to ensure that the voltage received by the BOOT0 pin is within its withstand range, thereby ensuring the safe operation of the MCU chip.
[0024] In a preferred embodiment, this application may be further configured such that the voltage regulation submodule is a DC / DC chopper.
[0025] By adopting the above technical solution, since the voltage sent by the USB interface when it is powered on is not necessarily the operating voltage of the MCU chip, a DC / DC chopper is used to switch the voltage sent by the USB interface to the operating voltage of the MCU chip to ensure the normal operation of the MCU chip.
[0026] In a preferred embodiment, the present application may be further configured such that the MCU chip (1) is an STM32 chip, or an AT32 chip, or a chip capable of entering DFU mode by switching the levels of the BOOT0 pin and the BOOT1 pin.
[0027] By adopting the above technical solution, since the automatic control module can drive the STM32 chip or AT32 chip into DFU mode, that is, the automatic control module can adapt to various types of MCU chips, this application is practical.
[0028] In a preferred embodiment, this application may be further configured to include a PCB board, on which the MCU chip, USB interface module, and automatic control module are all mounted.
[0029] By adopting the above technical solution, the MCU chip, USB interface module and automatic control module are all set on the PCB board, which facilitates subsequent circuit expansion and also facilitates the overall maintenance and management of the MCU chip, USB interface module and automatic control module.
[0030] In a preferred embodiment, this application may be further configured such that the USB interface module also includes a USB cable connected to the USB interface.
[0031] By adopting the above technical solution, the USB cable provides a transmission channel for the USB interface to obtain power from external devices, enabling the USB interface to provide voltage to the MCU chip.
[0032] In summary, this application includes at least one of the following beneficial technical effects:
[0033] 1. When the USB interface is connected to an external device, the external device supplies power to the USB interface. When the USB interface is powered on, the voltage is transmitted to the voltage divider and voltage regulation submodules. The voltage divider submodule is powered on, causing the BOOT0 pin to be connected to a high voltage, while BOOT1 is grounded. Therefore, BOOT0=1 and BOOT1=0. The MCU chip also obtains voltage through the voltage regulation submodule, so the MCU chip is powered on and enters DFU mode under the drive of the automatic control module. When the USB interface is disconnected from the external device, the voltage divider submodule is also powered off, causing the voltage on the BOOT0 pin to be low, i.e., BOOT0=0 and BOOT1=0. Therefore, when the host machine is powered on, it is in normal operation, but the MCU chip is not in DFU mode. Thus, this application, by setting an automatic control module, can automatically switch the operating mode of the MCU chip without manually switching the single-pole double-throw switch or maintaining the frequently switched single-pole double-throw switch, thereby reducing the cost of controlling the MCU chip.
[0034] 2. The automatic control module of this application can drive various types of MCU chips into DFU mode, such as STM32 chips and AT32 chips, so this application is practical. Attached Figure Description
[0035] Figure 1 This is a prior art example diagram illustrating the background technology of this application.
[0036] Figure 2 This is a USB interface circuit diagram for automatically controlling the MCU to enter DFU mode, which is part of the embodiment of this application.
[0037] Figure 3 This is a diagram showing the USB interface circuit indicator light connection for the automatic control MCU entering DFU mode, as described in the embodiments of this application.
[0038] Explanation of reference numerals in the attached diagram: 1. MCU chip; 2. USB interface module; 21. USB interface; 22. USB cable; 3. Automatic control module; 31. Voltage divider module; 32. Voltage regulator module; 4. Information interaction module; 5. Indicator light. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0040] The following is in conjunction with the instruction manual appendix. Figure 1-3 The embodiments of this application will be described in further detail.
[0041] This application provides a USB interface circuit for automatically controlling an MCU to enter DFU mode, and this USB interface circuit is applied in a host machine. (See reference...) Figure 2 The USB interface circuit includes a PCB board and an MCU chip 1, a USB interface module 2, and an automatic control module 3 mounted on the PCB board. The PCB board supports the MCU chip 1, USB interface module 2, and automatic control module 3 to facilitate subsequent circuit expansion and overall maintenance of the MCU chip 1, USB interface module 2, and automatic control module 3. In this embodiment, the PCB board also establishes connections with other parts of the host machine, such as memory and display screens, enabling the USB interface circuit to cooperate with the host machine to complete tasks when the host machine is in normal operation.
[0042] In this embodiment, the type of MCU chip 1 is not limited, as long as it has the ability to enter DFU mode and can be driven into DFU mode by switching the voltages connected to the BOOT0 and BOOT1 pins. For example, MCU chip 1 can be an STM32 series chip or an AT32 chip from Arterion. For ease of explanation, this application uses an STM32 chip as an example. Specifically, the STM32 chip includes a BOOT0 pin, a BOOT1 pin, a VDD pin, a VSS pin, a USB_VBUS pin, a USB_DM pin, and a USB_DP pin.
[0043] The BOOT0 and BOOT1 pins are used to connect different voltages, thereby driving the STM32 chip into DFU mode or driving the host machine to which the STM32 chip belongs into normal operation.
[0044] BOOT0=0, BOOT1=X, where X can be either high or low level, indicating that the host machine's main flash memory has been selected as the boot area, and the host machine is in normal working condition at this time;
[0045] When BOOT0=1 and BOOT1=0, it means that the host machine's system memory is selected as the boot area, and the host machine's MCU chip 1 enters DFU mode.
[0046] When BOOT0=1 and BOOT1=1, it means that SRAM is selected as the boot region. This connection method is used when debugging the host machine.
[0047] In this embodiment, BOOT1 is grounded, i.e., BOOT1=0. Therefore, this embodiment does not consider the connection method when debugging the host machine. In other words, this application switches between the host machine being in normal operation and the host machine's MCU chip entering DFU mode.
[0048] The VDD and VSS pins are related to the power supply of the STM32 chip. The VDD pin is used to connect to the automatic control module 3 and obtain the operating voltage required by the STM32 chip from the USB interface module 2 through the automatic control module 3, while the VSS pin is grounded.
[0049] The USB_VBUS pin, USB_DM pin, and USB_DP pin are all connected to USB interface module 2.
[0050] USB interface module 2 includes a USB interface 21 and a USB cable 22. The USB interface 21 is connected to the USB cable via pins. Specifically, the USB interface 21 includes a first pin, a second pin, a third pin, a fourth pin, a fifth pin, and a sixth pin. The first pin is connected to both the USB_VBUS pin and the automatic control module 3, and is used to transmit voltage from the USB interface 21 to the automatic control module 3. Since the operating voltage of the USB interface 21 is 5V, the voltage transmitted by the first pin is 5V. The second pin is connected to the USB_DM pin, and the third pin is connected to the USB_DP pin. The second and third pins together provide a transmission channel for information transmitted between the STM32 chip and the USB interface 21. The fourth pin is connected to the host machine. The fifth pin is grounded. The sixth pin is a safety isolation interface. It should be noted that the USB interface 21 can be configured as a Type-C plug / socket, an Android plug / socket, or an iPhone plug / socket. Figure 2 In the diagram, the first pin, second pin, third pin, fourth pin, fifth pin, and sixth pin are represented by 1, 2, 3, 4, 5, and 6, respectively.
[0051] USB cable 22 connects to the first pin, second pin, and third pin. Specifically, USB cable 22 has wires corresponding to the first pin, second pin, and third pin, thereby enabling USB interface 21 to connect to external devices via USB cable 22. External devices include host computers or PCs (Personal Computers). External devices include information interaction module 4, which can be the USB interface of the external device. Information interaction module 4 includes a VBUS pin, a D- pin, a D+ pin, and a GND pin. Specifically, the VBUS pin is connected to the first pin, the D- pin is connected to the second pin, and the D+ pin is connected to the third pin. External devices and STM32 chips exchange information through information interaction module 4 and USB interface module 2, while the STM32 chip sequentially obtains the required voltage from the external device through automatic control module 3, USB interface module 2, and information interaction module 4.
[0052] The automatic control module 3 includes a voltage divider submodule 31 and a voltage regulator submodule 32, which are connected in parallel. The voltage divider submodule 31 includes a first fixed resistor R1 and a second fixed resistor R2 connected in series. One end of the first fixed resistor R1 is coupled to the voltage regulator submodule 32, and the other end of the first fixed resistor R1 is connected to one end of the second fixed resistor R2. The common point connecting the first fixed resistor R1 and the second fixed resistor R2 is connected to the BOOT0 pin, and the end of the second fixed resistor R2 furthest from the first fixed resistor R1 is grounded. In this embodiment, the resistance values of the first fixed resistor R1 and the second fixed resistor R2 are equal and both are 10KΩ, where K is the unit of resistance value.
[0053] The input terminal of the voltage regulating submodule 32 is coupled to one end of the first fixed resistor R1, and this coupling node is also connected to the first pin. The output terminal of the voltage regulating submodule 32 is connected to the VDD pin. In this embodiment, the voltage regulating submodule 32 uses a DC / DC converter. The specific type of DC / DC converter used is not limited here, as long as it can convert the DC voltage transmitted from the first pin into the operating voltage required by the STM32 chip. In this embodiment, the operating voltage of the STM32 chip is 3V, so the DC / DC converter is used to convert 5V to 3V before inputting it into the STM32 chip.
[0054] In summary, the implementation principle of the USB interface circuit for automatically controlling the MCU to enter DFU mode according to the embodiments of this application is as follows:
[0055] When MCU chip 1 needs to be upgraded: The external device's information interaction module 4 is connected to the host's USB interface 21 via USB cable 22. At this time, the external device supplies power to the USB interface 21. The first pin is connected to the node where the voltage divider module 31 and the voltage regulator module 32 are coupled. Therefore, the voltage on the USB interface 21 is transmitted to the voltage divider module 31. After being divided by the voltage divider module 31, the voltage is transmitted to the BOOT0 pin, allowing the BOOT0 pin to receive a high-level voltage within its tolerance range. Simultaneously, the voltage from the USB interface 21 is also transmitted to the voltage regulator module 32. The voltage regulator module 32 converts the received voltage into the operating voltage required by MCU chip 1 and inputs it into MCU chip 1, enabling MCU chip 1 to power on and start. Under the condition that BOOT0=1 and BOOT1=0, the MCU chip automatically enters DFU mode.
[0056] When the host machine is running normally: disconnect the external device and USB cable 22, and power on the host machine. Since the USB interface 21 does not obtain power from the external device, it cannot provide voltage to the voltage divider module 31. Therefore, BOOT0=0 and BOOT1=0. At this time, the host machine's main flash memory is selected as the boot area, and the host machine enters the normal working state. The operating voltage of MCU chip 1 can be provided by the host machine so that MCU chip 1 can cooperate with the host machine to complete the task to be completed.
[0057] Therefore, by setting up an automatic control module 3, this application eliminates the need to manually switch the single-pole double-throw switch to drive the MCU chip 1 into DFU mode. Instead, it can automatically drive the MCU chip 1 into different states during use, thus reducing the cost of managing the MCU chip 1.
[0058] In addition, to facilitate users in checking the current status of the host machine, an indicator light is provided in the USB interface module 2. The indicator light is connected to the first pin. When the USB interface 21 is powered on, the indicator light illuminates, indicating that the MCU chip 1 of the host machine has entered DFU mode. The connection between the indicator light and the USB interface module 2 is as follows: Figure 3 As shown, in Figure 3 In the diagram, indicator lights are represented by LEDs.
[0059] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the foregoing disclosed concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A USB interface circuit for automatically controlling an MCU to enter DFU mode, characterized in that: It includes an MCU chip (1), a USB interface module (2), and an automatic control module (3); The MCU chip (1) includes a BOOT0 pin, a BOOT1 pin, and a VDD pin, wherein the BOOT1 pin is grounded; The USB interface module (2) includes a USB interface (21) for connecting to an external device, and the USB interface (21) includes a first pin; The automatic control module (3) includes a voltage dividing submodule (31) and a voltage regulating submodule (32) connected in parallel; One end of the voltage divider submodule (31) is coupled to one end of the voltage regulator submodule (32), and the coupled node is also connected to the first pin; The end of the voltage divider submodule (31) away from the coupled node is connected to the BOOT0 pin; The end of the voltage regulating submodule (32) away from the coupled node is connected to the VDD pin.
2. The USB interface circuit for automatically controlling the MCU to enter DFU mode according to claim 1, characterized in that: The voltage divider submodule (31) includes a first fixed resistor R1 and a second fixed resistor R2, the first fixed resistor R1 and the second fixed resistor R2 are connected in series, and the node where the BOOT0 pin is connected to the voltage divider submodule (31) is located between the first fixed resistor R1 and the second fixed resistor R2.
3. The USB interface circuit for automatically controlling the MCU to enter DFU mode according to claim 1, characterized in that: The voltage regulation submodule (32) is a DC / DC chopper.
4. The USB interface circuit for automatically controlling the MCU to enter DFU mode according to claim 1, characterized in that: The MCU chip (1) is an STM32 chip, or an AT32 chip, or a chip that can enter DFU mode by switching the levels of the BOOT0 pin and the BOOT1 pin.
5. The USB interface circuit for automatically controlling the MCU to enter DFU mode according to claim 1, characterized in that: It also includes a PCB board, on which the MCU chip (1), USB interface module (2) and automatic control module (3) are all mounted.
6. The USB interface circuit for automatically controlling the MCU to enter DFU mode according to claim 1, characterized in that: The USB interface module (2) also includes a USB cable (22), which is connected to the USB interface (21).
Citation Information
Patent Citations
USB-to-UART circuit for MCU software upgrading
CN111090605A
Mode automatic switching circuit of mass production burning single-chip microcomputer
CN216133330U