CN112905206A - Circuit upgrading method based on serial port - Google Patents

Circuit upgrading method based on serial port Download PDF

Info

Publication number
CN112905206A
CN112905206A CN202110262122.8A CN202110262122A CN112905206A CN 112905206 A CN112905206 A CN 112905206A CN 202110262122 A CN202110262122 A CN 202110262122A CN 112905206 A CN112905206 A CN 112905206A
Authority
CN
China
Prior art keywords
mcu
upgrading
circuit
firmware
slave
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110262122.8A
Other languages
Chinese (zh)
Inventor
阳传琦
雷正江
韩文忠
游贵泉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Shunxun Electronics Co ltd
Original Assignee
Shenzhen Shunxun Electronics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Shunxun Electronics Co ltd filed Critical Shenzhen Shunxun Electronics Co ltd
Priority to CN202110262122.8A priority Critical patent/CN112905206A/en
Publication of CN112905206A publication Critical patent/CN112905206A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1433Saving, restoring, recovering or retrying at system level during software upgrading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0002Serial port, e.g. RS232C

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a circuit upgrading method based on a serial port, wherein the circuit comprises at least one MCU (microprogrammed control unit), and the circuit upgrading method comprises the following steps: the external equipment is connected with a main MCU in the MCUs through the serial port; sending a port information packet through a serial port of the main MCU to inform the main MCU of firmware in the circuit needing to be upgraded; and the master MCU responds to the external equipment when verifying that the port information packet is correct, receives a data packet which is sent by the external equipment and is used for upgrading, and upgrades the self or firmware controlled by the self or transmits the data packet to a slave MCU in the MCU, so that the slave MCU upgrades the self or firmware controlled by the slave MCU. The invention has wide practicability and comprehensive upgrading function.

Description

