Module upgrading method and system based on UART equipment and related equipment
By using the DMA transmission channel of UART equipment in wearable high-precision positioning products to upgrade module firmware, the problems of low upgrade efficiency and high failure risk in the existing technology are solved, and efficient and safe module firmware upgrades are achieved.
Patent Information
- Application Number
- CN202411387642.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-06
- Publication Date
- 2025-02-14
AI Technical Summary
When upgrading firmware to modules in wearable high-precision positioning products, the product shell needs to be removed and connected to the computer through flying wires. It is inefficient and easy to cause electrical characteristics failure, resulting in failure of firmware upgrades and increasing equipment damage. risk.
The module upgrade method based on the UART device is adopted, and the first UART device of the MCU is connected to the main controller, and the second UART device is connected to the module, and the firmware upgrade data is received and sent using the DMA transmission channel to realize the firmware upgrade of the module.
This method simplifies the upgrade process, improves upgrade efficiency, reduces the system CPU burden, and reduces the risk of device damage, avoiding hardware changes and additional hardware costs.
Smart Images

Figure CN119440574A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of firmware upgrade, and in particular to a module upgrade method, system and related equipment based on a Universal Asynchronous Receiver / Transmitter (UART) device. Background Art
[0002] At present, some wearable high-precision positioning products use a combination of a microcontroller unit (MCU) and a communication module (for example, a 5G module) to achieve high-precision positioning over the air interface. The MCU has functions such as motion sensing, module control, low power management, charging management, and switch control. The MCU and the module communicate and control through the pin connection of the UART device.
[0003] In the later product maintenance, it is generally necessary to upgrade the module firmware. However, since the UART device pins between the module and the MCU have been used by the MCU to control the module, if you want to use the UART device pins to connect the computer to upgrade the module firmware, you need to disassemble the product casing and connect the URAT device pins (PIN) to the computer. This is inefficient and can easily cause electrical characteristic failures that lead to firmware upgrade failures, putting the device at risk of becoming a "brick". Summary of the invention
[0004] The embodiment of the present application discloses a module upgrade method, system and related equipment based on a UART device, which are used to upgrade the firmware of the module. The upgrade method is simple and the upgrade efficiency is high, which can reduce the system CPU burden and improve the system operation efficiency.
[0005] In a first aspect, an embodiment of the present application discloses a module upgrade method based on a universal asynchronous receiver / transmitter (UART) device, which is applied to a microcontroller unit (MCU), wherein the MCU is connected to a main control machine via a first UART device, and the MCU is also connected to a module via a second UART device, and the method comprises:
[0006] In the firmware upgrade mode of the module, the module firmware upgrade data sent by the host control machine is received through a first direct memory access DMA transmission channel, wherein the first DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the first UART device, and the transmission direction is from the host control machine to the MCU;
[0007] The module firmware upgrade data is sent to the module through the second DMA transmission channel, so that the module performs firmware upgrade according to the module firmware upgrade data. The second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device, and the transmission direction is from the MCU to the module.
[0008] Optionally, after sending the module firmware upgrade data to the module through the second DMA transmission channel, the method further includes:
[0009] receiving a first upgrade response message sent by the module through a third DMA transmission channel, wherein the first upgrade response message indicates that the module completes the firmware upgrade according to the module firmware upgrade data, and the third DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the second UART device, and the transmission direction is from the module to the MCU;
[0010] The first upgrade response message is sent to the main control machine through a fourth DMA transmission channel, where the fourth DMA transmission channel is a DMA transmission channel established by the MCU based on a sending pin of the first UART device, and the transmission direction is from the MCU to the main control machine.
[0011] Optionally, before receiving the module firmware upgrade data sent by the host control machine through the first direct memory access DMA transmission channel, the method further includes:
[0012] Receiving a firmware upgrade instruction sent by the host control machine through the first DMA transmission channel, the firmware upgrade instruction instructing the MCU to perform the firmware upgrade mode setting;
[0013] The first pin of the general input / output port GPIO is connected to the firmware upgrade boot pin of the module and the output of the first pin is controlled, and the second pin of the GPIO is connected to the reset pin of the module and the output of the second pin is controlled to enter the firmware upgrade mode.
[0014] Optionally, after connecting a first pin of a general purpose input / output port GPIO to a firmware upgrade boot pin of the module and controlling the output of the first pin, and connecting a second pin of the GPIO to a reset pin of the module and controlling the output of the second pin to enter the firmware upgrade mode, the method further includes:
[0015] A second upgrade response message is sent to the host control machine through the fourth DMA transmission channel, wherein the second upgrade response message indicates that the firmware upgrade preparation has been completed.
[0016] Optionally, before receiving the firmware upgrade instruction sent by the host control machine through the first DMA transmission channel, the method further includes:
[0017] Initialize the first UART device to a DMA operating mode, and initialize the second UART device to a DMA operating mode.
[0018] Optionally, after initializing the first UART to a DMA device operating mode and initializing the second UART device to a DMA operating mode, the method further includes:
[0019] The first DMA transmission channel with a transmission direction from the main control machine to the MCU is established based on the receiving pin of the first UART device, the fourth DMA transmission channel with a transmission direction from the MCU to the main control machine is established based on the sending pin of the first UART, the second DMA transmission channel with a transmission direction from the MCU to the module is established based on the sending pin of the second UART, and the third DMA transmission channel with a transmission direction from the module to the MCU is established based on the receiving pin of the second UART.
[0020] In a second aspect, an embodiment of the present application discloses a module upgrade method based on a universal asynchronous receiver / transmitter (UART) device, which is applied to a host control machine, wherein the host control machine is connected to a microcontroller unit (MCU) through a first UART device, and the MCU is also connected to the module through a second UART device, and the method includes:
[0021] In the firmware upgrade mode of the module, obtaining module firmware upgrade data;
[0022] The module firmware upgrade data is sent to the MCU via a first direct memory access (DMA) transmission channel, wherein the first DMA transmission channel is a DMA transmission channel established by the MCU based on a receiving pin of the first UART device, and the transmission direction is from the host control machine to the MCU.
[0023] Optionally, after sending the module firmware upgrade data to the module through the first direct memory access DMA transmission channel, the method further includes:
[0024] receiving a first upgrade response message sent by the MCU through a fourth DMA transmission channel, wherein the first upgrade response message indicates that the module completes the firmware upgrade according to the module firmware upgrade data, wherein the module firmware upgrade data is sent by the MCU to the module through the second DMA transmission channel, and after the firmware upgrade is completed according to the module firmware upgrade data, the first upgrade response message is sent to the MCU through a third transmission channel;
[0025] The second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device, and the transmission direction is from the MCU to the module; the third DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the second UART device, and the transmission direction is from the module to the MCU; the fourth DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the first UART device, and the transmission direction is from the MCU to the main control machine.
[0026] Optionally, in the firmware upgrade mode of the module, before obtaining the module firmware upgrade data, the method further includes:
[0027] A firmware upgrade instruction is sent to the MCU through the first DMA transmission channel, and the firmware upgrade instruction instructs the MCU to set the firmware upgrade mode.
[0028] Optionally, after sending the firmware upgrade instruction to the MCU through the first DMA transmission channel, the method further includes:
[0029] A second upgrade response message sent by the MCU is received through the fourth DMA transmission channel, where the second upgrade response message indicates that firmware upgrade preparation has been completed.
[0030] In a third aspect, an embodiment of the present application discloses a module upgrade method based on a universal asynchronous receiver / transmitter (UART) device, which is applied to a module, wherein the module is connected to a microcontroller unit (MCU), and the MCU is connected to a host control machine via a first UART device, and is connected to the module via a second UART device, including:
[0031] In the firmware upgrade mode of the module, receiving module firmware upgrade data sent by the MCU through a second DMA transmission channel, where the second DMA transmission channel is a DMA transmission channel established by the MCU based on a sending pin of the second UART device, and the transmission direction is from the MCU to the module, and the module firmware upgrade data is received by the MCU from the host control machine through a first DMA transmission channel, and the first DMA transmission channel is a DMA transmission channel established by the MCU based on a receiving pin of the first UART device, and the transmission direction is from the host control machine to the MCU;
[0032] The firmware is upgraded according to the module firmware upgrade data.
[0033] Optionally, after performing the firmware upgrade according to the module firmware upgrade data, the method further includes:
[0034] A first upgrade response message is sent to the MCU through a third DMA transmission channel, wherein the first upgrade response message instructs the module to complete the firmware upgrade according to the module firmware upgrade data, and the third DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the second UART device, and the transmission direction is from the module to the MCU.
[0035] In a fourth aspect, an embodiment of the present application discloses an electronic device, the electronic device comprising a microcontroller unit MCU, a module, a first UART device and a second UART device, the MCU being connected to a main control machine via the first UART device, the MCU being connected to the module via the second UART device, and the electronic device further comprising:
[0036] a memory storing a computer program;
[0037] a processor coupled to the memory;
[0038] The processor calls the computer program stored in the memory to execute a module upgrade method based on a UART device as described in any one of the first aspect or any one of the third aspect.
[0039] In a fifth aspect, an embodiment of the present application discloses a main control machine, wherein the main control machine is connected to a micro control unit MCU through a first UART device, and the MCU is also connected to a module through a second UART device, and the main control machine includes:
[0040] a memory storing a computer program;
[0041] a processor coupled to the memory;
[0042] The processor calls the computer program stored in the memory to execute a module upgrade method based on a UART device as described in any one of the second aspects.
[0043] In the sixth aspect, an embodiment of the present application discloses a module upgrade system based on a universal asynchronous receiver / transmitter (UART) device, comprising: an electronic device and a main control machine, wherein the electronic device comprises a microcontroller unit MCU, a module, a first UART device and a second UART device, wherein the MCU is connected to the main control machine via the first UART device, and the MCU is connected to the module via the second UART device, wherein the MCU is used to execute the method described in any one of the first aspects, the main control machine is used to execute the method described in any one of the second aspects, and the module is used to execute the method described in any one of the third aspects.
[0044] In a seventh aspect, an embodiment of the present application discloses a computer-readable storage medium storing a computer program, which, when executed by a processor on an electronic device, implements the steps of the method described in any one of the first aspect or the steps of the method described in any one of the third aspect.
[0045] In an eighth aspect, an embodiment of the present application discloses a computer-readable storage medium storing a computer program, which implements the steps of any one of the methods described in the second aspect when the computer program is executed by a processor on a host control machine.
[0046] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0047] The MCU in the embodiment of the present application is connected to the main control machine through the first UART device, and is connected to the module through the second UART device. In the firmware upgrade mode of the module, the module receives the module firmware upgrade data from the main control machine through the first DMA transmission channel, and then sends the module firmware upgrade data to the module through the second DMA transmission channel. After receiving the module firmware upgrade data, the module performs firmware upgrade according to the module firmware upgrade data, wherein the first DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the first UART device, and the transmission direction is from the main control machine to the MCU, and the second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device; in the embodiment of the present application , the MCU can establish a first DMA transmission channel based on the receiving pin of the first UART device used to connect to the main control machine externally, and also establish a second DMA transmission channel based on the sending pin of the second UART device used to connect to the module internally, and then receive the module firmware upgrade data from the main control machine through the first DMA transmission channel, and forward the module firmware upgrade data to the module through the second DMA transmission channel. In this process, it is only necessary to connect the first UART device to the main control machine without changing the hardware. The first UART device and the second UART device are multiplexed through software settings, and a DMA transmission channel is established to transmit data. The upgrade method is simple and the upgrade efficiency is high, which can reduce the burden on the system CPU and improve the system operation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0049] Figure 1 A schematic diagram of the application principle of the module upgrade method based on the UART device disclosed in the embodiment of the present application;
[0050] Figure 2 A schematic diagram of an interactive process of a module upgrade method based on a UART device disclosed in Embodiment 1 of the present application;
[0051] Figure 3 This is a schematic diagram of the interactive process of the module upgrade method based on the UART device disclosed in the second embodiment of the present application;
[0052] Figure 4 This is a flow chart of a module upgrade method based on a UART device disclosed in Example 3 of the present application;
[0053] Figure 5 A schematic diagram of the setting flow of the DMA transmission channel in the module upgrade method based on the UART device disclosed in the embodiment of the present application;
[0054] Figure 6 A schematic diagram of the structure of the MCU disclosed in the embodiment of the present application;
[0055] Figure 7 A schematic diagram of the module structure of the main control machine disclosed in the embodiment of the present application;
[0056] Figure 8 A schematic diagram of the structure of the module disclosed in the embodiment of the present application;
[0057] Fig. 9 A schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application;
[0058] Fig.10 This is a schematic diagram of the structure of the main control machine disclosed in the embodiment of the present application. DETAILED DESCRIPTION
[0059] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0060] It should be noted that the terms "first", "second", "third" and "fourth" in the specification and claims of the present application are used to distinguish different objects rather than to describe a specific order. The terms "including" and "having" in the embodiments of the present application and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device including a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0061] like Figure 1 As shown, Figure 1 The schematic diagram of the application principle of the module upgrade method based on the UART device disclosed in the embodiment of the present application; Figure 1 In the embodiment, the module upgrade system based on UART device includes: electronic device 100 and main control machine 200, electronic device 100 includes MCU101, module 102, UART1 device 103 and UART2 device 104, MCU101 can be externally connected to main control machine 200 through UART1 device 103, and internally connected to module 102 through UART2 device 104. In addition, UART1 device 103 is connected to main control machine 200, MCU101 first establishes DMA channel 1 based on the receiving pin of UART1 device 103, establishes DMA channel 2 based on the sending pin of UART2 device 104, establishes DMA channel 3 based on the receiving pin of UART2 device 104, and then establishes DMA channel 4 based on the sending pin of UART1 device 103. When the module firmware is upgraded, the module firmware upgrade data sent by the host 200 is received through DMA channel 1, and the module firmware upgrade data is forwarded to the module 102 through DMA channel 2. After the module 102 completes the upgrade according to the module firmware upgrade data, it sends an upgrade response message to the MCU 101 through DMA channel 3, and the MCU 101 then forwards the upgrade response message to the host 200 through DMA channel 4, so that the host 200 confirms the completion of the firmware upgrade. Exemplarily, the module can be a wireless ultra-wideband pulse (UltraWide Band, UWB) module.
[0062] Exemplarily, the electronic device 100 may be a mobile device (such as a smart phone), a wearable device (such as a watch, a bracelet), etc. The electronic device 100 may also include a processor, an external memory interface, an internal memory, a universal serial bus (USB) interface, a charging management module, a power management module, a battery, an antenna, a mobile communication module, a wireless communication module, an inertial measurement unit (IMU) module, an audio module, a speaker, a receiver, a microphone, an earphone interface, a sensor module, a button, a motor, a camera, a display, and a subscriber identification module (SIM) card interface, etc. The sensor module may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0063] It is understood that the structure disclosed in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0064] Exemplarily, the main control machine 200 may be a computer, including a processor, an external memory interface, an internal memory, a USB interface, a charging management module, a power management module, a battery, an antenna, a mobile communication module, a wireless communication module, an audio module, a speaker, a receiver, a microphone, a headphone interface, buttons, a motor, a camera, a display, and a subscriber identification module (SIM) card interface, etc.
[0065] It is to be understood that the structure disclosed in the embodiment of the present application does not constitute a specific limitation on the main control machine 200. In other embodiments of the present application, the main control machine 200 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0066] Based on the above introduction, the embodiment of the present application discloses a module upgrade method, system and related equipment based on UART devices, which are used to achieve the purpose of reusing UART devices to upgrade module firmware through software settings, without affecting the original communication and control of the module by the MCU. The upgrade method is simple and the upgrade efficiency is high, which can reduce the system CPU burden and improve the system operation efficiency.
[0067] The embodiment of the present application discloses a module upgrade method based on a UART device, which is applied to an MCU, wherein the MCU is connected to a main control machine through a first UART device, and the MCU is also connected to a module through a second UART device. The method includes: in the firmware upgrade mode of the module, receiving the module firmware upgrade data sent by the main control machine through a first DMA transmission channel, wherein the first DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the first UART device, and the transmission direction is from the main control machine to the MCU; sending the module firmware upgrade data to the module through a second DMA transmission channel, so that the module performs a firmware upgrade according to the module firmware upgrade data, wherein the second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device, and the transmission direction is from the MCU to the module. In this embodiment, the MCU completes receiving the module firmware upgrade data from the main control machine and forwarding the module firmware upgrade data to the module by multiplexing the first UART device and the second UART device, thereby realizing the firmware upgrade of the module. The entire process does not require hardware adjustment, only software settings are required, and the operation is simple.
[0068] The embodiment of the present application also discloses a module upgrade method based on a UART device, which is applied to a main control machine, the main control machine is connected to a micro control unit MCU through a first UART device, and the MCU is also connected to the module through a second UART device. The method includes: in the firmware upgrade mode of the module, obtaining module firmware upgrade data; sending the module firmware upgrade data to the MCU through a first DMA transmission channel, the first DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the first UART device, and the transmission direction is from the main control machine to the MCU. In this embodiment, the main control machine sends the module firmware upgrade data to the MCU based on the first DMA transmission channel established by the MCU, and multiplexing the first UART device for data transmission during firmware upgrade can reduce the CPU burden.
[0069] The embodiment of the present application also discloses a module upgrade method based on a UART device, which is applied to a module, the module is connected to an MCU, and the MCU is connected to a main control machine through a first UART device, and is connected to the module through a second UART device, the method comprising: in the firmware upgrade mode of the module, receiving the module firmware upgrade data sent by the MCU through a second DMA transmission channel, the second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device, and the transmission direction is from the MCU to the module, the module firmware upgrade data is received by the MCU from the main control machine through the first DMA transmission channel, and the first DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the first UART device, and the transmission direction is from the main control machine to the MCU; firmware upgrade is performed according to the module firmware upgrade data. In this embodiment, the second UART device is reused between the MCU and the module for data transmission for firmware upgrade, which will not cause other communications between the MCU and the module, ensure the normal operation of the system, and can reduce the CPU burden and improve the processing efficiency of the system.
[0070] The technical solution of this application will be described in detail below through specific embodiments. Figure 2 As shown, Figure 2 The interactive flow diagram of a module upgrade method based on a UART device disclosed in the first embodiment of the present application is shown in FIG. Figure 2 In the method, the MCU is connected to the main control machine through the first UART device, and the MCU is also connected to the module through the second UART device. The method includes:
[0071] 201. In the firmware upgrade mode of the module, the host computer obtains the module firmware upgrade data.
[0072] In the embodiment of the present application, the main control machine will prepare module firmware upgrade data for upgrading the module, and in the firmware upgrade mode of the module, read the module firmware upgrade data for transmission.
[0073] It should be noted that, in the embodiment of the present application, a firmware upgrade of a module can be divided into at least one stage, and a set of module firmware upgrade data is used to complete the upgrade of one stage. In step 201, the module firmware upgrade data obtained can be a set of module firmware upgrade data corresponding to the upgrade of one stage.
[0074] 202. The host control machine sends module firmware upgrade data to the MCU through a first DMA transmission channel. The first DMA transmission channel is a DMA transmission channel established by the MCU based on a receiving pin of a first UART device, and the transmission direction is from the host control machine to the MCU.
[0075] The MCU is connected to the main control machine through the first UART device. In the embodiment of the present application, the MCU establishes a first DMA transmission channel based on the receiving pin of the first UART device, so that the main control machine can use the first DMA transmission channel to send the module firmware upgrade data to the MCU, and the first UART device is reused to transmit the module firmware upgrade data. The transmission process does not require the participation of the CPU. The CPU can process other services at the same time, thereby improving the CPU's business processing efficiency and not causing additional burden on the CPU.
[0076] 203. After receiving the module firmware upgrade data through the first DMA transmission channel, the MCU sends the module firmware upgrade data to the module through the second DMA transmission channel. The second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device, and the transmission direction is from the MCU to the module.
[0077] In step 203, the MCU establishes a second DMA transmission channel based on the sending pin of the second UART device, and then the MCU can forward the module firmware upgrade data to the module through the second DMA transmission channel. This transmission process no longer requires the CPU to participate. The MCU can also control the module through the interface of the second UART device at the same time, and realize the multiplexing of the second UART device by establishing a DMA transmission channel to complete the transmission of the module firmware upgrade data.
[0078] 204 . After receiving the module firmware upgrade data through the second DMA transmission channel, the module performs firmware upgrade according to the module firmware upgrade data.
[0079] After the MCU sends the module firmware upgrade data to the module, the module starts to upgrade the firmware. The module can be upgraded while receiving the module firmware upgrade data, or it can be upgraded only after receiving the module firmware upgrade data. This embodiment of the application does not limit this.
[0080] By implementing the above embodiment, the MCU can establish a first DMA transmission channel based on the receiving pin of the first UART device used for external connection to the main control machine, and also establish a second DMA transmission channel based on the sending pin of the second UART device used for internal connection to the module, and then receive the module firmware upgrade data from the main control machine through the first DMA transmission channel, and forward the module firmware upgrade data to the module through the second DMA transmission channel. In this process, it is only necessary to connect the first UART device to the main control machine without changing the hardware, thereby achieving the purpose of multiplexing the first UART device and the second UART device to perform module firmware upgrade through software settings, without affecting the original communication and control of the module by the MCU, and the upgrade method is simple and efficient, which can reduce the burden on the system CPU and improve the system operation efficiency.
[0081] See also Figure 3 , Figure 3 The interactive flow diagram of the module upgrade method based on the UART device disclosed in the second embodiment of the present application; Figure 3 In the method, the MCU is connected to the main control machine through the first UART device, and the MCU is also connected to the module through the second UART device. The method may include:
[0082] 301. In the firmware upgrade mode of the module, the host computer obtains the module firmware upgrade data.
[0083] In the embodiment of the present application, the main control machine will prepare module firmware upgrade data for upgrading the module, and in the firmware upgrade mode of the module, read the module firmware upgrade data for transmission.
[0084] It should be noted that, in the embodiment of the present application, a firmware upgrade of a module can be divided into at least one stage, and a set of module firmware upgrade data is used to complete the upgrade of one stage. In step 201, the module firmware upgrade data obtained can be a set of module firmware upgrade data corresponding to the upgrade of one stage.
[0085] 302. The host computer sends module firmware upgrade data to the MCU through a first DMA transmission channel. The first DMA transmission channel is a DMA transmission channel established by the MCU based on a receiving pin of a first UART device, and the transmission direction is from the host computer to the MCU.
[0086] 303. After receiving the module firmware upgrade data through the first DMA transmission channel, the MCU sends the module firmware upgrade data to the module through the second DMA transmission channel. The second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device, and the transmission direction is from the MCU to the module.
[0087] Optionally, after receiving the module firmware upgrade data, the MCU can verify the module firmware upgrade data according to the verification method pre-provided by the host control machine. If the verification passes, step 304 is executed; if the verification fails, the MCU sends a retransmission request to the host control machine through the fourth DMA transmission channel to request the host control machine to resend the module firmware upgrade data. The fourth DMA transmission channel is a DMA transmission channel established by the MCU based on the transmission pin of the first UART device, and the transmission direction is from the MCU to the host control machine. Through this implementation, the reliability of the module firmware upgrade can be ensured.
[0088] 304 . After receiving the module firmware upgrade data through the second DMA transmission channel, the module performs firmware upgrade according to the module firmware upgrade data.
[0089] Optionally, if the module firmware is successfully upgraded, step 305 is executed. If the firmware upgrade fails, the upgrade is stopped, and the hardware fault information is returned to the MCU through the third DMA transmission channel. Then the MCU returns the hardware fault information to the main control machine through the fourth DMA transmission channel, so that after receiving the hardware fault information, the main control machine can analyze the hardware fault information to obtain the specific cause and repair the hardware fault as soon as possible. The third DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the second UART device, and the transmission direction is from the module to the MCU. Through this implementation, hardware faults can be effectively checked and the reliability of the module firmware upgrade can be improved.
[0090] 305. The module sends a first upgrade response message to the MCU through the third DMA transmission channel. The first upgrade response message instructs the module to complete the firmware upgrade according to the module firmware upgrade data.
[0091] After the module completes the upgrade, it will feedback the first upgrade response message to indicate that the firmware upgrade is completed according to the module firmware upgrade data. The feedback first upgrade response message is sent to the MCU through the third DMA transmission channel, that is, the transmission of the first upgrade response message is also achieved by multiplexing the second URAT device, which can reduce the CPU burden.
[0092] It should be noted that the first upgrade response message is only used to indicate that the module has completed the current stage of firmware upgrade based on the current module firmware upgrade data. If the current stage is the last stage of the entire upgrade process, the entire firmware upgrade process ends. If it is not the last stage, the first upgrade response message can be used to notify the main control machine to continue sending the next set of module firmware upgrade data.
[0093] 306. After receiving the first upgrade response message through the third DMA transmission channel, the MCU sends the first upgrade response message to the main control machine through the fourth DMA transmission channel.
[0094] 307. After receiving the first upgrade response message through the fourth DMA transmission channel, the host control machine confirms that the upgrade is completed and ends this process.
[0095] It should be noted that, as introduced in step 305, after receiving the first upgrade response message, the main control machine determines that the current stage of the upgrade is completed. If it is the last upgrade stage of the entire upgrade process, the entire upgrade process is completed after the current process is completed. If it is not the last upgrade stage of the entire upgrade process, after the current process is completed, it re-enters step 301 to start the next stage of the upgrade.
[0096] By implementing the above embodiment, since the MCU establishes a first DMA transmission channel based on the receiving pin of the first UART device, establishes a fourth DMA transmission channel based on the sending pin of the first UART device, establishes a second DMA transmission channel based on the sending pin of the second UART device, and establishes a third DMA transmission channel based on the receiving pin of the second URAT device, the entire firmware upgrade of the module completes data communication through the DMA transmission channel, which improves the efficiency of the module firmware upgrade and reduces the burden on the CPU. Moreover, the entire firmware upgrade process does not require changing the hardware structure or adding additional hardware structures, and will not increase the hardware cost. The setting of the URAT device is only completed through software.
[0097] See also Figure 4 , Figure 4 This is a flow chart of a module upgrade method based on a UART device disclosed in Example 3 of the present application; Figure 4 In the method, the MCU is connected to the main control machine through the first UART device, and the MCU is also connected to the module through the second UART device. The method includes:
[0098] 401. The host control machine obtains a firmware upgrade instruction, where the firmware upgrade instruction instructs the MCU to set a firmware upgrade mode.
[0099] In the embodiment of the present application, before performing a firmware upgrade on the module, the host control machine needs to send a firmware upgrade instruction to notify the MCU to complete the firmware upgrade preparation.
[0100] 402. The host control machine sends the firmware upgrade instruction to the MCU through the first DMA transmission channel.
[0101] 403. After receiving the firmware upgrade instruction through the first DMA transmission channel, the MCU connects the first pin of the general input and output port GPIO to the firmware upgrade boot pin of the module and controls the output of the first pin, and connects the second pin of the GPIO to the reset pin of the module and controls the output of the second pin to enter the firmware upgrade mode.
[0102] For example, the MCU connects the module firmware upgrade Boot Pin via GPIO Pin1, and the MCU controls the output of this GPIO Pin1 to make it pull high or pull low, so that the module is in firmware upgrade mode. Pull high or pull low can be preset, pull high means output high level, and pull low means output low level.
[0103] The MCU also connects the module RESET_N Pin through GPIO Pin2. The MCU controls the output of this GPIO Pin2 to reset the module. After the module is reset and started, it is in firmware upgrade mode.
[0104] After the above-mentioned implementation mode is set, the module enters the firmware upgrade mode.
[0105] 404. The MCU sends a second upgrade response message to the host control machine through the fourth DMA transmission channel. The second upgrade response message indicates that the firmware upgrade preparation has been completed.
[0106] In step 404, the MCU enters into a firmware upgrade mode through setting, and sends a second upgrade response message to the host control machine through the fourth DMA transmission channel to notify the host control machine to proceed to the next step.
[0107] 405. After receiving the second upgrade response message through the fourth DMA transmission channel, the host control machine obtains module firmware upgrade data.
[0108] 406. The host control machine sends the module firmware upgrade data to the MCU through the first DMA transmission channel.
[0109] 407. After receiving the module firmware upgrade data through the first DMA transmission channel, the MCU sends the module firmware upgrade data to the module through the second DMA transmission channel.
[0110] 408 . After receiving the module firmware upgrade data through the second DMA transmission channel, the module performs firmware upgrade according to the module firmware upgrade data.
[0111] 409 . The module sends a first upgrade response message to the MCU through the third DMA transmission channel. The first upgrade response message instructs the module to complete the firmware upgrade according to the module firmware upgrade data.
[0112] 410. After receiving the first upgrade response message through the third DMA transmission channel, the MCU sends the first upgrade response message to the main control machine through the fourth DMA transmission channel.
[0113] 411. After receiving the first upgrade response message through the fourth DMA transmission channel, the host control machine confirms that the upgrade is completed and ends this process.
[0114] Among them, steps 405-411 are related to the Figure 3 The steps 301-307 shown are the same and will not be repeated here.
[0115] In the above embodiment, the MCU establishes a first DMA transmission channel based on the receiving pin of the first UART device, establishes a fourth DMA transmission channel based on the sending pin of the first UART device, establishes a second DMA transmission channel based on the sending pin of the second UART device, and establishes a third DMA transmission channel based on the receiving pin of the second UART device. The main control machine first sends a firmware upgrade instruction to the MCU through the first DM transmission channel, and the MCU connects the first pin of the GPIO to the firmware upgrade boot pin of the module, and then controls the output of the first pin of the GPIO, and connects the second pin of the GPIO to the reset pin of the module, and controls the output of the second pin of the GPIO, thereby completing the setting of the firmware upgrade mode and entering the firmware upgrade mode. Then, the data transmission in the firmware upgrade process is completed in the above-mentioned DMA transmission channels respectively. The DMA transmission channel is set by software to reuse the UART device, which will not affect other services performed by the MCU on the module.
[0116] See also Figure 5 , Figure 5 The present invention is a schematic diagram of the process flow of setting the DMA transmission channel in the module upgrade method based on the UART device disclosed in the embodiment of the present application; Figure 5 The method described above, the setting process method of the DMA transmission channel may include:
[0117] 501. The MCU initializes the first UART device to a DMA working mode, and initializes the second UART device to a DMA working mode.
[0118] In the embodiment of the present application, corresponding software is installed in the MCU, and through software settings, the first UART device is initialized to the DMA working mode, and the second UART device is initialized to the DMA working mode.
[0119] Optionally, initializing the first UART device to DMA working mode includes: enabling the clock of the first UART device, setting the baud rate of the first UART device, setting the trigger depth of the first UART device, and setting the sending and receiving of the first UART device to DMA mode; configuring DMA related parameters, including data storage speed and data storage address of DMA transmission.
[0120] Optionally, initializing the second UART device to DMA working mode includes: enabling the clock of the second UART device, setting the baud rate of the second UART device, setting the trigger depth of the second UART device, and setting the sending and receiving of the second UART device to DMA mode; configuring DMA related parameters, including data storage speed and data storage address of DMA transmission.
[0121] 502. The MCU establishes a first DMA transmission channel with a transmission direction from the main control machine to the MCU based on the receiving pin of the first UART device, and establishes a fourth DMA transmission channel with a transmission direction from the MCU to the main control machine based on the sending pin of the first UART; the MCU establishes a second DMA transmission channel with a transmission direction from the MCU to the module based on the sending pin of the second UART, and establishes a third DMA transmission channel with a transmission direction from the module to the MCU based on the receiving pin of the second UART.
[0122] In step 502, the receiving pin of the first UART device is selected as the data interface for receiving data from the host control machine, and a first DMA transmission channel with a transmission direction from the host control machine to the MCU is established. The sending pin of the first UART device is selected as the data interface for sending data to the host control machine, and a fourth DMA transmission channel with a transmission direction from the MCU to the host control machine is established. The sending pin of the second UART device is selected as the data interface for sending data to the module, and a second DMA transmission channel with a transmission direction from the MCU to the module is established. The receiving pin of the second UART device is selected as the data interface for receiving data from the module, and a third DMA transmission channel with a transmission direction from the module to the MCU is established.
[0123] It should be noted that the initialization operation performed in the above steps 501 and 502 can be performed before the MCU is connected to the main control machine, that is, the MCU sets the first UART device to the DMA working mode and the second UART device to the DMA working mode by default, and establishes the four DMA transmission channels shown in step 502, and then after the MCU is connected to the main control machine, the module firmware upgrade is completed directly based on the above four DMA transmission channels. Alternatively, after the MCU is connected to the main control machine, the above steps 501 and 502 are executed to establish four DMA transmission channels for completing the module firmware upgrade. Alternatively, after the MCU is connected to the main control machine, after receiving the firmware upgrade instruction, the above steps 501 and 502 are executed to establish 4 DMA transmission channels for completing the module firmware upgrade.
[0124] See also Figure 6 , Figure 6 It is a schematic diagram of the structure of the MCU disclosed in the embodiment of the present application; Figure 6 In the embodiment, the MCU is connected to the main control machine through the first UART device, and the MCU is also connected to the module through the second UART device. The MCU may include:
[0125] The first communication module 610 is used to receive the module firmware upgrade data sent by the host control machine through a first direct memory access DMA transmission channel in the module firmware upgrade mode, wherein the first DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the first UART device, and the transmission direction is from the host control machine to the MCU;
[0126] The second communication module 620 is used to send the module firmware upgrade data to the module through the second DMA transmission channel, so that the module performs firmware upgrade according to the module firmware upgrade data. The second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device, and the transmission direction is from the MCU to the module.
[0127] Optionally, after sending the module firmware upgrade data to the module through the second DMA transmission channel, the second communication module 620 is further used to receive a first upgrade response message sent by the module through a third DMA transmission channel, wherein the first upgrade response message indicates that the module completes the firmware upgrade according to the module firmware upgrade data, and the third DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the second UART device, and the transmission direction is from the module to the MCU;
[0128] The first communication module 610 is also used to send the first upgrade response message to the main control machine through the fourth DMA transmission channel. The fourth DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the first UART device, and the transmission direction is from the MCU to the main control machine.
[0129] Optionally, before receiving the module firmware upgrade data sent by the host control machine through the first direct memory access DMA transmission channel, the first communication module 610 is further used to receive a firmware upgrade instruction sent by the host control machine through the first DMA transmission channel, wherein the firmware upgrade instruction instructs the MCU to perform the firmware upgrade mode setting;
[0130] Combination Figure 6 The above-mentioned MCU also includes: a first setting module 630, which is used to connect the first pin of the general input and output port GPIO to the firmware upgrade boot pin of the module and control the output of the first pin, and connect the second pin of the GPIO to the reset pin of the module and control the output of the second pin to enter the firmware upgrade mode.
[0131] Optionally, after connecting the first pin of the general input / output port GPIO to the firmware upgrade boot pin of the module and controlling the output of the first pin, and connecting the second pin of the GPIO to the reset pin of the module and controlling the output of the second pin to enter the firmware upgrade mode, the first communication module 610 is also used to send a second upgrade response message to the main control machine through the fourth DMA transmission channel, and the second upgrade response message indicates that the firmware upgrade preparation has been completed.
[0132] Optional, combined Figure 6 As shown, the above-mentioned MCU also includes: a second setting module 640, which is used to initialize the first UART device to DMA working mode and initialize the second UART device to DMA working mode before receiving the firmware upgrade instruction sent by the main control machine through the first DMA transmission channel.
[0133] The third setting module 650 is used to establish the first DMA transmission channel with a transmission direction from the main control machine to the MCU based on the receiving pin of the first UART device, establish the fourth DMA transmission channel with a transmission direction from the MCU to the main control machine based on the sending pin of the first UART, establish the second DMA transmission channel with a transmission direction from the MCU to the module based on the sending pin of the second UART, and establish the third DMA transmission channel with a transmission direction from the module to the MCU based on the receiving pin of the second UART.
[0134] See also Figure 7 , Figure 7 Schematic diagram of the module structure of the main control machine disclosed in the embodiment of this application; Figure 7 In the main control machine shown, the main control machine is connected to the micro control unit MCU through a first UART device, and the MCU is also connected to the module through a second UART device. The main control machine may include:
[0135] The acquisition module 710 is used to acquire module firmware upgrade data in the module firmware upgrade mode;
[0136] The third communication module 720 is used to send the module firmware upgrade data to the MCU through the first direct memory access DMA transmission channel, where the first DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the first UART device, and the transmission direction is from the host control machine to the MCU.
[0137] Optionally, the third communication module 720 is further used to receive a first upgrade response message sent by the MCU through a fourth DMA transmission channel after sending the module firmware upgrade data to the module through the first direct memory access DMA transmission channel, the first upgrade response message indicating that the module completes the firmware upgrade according to the module firmware upgrade data, the module firmware upgrade data is sent by the MCU to the module through the second DMA transmission channel, and the first upgrade response message is sent to the MCU through the third transmission channel after completing the firmware upgrade according to the module firmware upgrade data; the second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device, and the transmission direction is from the MCU to the module; the third DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the second UART device, and the transmission direction is from the module to the MCU; the fourth DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the first UART device, and the transmission direction is from the MCU to the host control machine.
[0138] Optionally, the third communication module 720 is also used to, in the firmware upgrade mode of the module, before obtaining the module firmware upgrade data, the method also includes: sending a firmware upgrade instruction to the MCU through the first DMA transmission channel, and the firmware upgrade instruction instructs the MCU to set the firmware upgrade mode.
[0139] Optionally, the third communication module 720 is further used to receive a second upgrade response message sent by the MCU through the fourth DMA transmission channel after sending a firmware upgrade instruction to the MCU through the first DMA transmission channel, wherein the second upgrade response message indicates that the firmware upgrade preparation has been completed.
[0140] See also Figure 8 , Figure 8 Schematic diagram of the structure of the module disclosed in the embodiment of the present application; Figure 8 In the module shown, the module is connected to a microcontroller unit MCU, and the MCU is connected to a host control machine via a first UART device, and is connected to the module via a second UART device. The module may include:
[0141] The fourth communication module 810 is used to receive module firmware upgrade data sent by the MCU through the second DMA transmission channel in the firmware upgrade mode of the module, wherein the second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device, and the transmission direction is from the MCU to the module, and the module firmware upgrade data is received by the MCU from the main control machine through the first DMA transmission channel, and the first DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the first UART device, and the transmission direction is from the main control machine to the MCU;
[0142] The upgrade module 820 is used to perform firmware upgrade according to the module firmware upgrade data.
[0143] Optionally, the fourth communication module 810 is also used to send a first upgrade response message to the MCU through a third DMA transmission channel after the firmware upgrade is performed according to the module firmware upgrade data, wherein the first upgrade response message indicates that the module has completed the firmware upgrade according to the module firmware upgrade data, and the third DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the second UART device, and the transmission direction is from the module to the MCU.
[0144] See also Fig. 9 , Fig. 9 A schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application; Fig. 9 In the embodiment, the electronic device includes a microcontroller unit MCU910 and a module 920, the MCU is connected to the main control machine via a first UART device, the MCU is connected to the module via a second UART device, and the electronic device also includes:
[0145] A memory 930 storing a computer program;
[0146] a processor 940 coupled to the memory;
[0147] The processor 930 calls the computer program stored in the memory 940 to execute the attached Figure 2 -Attached Figure 5 All or part of the steps of any UART-based module upgrade method.
[0148] See also Fig.10 , Fig.10 Schematic diagram of the structure of the main control machine disclosed in the embodiment of the present application; Fig.10 As shown, the main control machine is connected to the micro control unit MCU through a first UART device, and the MCU is also connected to the module through a second UART device. The main control machine includes:
[0149] A memory 1010 storing a computer program;
[0150] a processor 1020 coupled to the memory;
[0151] The processor 1020 calls the computer program stored in the memory 1010 to execute the attached Figure 2 -Attached Figure 5 All or part of the steps of any of the above-described methods for upgrading a module based on a UART device.
[0152] The embodiment of the present application also discloses a module upgrade system based on a universal asynchronous receiver / transmitter (UART) device, comprising: an electronic device and a host control machine, wherein the electronic device comprises a microcontroller unit MCU, a module, a first UART device and a second UART device, wherein the MCU is connected to the host control machine via the first UART device, and the MCU is connected to the module via the second UART device, wherein the MCU is used to execute the attached Figure 2 -Attached Figure 5 All or part of the steps in any of the methods described, the host control machine is used to execute the attached Figure 2 -Attached Figure 5 All or part of the steps in any of the methods described, the module is used to perform the attached Figure 2 -Attached Figure 5 All or part of the steps in any one of the methods described in any one of the preceding claims.
[0153] The present application also discloses a computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor on an electronic device to implement the attached Figure 2 -Attached Figure 5 All or part of the steps in any of the methods described.
[0154] Another embodiment of the present application further discloses a computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor on a host control machine to implement the attached Figure 2 -Attached Figure 5 All or part of the steps in any of the methods described.
[0155] The present application also discloses a computer program product, which, when executed on a computer, enables the computer to execute Figures 2 to 5 Part or all of the steps of any disclosed method.
[0156] The embodiment of the present application also discloses an application publishing platform, which is used to publish a computer program product, wherein when the computer program product is run on a computer, the computer executes Figures 2 to 5Part or all of the steps of any disclosed method.
[0157] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, the storage medium including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0158] The above is a detailed introduction to a module upgrade method, system and related equipment based on a UART device disclosed in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A module upgrade method based on a universal asynchronous receiver / transmitter (UART) device, characterized in that: Applied to a microcontroller unit MCU, the MCU is connected to a main control machine via a first UART device, and the MCU is also connected to a module via a second UART device, the method comprising: In the firmware upgrade mode of the module, the module firmware upgrade data sent by the host control machine is received through a first direct memory access DMA transmission channel, wherein the first DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the first UART device, and the transmission direction is from the host control machine to the MCU; The module firmware upgrade data is sent to the module through the second DMA transmission channel, so that the module performs firmware upgrade according to the module firmware upgrade data. The second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device, and the transmission direction is from the MCU to the module.
2. The method according to claim 1, characterized in that After sending the module firmware upgrade data to the module through the second DMA transmission channel, the method further includes: receiving a first upgrade response message sent by the module through a third DMA transmission channel, wherein the first upgrade response message indicates that the module completes the firmware upgrade according to the module firmware upgrade data, and the third DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the second UART device, and the transmission direction is from the module to the MCU; The first upgrade response message is sent to the main control machine through a fourth DMA transmission channel, where the fourth DMA transmission channel is a DMA transmission channel established by the MCU based on a sending pin of the first UART device, and the transmission direction is from the MCU to the main control machine.
3. The method according to claim 2, characterized in that Before receiving the module firmware upgrade data sent by the host control machine through the first direct memory access DMA transmission channel, the method further includes: Receiving a firmware upgrade instruction sent by the host control machine through the first DMA transmission channel, the firmware upgrade instruction instructing the MCU to perform the firmware upgrade mode setting; The first pin of the general input / output port GPIO is connected to the firmware upgrade boot pin of the module and the output of the first pin is controlled, and the second pin of the GPIO is connected to the reset pin of the module and the output of the second pin is controlled to enter the firmware upgrade mode.
4. The method according to claim 3, characterized in that After the first pin of the general purpose input / output port GPIO is connected to the firmware upgrade boot pin of the module and the output of the first pin is controlled, and the second pin of the GPIO is connected to the reset pin of the module and the output of the second pin is controlled to enter the firmware upgrade mode, the method further includes: A second upgrade response message is sent to the host control machine through the fourth DMA transmission channel, where the second upgrade response message indicates that the firmware upgrade preparation has been completed.
5. The method according to claim 3 or 4, characterized in that: Before receiving the firmware upgrade instruction sent by the host control machine through the first DMA transmission channel, the method further includes: Initialize the first UART device to a DMA operating mode, and initialize the second UART device to a DMA operating mode.
6. The method according to claim 5, characterized in that After initializing the first UART to the DMA device working mode and initializing the second UART device to the DMA working mode, the method further includes: The first DMA transmission channel with a transmission direction from the main control machine to the MCU is established based on the receiving pin of the first UART device, the fourth DMA transmission channel with a transmission direction from the MCU to the main control machine is established based on the sending pin of the first UART, the second DMA transmission channel with a transmission direction from the MCU to the module is established based on the sending pin of the second UART, and the third DMA transmission channel with a transmission direction from the module to the MCU is established based on the receiving pin of the second UART.
7. A module upgrade method based on a universal asynchronous receiver / transmitter (UART) device, characterized in that: Applied to a main control machine, the main control machine is connected to a micro control unit MCU through a first UART device, and the MCU is also connected to a module through a second UART device, and the method includes: In the firmware upgrade mode of the module, obtaining module firmware upgrade data; The module firmware upgrade data is sent to the MCU via a first direct memory access (DMA) transmission channel, wherein the first DMA transmission channel is a DMA transmission channel established by the MCU based on a receiving pin of the first UART device, and the transmission direction is from the host control machine to the MCU.
8. The method according to claim 7, characterized in that After sending the module firmware upgrade data to the module through the first direct memory access DMA transmission channel, the method further includes: receiving a first upgrade response message sent by the MCU through a fourth DMA transmission channel, wherein the first upgrade response message indicates that the module completes the firmware upgrade according to the module firmware upgrade data, wherein the module firmware upgrade data is sent by the MCU to the module through the second DMA transmission channel, and after the firmware upgrade is completed according to the module firmware upgrade data, the first upgrade response message is sent to the MCU through a third transmission channel; The second DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the second UART device, and the transmission direction is from the MCU to the module; the third DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the second UART device, and the transmission direction is from the module to the MCU; the fourth DMA transmission channel is a DMA transmission channel established by the MCU based on the sending pin of the first UART device, and the transmission direction is from the MCU to the main control machine.
9. The method according to claim 8, characterized in that In the firmware upgrade mode of the module, before obtaining the module firmware upgrade data, the method further includes: A firmware upgrade instruction is sent to the MCU through the first DMA transmission channel, and the firmware upgrade instruction instructs the MCU to set the firmware upgrade mode.
10. The method according to claim 9, characterized in that After sending the firmware upgrade instruction to the MCU through the first DMA transmission channel, the method further includes: A second upgrade response message sent by the MCU is received through the fourth DMA transmission channel, where the second upgrade response message indicates that firmware upgrade preparation has been completed.
11. A module upgrade method based on a universal asynchronous receiver / transmitter (UART) device, characterized in that: Applied to a module, the module is connected to a microcontroller unit MCU, and the MCU is connected to a host control machine through a first UART device, and is connected to the module through a second UART device, including: In the firmware upgrade mode of the module, receiving module firmware upgrade data sent by the MCU through a second DMA transmission channel, where the second DMA transmission channel is a DMA transmission channel established by the MCU based on a sending pin of the second UART device, and the transmission direction is from the MCU to the module, and the module firmware upgrade data is received by the MCU from the host control machine through a first DMA transmission channel, and the first DMA transmission channel is a DMA transmission channel established by the MCU based on a receiving pin of the first UART device, and the transmission direction is from the host control machine to the MCU; The firmware is upgraded according to the module firmware upgrade data.
12. The method according to claim 11, characterized in that After performing the firmware upgrade according to the module firmware upgrade data, the method further includes: A first upgrade response message is sent to the MCU through a third DMA transmission channel, wherein the first upgrade response message instructs the module to complete the firmware upgrade according to the module firmware upgrade data, and the third DMA transmission channel is a DMA transmission channel established by the MCU based on the receiving pin of the second UART device, and the transmission direction is from the module to the MCU.
13. An electronic device, characterized in that: The electronic device comprises a microcontroller unit MCU, a module, a first UART device and a second UART device, wherein the MCU is connected to a main control machine via the first UART device, and the MCU is connected to the module via the second UART device, and the electronic device further comprises: a memory storing a computer program; a processor coupled to the memory; The processor calls the computer program stored in the memory to execute a module upgrade method based on a UART device as described in any one of claims 1-6 or any one of claims 11-12.
14. A host control machine, characterized in that: The main control machine is connected to the micro control unit MCU through a first UART device, and the MCU is also connected to the module through a second UART device. The main control machine includes: a memory storing a computer program; a processor coupled to the memory; The processor calls the computer program stored in the memory to execute a module upgrade method based on a UART device as described in any one of claims 7-10.
15. A module upgrade system based on a universal asynchronous receiver / transmitter (UART) device, characterized in that: include: An electronic device and a main control machine, wherein the electronic device comprises a microcontroller unit MCU, a module, a first UART device and a second UART device, wherein the MCU is connected to the main control machine via the first UART device, and the MCU is connected to the module via the second UART device, wherein the MCU is used to execute the method as described in any one of claims 1-6, the main control machine is used to execute the method as described in any one of claims 7-10, and the module is used to execute the method as described in any one of claims 11-12.
16. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor on an electronic device, the computer program implements the steps of the method according to any one of claims 1 to 6 or the steps of the method according to any one of claims 11 to 12.
17. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor on a host computer, the steps of the method according to any one of claims 7 to 10 are implemented.
Citation Information
Cited By
Data transmission method, device, equipment and medium
CN120768853A