Circuit upgrading method based on serial port
Technical Field
The invention relates to a circuit upgrading technology, in particular to a method for upgrading a cascade circuit through an upper computer.
Background
Firmware in the existing circuit is upgraded, the firmware to be upgraded needs to be put into a single chip microcomputer for upgrading, and once the circuit is formed, the upgrading is troublesome again.
In particular, in a cascaded circuit, that is, an interface with an external device is provided by a master MCU (micro control unit), the rest of slave MCUs or other firmware are mounted on the master MCU or each slave MCU, and the slave MCUs are further connected in multiple stages, which causes the upgrading of other firmware in the circuit to be very troublesome.
Disclosure of Invention
The invention provides a serial port-based circuit upgrading method, which aims to solve the technical problem that the firmware of a circuit is inconvenient to upgrade in the prior art.
The invention provides a serial port-based circuit upgrading method, wherein a circuit comprises at least one MCU (microprogrammed control unit), and the circuit upgrading method comprises the following steps:
the external equipment is connected with a main MCU in the MCUs through the serial port;
sending a port information packet through a serial port of the main MCU to inform the main MCU of firmware in the circuit needing to be upgraded;
and the master MCU responds to the external equipment when verifying that the port information packet is correct, receives a data packet which is sent by the external equipment and is used for upgrading, and upgrades the self or firmware controlled by the self or transmits the data packet to a slave MCU in the MCU, so that the slave MCU upgrades the self or firmware controlled by the slave MCU.
Further, the external device informs the host MCU of the firmware in the circuit that needs to be upgraded by informing the unique identification code of the firmware in the circuit.
Further, the unique identification code of the firmware in the circuit is composed of the type number of the firmware and the port numbers of all the front-stage MCUs connected with the firmware.
Further, when the external device informs the main MCU that the firmware in the circuit that needs to be upgraded is the main MCU or a firmware connected to the main MCU, the method includes the following steps:
the external equipment sends a data information packet to the main MCU and informs the main MCU of the storage initial address and the size of the data packet for upgrading;
the main MCU responds to external equipment when verifying the correctness of the data information packet, and erases corresponding storage areas according to the firmware in the circuit to be upgraded and the storage initial address and the storage size;
the external equipment sends the data packet for upgrading to a main MCU;
and the main MCU responds to external equipment when verifying that the data packet for upgrading is correct, and writes the received data packet for upgrading into a corresponding storage area.
Further, when the external device informs the master MCU that the firmware in the circuit to be upgraded is the slave MCU or the firmware connected to the slave MCU, the method includes the following steps:
the external equipment sends a data information packet to the master MCU, and the master MCU transparently transmits the data information packet to the corresponding slave MCU according to the unique identification code of the firmware in the circuit to be upgraded and informs the slave MCU of the storage starting address and the size of the data packet for upgrading;
the slave MCU responds to external equipment when verifying the correctness of the data information packet, and erases a specified storage area according to a unique identification code of firmware in the circuit to be upgraded and the storage starting address;
the external equipment sends the data packet for upgrading to a main MCU;
the master MCU transparently transmits the data packet for upgrading to the corresponding slave MCU;
and the slave MCU responds to external equipment when verifying that the data packet for upgrading is correct, and writes the received data packet for upgrading into a specified memory area according to the storage starting address and the size.
Further, when the firmware in the circuit to be upgraded is a master MCU or a slave MCU, the master MCU or the slave MCU erases the designated Flash area according to the storage starting address and the size, and writes a data packet for upgrading sent by an external device into the designated Flash area.
Further, when the firmware in the circuit to be upgraded is Flash (Flash memory) of the master MCU or Flash of the slave MCU, the method includes the following steps:
and the master MCU or the slave MCU responds to the external equipment when verifying the correctness of the data information packet, operates the FLASH connected with the master MCU or the slave MCU through the SPI (one type of bus), and writes the received data packet for upgrading into a specified FLASH area according to the storage initial address and the size.
Further, when the firmware in the circuit to be upgraded is an EEPROM (electrically erasable programmable read only memory) of the master MCU or an EEPROM of the slave MCU, the master MCU or the slave MCU responds to the external device when verifying the correctness of the data packet, operates the EEPROM through I2C, and writes the received data packet for upgrading into a designated EEPROM area according to the storage start address and size.
Further, when the firmware in the circuit to be upgraded is the CPLD of the master MCU or the CPLD of the slave MCU, the master MCU or the slave MCU responds to the external device when verifying the correctness of the data packet, operates the CPLD (complex programmable logic device) through JTAG, and writes the received data packet for upgrading to a designated memory area according to the storage start address and size.
Further, the external device divides the data for upgrading into 128-byte packets and transmits the 128-byte packets to the main MCU until the data for upgrading is completely transmitted.
In the invention, when multi-MCU multi-cascade upgrading is faced, a master MCU can mount a plurality of slave MCUs, and when the slave MCU can be connected with the next slave MCU, all levels of firmware in the circuit can be normally upgraded by building a routing link, the upgrading function is complete, not only can a BootLoader program and an APP program of the MCU be upgraded, but also EEPROM, FLASH and CPLD equipment mounted on the MCU can be upgraded. The invention has simple communication and less occupied memory resources, the upper computer sends port data packets first, the upgrading can be carried out after the connection port is configured, the data cache size can be designed according to the resource size of the MCU, and the upgrading can still be finished when the upgrading is restarted if the upgrading is interrupted accidentally.
Drawings
The invention is described in detail below with reference to examples and figures, in which:
FIG. 1 is a schematic circuit diagram according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a circuit connection port according to another embodiment of the invention.
FIG. 3 is a flow chart of the upgrade of the present invention.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects to be solved by the present invention more clearly apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Thus, a feature indicated in this specification will serve to explain one of the features of one embodiment of the invention, and does not imply that every embodiment of the invention must have the stated feature. Further, it should be noted that this specification describes many features. Although some features may be combined to show a possible system design, these features may also be used in other combinations not explicitly described. Thus, the combinations illustrated are not intended to be limiting unless otherwise specified.
The principles of the present invention will be described in detail below with reference to the accompanying drawings and embodiments.
The circuit of the invention comprises one or more firmware, if possible, only one main MCU, or one main MCU and firmware such as Flash, EEPROM and the like mounted on the main MCU, and also can form a cascade circuit, as shown in FIG. 1, the circuit is a simple two-stage circuit, wherein the first stage comprises the main MCU, FLASH connected with the main MCU through SPI, EEPROM connected with the main MCU through I2C, and CPLD connected with the main MCU through JTAG. The second stage comprises a slave MCU connected with the main MCU through a UART serial port, FLASH connected with the slave MCU through an SPI, an EEPROM connected with the slave MCU through I2C and a CPLD connected with the slave MCU through JTAG. The slave MCU of the second stage may further be connected to the slave MCU of the next stage, and the slave MCUs (including the master MCU and the slave MCU) connected to each stage are not limited to one, and may be connected to a plurality of slave MCUs.
When the circuit is upgraded, an external device is connected with a main MCU in the MCU through a serial port (such as a UART serial port), and the external device is an upper computer, specifically a host computer (PC) or other devices capable of being used as the upper computer. The external device sends a port information packet through a serial port of the main MCU to inform the main MCU of firmware in a circuit needing to be upgraded, the main MCU responds to the external device when verifying that the port information packet is correct, receives a data packet which is sent by the external device and used for upgrading the external device or the firmware controlled by the external device, or transmits the data packet to the corresponding slave MCU, so that the corresponding slave MCU upgrades the external device or the firmware controlled by the slave MCU.
The port information comprises the unique identification code of the firmware, and the external equipment informs the unique identification code of the firmware in the circuit by sending the port information packet comprising the unique identification code so as to enable the main MCU to know which firmware in the circuit needs to be upgraded. In one embodiment, the unique identification code of the firmware in the circuit consists of the class number of the firmware, and the port numbers of all preceding stage MCUs connected by the firmware. As shown in FIG. 2, the cascaded circuit has a host MCU, CPLD connected to the host MCU, which are the first stage firmware of the circuit. The master MCU is connected to the GUI MCU (slave MCU) via port 01 and the slave MCU via port 02, and the GUI MCU is connected to a Flash (GUI), which are second-level firmware of the circuit. The auxiliary MCU is connected with a Key MCU (slave MCU) through a port 01, and the Key MCU is connected with a Flash (Key). They are the third level firmware of the circuit. The host MCU and the CPLD are the same-level equipment, the port information of the host MCU and the CPLD is A1 and C0 respectively, the unique identification code of the host MCU is A1, the unique identification code of the CPLD is C0, and the routing links of the host MCU and the CPLD are all empty. Meanwhile, the slave MCU devices are a GUI MCU and a slave MCU, the routing links of the slave MCU devices are 01 and 02 respectively, the non-MCU devices mounted under the GUI MCU are FLASH (GUI), so the GUI MCU and the FLASH (GUI) are the same network devices, the port information of the GUI MCU and the FLASH (GUI) is A101 and F001 respectively, the routing links are 01, the non-MCU devices are not mounted under the slave MCU, no device is in a network with the slave MCU, the port information of the slave MCU is A102, the routing link is 02, the unique identification code of the GUI MCU is A101, the unique identification code of the FLASH (GUI) is F101, and the unique identification code of the slave MCU is A102. FLASH (KEY) is mounted under the KEY MCU, the KEY MCU and the FLASH (KEY) are the same network equipment, port information of the KEY MCU and port information of the FLASH are A10102 and F00102 respectively, routing links of the KEY MCU and the FLASH are all 0102, the unique identification code of the Key MCU is A10102, and the unique identification code of the FLASH (Key) is F00102.
The port information packet sent by the external device contains port information (also called as a unique identification code) of the firmware to be upgraded, and after receiving the port information packet, the main MCU determines whether actual port information of the firmware corresponding to the unique identification code matches, and whether the connection is successful, and then responds to the external device.
The firmware that needs to be upgraded is the host MCU itself. The method comprises the steps that an external device sends a port information packet to a main MCU through a UART (universal asynchronous receiver/transmitter), informs the main MCU that the main MCU needs to upgrade the main MCU, the main MCU verifies and judges the port information packet based on the technical scheme, if the correct data is received, the main MCU responds the external device, the external device sends the data information packet to the main MCU, informs the storage starting address and the storage size of data of the main MCU, the MCU responds the external device when verifying that the data information packet is correct, the main MCU erases a Flash area designated by the main MCU based on the storage starting address and the storage size, the external device sends the data packet to the main MCU, divides the data into 128-byte packets to be sent, the main MCU responds the external device when verifying that the data of the data packet is correct, writes the data into a FLASH area designated by the main MCU until the external device sends an end packet to the main MCU.
The firmware needing to be upgraded is the slave MCU of a certain level or the non-MCU firmware mounted by the slave MCU. The external device sends a port information packet to the master MCU through the UART to inform the master MCU that a primary slave MCU or non-MCU firmware mounted by the slave MCU needs to be upgraded, the master MCU verifies and judges the port information packet based on the technical scheme, if the correct data is received, the master MCU responds to the external device, the external device sends a data information packet to the master MCU, the master MCU transparently transmits the data information packet to the corresponding slave MCU according to the unique identification code of the firmware in the circuit needing to be upgraded, and informs the slave MCU of a storage start address and size of the data packet used for upgrading; the method comprises the steps that a slave MCU responds to external equipment when verifying the correctness of a data information packet, a specified storage area is erased according to a unique identification code of firmware needing to be upgraded and a storage starting address and size, the external equipment sends the data packet used for upgrading to the master MCU, the master MCU transmits the data packet used for upgrading to the corresponding slave MCU, the slave MCU responds to the external equipment when verifying the correctness of the data packet used for upgrading, and the received data packet used for upgrading is written into the specified memory area according to the storage starting address and the size.
If the firmware needing to be upgraded is non-MCU firmware mounted by a certain MCU. Taking FLASH for upgrading a main MCU as an example, the external equipment sends a port information packet to the main MCU through a UART (universal asynchronous receiver/transmitter), informs the main MCU that FLASH needs to be upgraded, receives correct data and responds to the external equipment, the external equipment sends the data information packet to the main MCU, informs the main MCU of the storage initial address and the size of data, receives correct data and responds to the external equipment by the main MCU, the main MCU operates the FLASH through the SPI, the external equipment sends the data packet to the main MCU, divides the data into 128 bytes to be sent out, receives correct data and responds to the external equipment by the MCU, writes the data into a designated FLASH area until the external equipment sends an end packet to the main MCU, and receives correct data and responds to the external equipment by the main MCU. If the FLASH of the slave MCU is upgraded, the corresponding data sent by the external equipment needs to be transmitted to the slave MCU through the master MCU, and the slave MCU executes the operation. Specifically, the external device sends a port information packet to the main MCU through the UART to inform the main MCU that the FLASH mounted by the primary slave MCU needs to be upgraded, the main MCU verifies and judges the port information packet based on the technical scheme, if the correct data is received, the main MCU responds to the external device, the external device sends a data information packet to the main MCU, the main MCU transparently transmits the data information packet to the corresponding slave MCU according to the unique identification code of the firmware in the circuit needing to be upgraded, and informs the slave MCU of the storage start address and the size of the data packet used for upgrading; the method comprises the steps that a slave MCU responds to an external device when verifying the correctness of a data information packet, a specified FLASH region is erased according to a unique identification code of firmware to be upgraded and a storage start address and size, the external device sends the data packet for upgrading to the master MCU, the master MCU transmits the data packet for upgrading to a corresponding slave MCU, the slave MCU responds to the external device through a connected front-stage MCU (possibly the master MCU, possibly the master MCU and the slave MCU, and specific analysis is required according to the fact that the slave MCU is in the fourth stage) when verifying that the data packet for upgrading is correct, and the received data packet for upgrading is written into the specified FLASH region according to the storage start address and the size.
Take upgrading the EEPROM of the main MCU as an example. The method comprises the steps that an external device sends a port information packet to a main MCU through a UART (universal asynchronous receiver/transmitter), informs the main MCU that an EEPROM (electrically erasable programmable read-only memory) needs to be upgraded, the main MCU responds the external device after receiving correct data, the external device sends a data information packet to the main MCU, informs the main MCU of the storage starting address and the storage size of data, receives the correct data, responds the external device by the main MCU, the main MCU operates the EEPROM through I2C, the external device sends the data packet to the main MCU, divides the data into 128-byte packets to be sent, receives the correct data, responds the external device by the main MCU, writes the data into a designated EEPROM region until the external device sends an end packet to the main MCU, and receives.
Take upgrading the CPLD of the main MCU as an example. The method comprises the steps that an external device sends a port information packet to a main MCU through a UART (universal asynchronous receiver/transmitter), informs the main MCU of needing to upgrade a CPLD (complex programmable logic device), the main MCU responds the external device after receiving correct data, the external device sends a data information packet to the main MCU and informs the main MCU of the storage starting address and the size of data, the main MCU responds the external device after receiving the correct data, the main MCU operates the CPLD through a JTAG, the external device sends the data packet to the main MCU, the data are divided into 128-byte packets to be sent, the main MCU responds the external device after receiving the correct data, the data are written into a specified memory area until the external device sends an end packet to the main MCU, and the main MCU responds the external.
Take upgrading a slave MCU as an example. The method comprises the steps that an external device sends a port information packet to a master MCU through a UART to inform the master MCU that a slave MCU needs to be upgraded, the master MCU responds to the external device by receiving correct data, the external device sends a data information packet to the master MCU, the master MCU transmits the data packet to the slave MCU through the UART to inform the slave MCU of the storage starting address and the size of the data, the slave MCU responds to the external device by receiving the correct data, the slave MCU erases a designated Flash area of the slave MCU, the external device sends the data packet to the master MCU and divides the data into 128-byte packets to be sent, the master MCU transmits the data packets to the slave MCU through the UART, the slave MCU responds to the external device by receiving the correct data, the data are written into the designated Flash area of the slave MCU, the slave MCU sends an end packet to the slave MCU until the external device sends the end.
As shown in fig. 3, since the upgrading MCU itself is different from upgrading other non-MCU firmware, when the MCU (including the master MCU and the slave MCU) receives the first packet data (i.e., the port packet) of the external device, it needs to perform a judgment. The first packet data includes port routing information (i.e., port information) and target firmware information to be burned. This information determines whether the MCU receiving this packet needs to build a routing channel or restart itself to upgrade its APP. Assuming that the port information is a 10102, at this time, the upper computer (external device) sends a 10102 to the first-stage MCU (i.e., the main MCU), and this MCU determines, according to the last byte data (02), that this packet is not intended for itself, and it is an intermediate stage, and it needs to transmit data to its own 02 port. Meanwhile, after the connection is established, the user feeds back an OK identification code to the upper computer. And the upper computer knows that the first level is opened after receiving the OK identification code. Then, the port information sent by the slave MCU is reduced by one bit, i.e. a 101, and the data is sent directly to the MCU (i.e. slave MCU) in the next stage through the first stage MCU. The second-level MCU (i.e. the auxiliary MCU) automatically judges that the data is not sent to the second-level MCU based on the same principle, the second-level MCU does the same action with the first-level MCU, the data is transmitted to the 01 port of the second-level MCU in a transparent mode, the Key MCU receives the transmitted data, the auxiliary MCU feeds back an OK identification code after establishing a connection for transmitting to the 01 port, and the multi-master MCU transmits the OK identification code to the upper computer in a transparent mode. And finally, the upper computer only sends the port information of A1 and transparently transmits the port information to a third-level MCU (namely, a Key MCU). At the moment, the third-stage MCU knows that the equipment of the stage is upgraded, feeds back OK, and at the moment, the establishment of the whole routing link is completed. And then the external equipment sends a data information packet and a data packet for upgrading to the main MCU based on the technical scheme described above, the main MCU transmits the data information packet and the data packet for upgrading to the Key MCU through the routing link, and the Key MCU performs corresponding upgrading burning operation.
After receiving the communication data of the upper computer, the communication target MCU (which may be a master MCU or a slave MCU) feeds back a corresponding identification code (such as the above-mentioned OK identification code) to the upper computer, and the communication target MCU is transferred by the upper MCU in a primary-level and a primary-level manner, where the specific fed-back identification code is 1BYTE data, and the low four bits and the high four bits are mutually inverse codes to improve the robustness of the system. There are 16 kinds of identification codes in total. Where F0 denotes OK, E1 denotes a header error, D2 denotes a data check error, C3 denotes a packet length error, B4 denotes a data value error, a5 denotes a port error, 87 denotes a general error, 78 denotes the end of upgrade, and 69-0F denotes respective error identification codes when different types of target devices are upgraded.
When the upper computer sends the routing information, if the feedback identification code is not received or the data check error is received within 100ms, the information is retransmitted. And quitting the upgrade if the upgrade is finished in the upgrade process, and prompting the upgrade to be successful. And if other errors are received, quitting upgrading and carrying out error prompt.
And when the identification code received by the intermediate link is of the error type, exiting the transparent transmission upgrading mode.
The upgrading MCU comprises an APP program for upgrading the MCU and a Bootloader (bottom layer) for upgrading the MCU, taking an upgrading main MCU as an example, the main MCU judges whether the Bootloader or the APP needs to be upgraded through a port information packet, and if the APP is upgraded, the Bootloader program is jumped to run from the APP program; upgrading in a BootLoader, firstly erasing a Flash area storing an APP code, receiving and writing in a specified Flash area in a sub-packet mode; and finishing the upgrading operation APP, receiving an upgrading end data packet, and jumping to the APP operation from the BootLoader program. If the BootLoader is upgraded in the APP, the Flash area storing BootLoader codes is firstly erased, the specified Flash area is received and written in a sub-packet mode until an upgrade end data packet is received, and then the APP program is operated.
The invention upgrades the circuit through the serial port, make the supporting area of the invention wide, can be used widely, MCU mainstream in the market basically has one or more serial ports to upgrade, facilitate maintenance and function renewal of the product, can reduce the maintenance of the product and cost of function renewal, and easy to operate, transmit stably, upgrade the peristaltic rush.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. A circuit upgrading method based on a serial port is provided, wherein the circuit comprises at least one MCU, and the circuit upgrading method comprises the following steps:
the external equipment is connected with a main MCU in the MCUs through the serial port;
sending a port information packet through a serial port of the main MCU to inform the main MCU of firmware in the circuit needing to be upgraded;
and the master MCU responds to the external equipment when verifying that the port information packet is correct, receives a data packet which is sent by the external equipment and is used for upgrading, and upgrades the self or firmware controlled by the self or transmits the data packet to a slave MCU in the MCU, so that the slave MCU upgrades the self or firmware controlled by the slave MCU.
2. The serial-based circuit upgrade method according to claim 1, wherein the external device informs the host MCU of firmware in the circuit that needs to be upgraded by informing a unique identification code of firmware in the circuit.
3. The serial-based circuit upgrading method according to claim 2, wherein the unique identification code of the firmware in the circuit consists of the type number of the firmware and the port numbers of all preceding stage MCUs connected by the firmware.
4. The serial port based circuit upgrading method according to any one of claims 1 to 3, wherein when the external device informs the host MCU that the firmware in the circuit needing to be upgraded is the host MCU or the firmware connected to the host MCU, the method comprises the following steps:
the external equipment sends a data information packet to the main MCU and informs the main MCU of the storage initial address and the size of the data packet for upgrading;
the main MCU responds to external equipment when verifying the correctness of the data information packet, and erases corresponding storage areas according to the firmware in the circuit to be upgraded and the storage initial address and the storage size;
the external equipment sends the data packet for upgrading to a main MCU;
and the main MCU responds to external equipment when verifying that the data packet for upgrading is correct, and writes the received data packet for upgrading into a corresponding storage area.
5. The serial port based circuit upgrading method according to claim 4, wherein when the external device informs the master MCU that the firmware in the circuit needing to be upgraded is any one of the slave MCU or the firmware connected to the slave MCU, the method comprises the following steps:
the external equipment sends a data information packet to the master MCU, and the master MCU transparently transmits the data information packet to the corresponding slave MCU according to the unique identification code of the firmware in the circuit to be upgraded and informs the slave MCU of the storage starting address and the size of the data packet for upgrading;
the slave MCU responds to external equipment when verifying the correctness of the data information packet, and erases a specified storage area according to a unique identification code of firmware in the circuit to be upgraded and the storage starting address;
the external equipment sends the data packet for upgrading to a main MCU;
the master MCU transparently transmits the data packet for upgrading to the corresponding slave MCU;
and the slave MCU responds to external equipment when verifying that the data packet for upgrading is correct, and writes the received data packet for upgrading into a specified memory area according to the storage starting address and the size.
6. The serial port based circuit upgrading method according to claim 5, wherein when the firmware in the circuit to be upgraded is a master MCU or a slave MCU, the master MCU or the slave MCU erases a designated Flash area thereof according to the storage start address and size, and writes a data packet for upgrading sent by an external device into the designated Flash area.
7. The serial port based circuit upgrading method according to claim 5, wherein when the firmware in the circuit to be upgraded is Flash of the master MCU or Flash of the slave MCU, the method comprises the following steps:
and the main MCU or the slave MCU responds to the external equipment when verifying the correctness of the data information packet, operates the FLASH connected with the main MCU or the slave MCU through the SPI, and writes the received data packet for upgrading into a specified FLASH area according to the storage initial address and the size.
8. The serial port based circuit upgrading method according to claim 1, wherein when the firmware in the circuit to be upgraded is the EEPROM of the master MCU or the EEPROM of the slave MCU, the master MCU or the slave MCU responds to an external device when verifying the correctness of the data packet, operates the EEPROM through I2C, and writes the received data packet for upgrading into a designated EEPROM area according to the storage start address and size.
9. The serial port based circuit upgrading method according to claim 1, wherein when the firmware in the circuit to be upgraded is the CPLD of the master MCU or the CPLD of the slave MCU, the master MCU or the slave MCU responds to an external device when verifying the correctness of the data packet, operates the CPLD through JTAG, and writes the received data packet for upgrading into a designated memory area according to the storage start address and size.
10. The serial-port-based circuit upgrading method according to claim 5, wherein when the master MCU or the slave MCU responds to the external device, an identification code is fed back to the external device, and the high order and the low order of the fed-back identification code are mutually inverse codes.
CN202110262122.8A 2021-03-10 2021-03-10 Circuit upgrading method based on serial port Pending CN112905206A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110262122.8A CN112905206A (en) 2021-03-10 2021-03-10 Circuit upgrading method based on serial port

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110262122.8A CN112905206A (en) 2021-03-10 2021-03-10 Circuit upgrading method based on serial port

Publications (1)

Publication Number Publication Date
CN112905206A true CN112905206A (en) 2021-06-04

Family

ID=76104871

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110262122.8A Pending CN112905206A (en) 2021-03-10 2021-03-10 Circuit upgrading method based on serial port

Country Status (1)

Country Link
CN (1) CN112905206A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117785247A (en) * 2024-02-26 2024-03-29 双一力(宁波)电池有限公司 Equipment upgrading method, device and system of energy storage system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117785247A (en) * 2024-02-26 2024-03-29 双一力(宁波)电池有限公司 Equipment upgrading method, device and system of energy storage system

Similar Documents

Publication Publication Date Title
CN107820603A (en) A kind of firmware update and controller
CN110032382A (en) A kind of vehicle electronic control unit upgrade method, system and terminal device
US5925140A (en) Apparatus and method for error free loading of a programmable non-volatile memory over a datalink
EP2845114B1 (en) Extensible wse hub to support a multi-hop tree of usb hubs or peripherals over a wireless link
CN110730104A (en) Method for upgrading multi-device batch firmware of mesh network device
CN102185754B (en) Method for upgrading board card in switch system
CN105224362A (en) Host computer carries out the method and system of program upgrade to slave computer
WO2010135897A1 (en) Firmware over the air upgrade method and apparatus for exclusive flash compound device
CN111142914B (en) ZYNQ-based firmware upgrading method and computer-readable storage medium
CN110187909A (en) A kind of single-chip microcontroller firmware upgrade method based on android system
CN103092648B (en) A kind of image upgrade method, system and subscriber equipment and personal computer
CN112905206A (en) Circuit upgrading method based on serial port
CN102081526B (en) Basic input/output system architecture
CN108572847B (en) Method for upgrading single chip microcomputer software version through USB port
CN113434442A (en) Switch and data access method
CN108028767A (en) For the method for adapter upgrade, mobile terminal and adapter
CN102736922A (en) Method for updating application programs of embedded system and terminal of embedded system
CN110134423A (en) Update method, device and the computer readable storage medium of firmware
CN107665123B (en) Firmware updating method
CN111431668B (en) Baud rate switching method based on multi-node UART communication, air conditioning system and processor
CN210052151U (en) Double-chip program updating device
CN113342385A (en) Software upgrading method and device and air conditioner control panel
CN112988202B (en) System and method for upgrading FC (fiber channel) module
CN114095954B (en) UART-based wireless communication module upgrading method
CN111443930A (en) Upgrading method and device of cascade terminal, storage medium and electronic terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination