Single-chip microcomputer, firmware upgrading equipment and control method of system
By splitting the firmware file into multiple data packets and attaching verification codes, the time wasted caused by file packet errors during the firmware upgrade process of microcontrollers is solved, and a more efficient and accurate firmware upgrade process is achieved.
Patent Information
- Application Number
- CN202311184211.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-14
- Publication Date
- 2025-03-14
AI Technical Summary
During the firmware upgrade process of existing microcontrollers, due to the small memory, when the firmware file is subcontracted, if any file package has problems, the entire firmware file will be unusable, wasting time for invalid file transfer, and increasing time cost.
By splitting the firmware file into multiple data packets and attaching a verification code to each data packet, the microcontroller performs verification when receiving the data packet. If any data packet error is found, the invalid transmission process will be immediately terminated to ensure that only valid data packets are received and written.
It realizes that during the firmware upgrade process, the microcontroller can timely identify and terminate the transmission of wrong data packets, reduce invalid file transfer, reduce the time cost of firmware upgrade, and improve the accuracy of firmware upgrade through secondary verification.
Smart Images

Figure CN119621093A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of single-chip microcomputers, and in particular to a single-chip microcomputer, a firmware upgrade device and a control method of the system. Background Art
[0002] IAP is online application programming, and its purpose is to facilitate firmware upgrades through the reserved UART interface after the module is released. Usually, when implementing online application programming, it is necessary to write two program codes when designing the firmware. The first part of the program is called Bootloader, which does not execute user function codes and is only used to execute system boot. The second part of the program actually runs the function code. When the existing single-chip microcomputer uses IAP for firmware upgrade, due to the small memory of the single-chip microcomputer, when transferring the firmware file, the firmware file is usually transferred by dividing it into packets. When the existing electronic equipment is transferring the firmware file, if there is a problem with any file divided from the firmware file, the firmware file will become unusable, and the electronic device must receive all the firmware files before it can detect it, wasting time on useless file transfers and increasing the time cost of firmware upgrades. Summary of the invention
[0003] In order to solve the above problems, the present invention provides a single chip microcomputer, a firmware upgrade device and a control method of the system. The specific technical solution of the present invention is as follows: A control method for a single-chip microcomputer comprises the following steps: A1: the single-chip microcomputer is powered on, and then the single-chip microcomputer determines whether an upgrade signal is received. If no upgrade signal is received, the firmware upgrade is not performed. If an upgrade signal is received, the process proceeds to step A2; A2: the single-chip microcomputer receives data packets split into firmware files and verification codes of the data packets, and verifies the received data packets by using the verification codes of the data packets, and then the single-chip microcomputer writes the data packets after successful verification into a memory, and then proceeds to step A3; A3: after the single-chip microcomputer writes all the data packets split into the firmware files into the memory, it receives the verification code of the firmware files, and verifies all the written data packets by using the verification code of the firmware files, and completes the firmware upgrade after successful verification.
[0004] Further, in step A1, the single-chip microcomputer determines whether an upgrade signal is received, including the following steps: after the single-chip microcomputer is powered on, the serial port and the timer are initialized; the single-chip microcomputer sets a timer, and then determines whether a set number of download signals are received within a set time; if the single-chip microcomputer receives a set number of download signals within the set time, it is determined that the single-chip microcomputer has received an upgrade signal and the firmware is upgraded; if the single-chip microcomputer does not receive the set number of download signals within the set time, it is determined that the single-chip microcomputer has not received an upgrade signal and the firmware is not upgraded.
[0005] Furthermore, after receiving the upgrade signal, the single chip microcomputer enters the download mode, and then the single chip microcomputer receives the data packet and the check code of the current data packet through the serial port interrupt.
[0006] Furthermore, after the microcontroller firmware upgrade is completed or the firmware upgrade is not performed, it will jump to the initial address of the microcontroller running program, and then set the interrupt vector offset according to the initial address.
[0007] Furthermore, if a verification error occurs when the single-chip microcomputer performs data packet verification or firmware file verification, the single-chip microcomputer stops the firmware upgrade and sends an error signal to the firmware upgrade device, so that the firmware upgrade device updates the firmware file and resends the firmware file.
[0008] A control method for a firmware upgrade device, the control method comprising the following steps: B1: after the firmware upgrade device is connected to a single-chip microcomputer, it sends an upgrade signal to the single-chip microcomputer to make the single-chip microcomputer enter a download mode; B2: the firmware upgrade device splits a firmware file into data packets, and then sends the data packets and verification codes of the data packets to the single-chip microcomputer; B3: after the firmware upgrade device sends all the data packets to the single-chip microcomputer, it sends the verification code of the firmware file to the single-chip microcomputer to complete the firmware upgrade.
[0009] Furthermore, the firmware upgrade device splits the firmware file into data packets, including the following steps: the firmware upgrade device splits the firmware file into a number of data packets not greater than Nk; the firmware upgrade device sends the data packets and the check codes of the data packets to the microcontroller in sequence according to the splitting order; wherein N is a natural number greater than 0.
[0010] Furthermore, during the firmware upgrade process, if the firmware upgrade device receives an error signal sent by the single-chip microcomputer, the firmware upgrade device updates the firmware file, and after the firmware file update is completed, directly splits the firmware file into data packets and sends them to the single-chip microcomputer connected to the firmware upgrade device.
[0011] A control method for a single-chip microcomputer firmware upgrade system comprises the following steps: S1: after a firmware upgrade device is connected to a single-chip microcomputer, an upgrade signal is sent to the single-chip microcomputer to make the single-chip microcomputer enter a download mode; S2: the firmware upgrade device splits a firmware file into data packets, and then sends the data packets and the check codes of the current data packets to the single-chip microcomputer; S3: the single-chip microcomputer receives the data packets split into the firmware file and the check codes of the data packets, and checks the received data packets by using the check codes of the data packets, and then the single-chip microcomputer writes the data packets after successful verification into a memory; S4: after the single-chip microcomputer writes all the data packets split into the firmware file into the memory, it receives the check codes of the firmware files, and checks all the written data packets by using the check codes of the firmware files, and completes the firmware upgrade after successful verification.
[0012] Furthermore, after the firmware upgrade device sends the data packet and the verification code of the current data packet to the microcontroller, the microcontroller verifies the received data packet through the verification code and writes the verified data packet into the memory. Then the firmware upgrade device sends the next data packet and the verification code of the data packet to the microcontroller.
[0013] Compared with the existing technology, the beneficial effects of the present invention are: when the single-chip microcomputer described in the present application is performing a firmware upgrade, the firmware upgrade device splits the firmware file into several data packets, which is convenient for the single-chip microcomputer to receive the firmware file, and during the firmware upgrade process, when the single-chip microcomputer receives the data packets separated from the firmware file, it will also receive the check code of the data packet. When an error occurs in any data packet, the single-chip microcomputer will know, which is convenient for the single-chip microcomputer to terminate the subsequent useless data packet transmission process and reduce the time cost of the firmware upgrade; after receiving the data packet of the firmware file, the single-chip microcomputer verifies the received data packet through the check code, and then after receiving all the data packets, the firmware file is verified through the check code to achieve secondary verification and improve the accuracy of the firmware upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 The figure is a flow chart of a control method of a single chip microcomputer in one embodiment of the present invention.
[0015] Figure 2 The present invention provides a method for controlling a firmware upgrade device in an embodiment of the present invention.
[0016] Figure 3 The present invention provides a control method for a single-chip microcomputer firmware upgrade system in one embodiment of the present invention. Implementation
[0017] Embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions.
[0018] The following is a further description of the specific embodiments of the present invention in conjunction with the drawings of the specification, so that the technical solution and its beneficial effects of the present invention are clearer and more explicit. The following description of the embodiments with reference to the drawings is exemplary and intended to explain the present invention, but cannot be understood as limiting the present invention.
[0019] like Figures 1 to 3As shown, a control method of a single-chip microcomputer includes the following steps: A1: the single-chip microcomputer is connected to a firmware upgrade device to power on, and then the single-chip microcomputer determines whether an upgrade signal is received. If no upgrade signal is received, the firmware upgrade is not performed. If an upgrade signal is received, step A2 is entered. A2: the single-chip microcomputer receives the data packets and the check codes of the data packets split from the firmware file, and checks the received data packets by the check codes of the data packets, and then the single-chip microcomputer writes the data packets after successful verification into the memory flash, and enters step A3. A3: after the single-chip microcomputer writes all the successfully verified data packets split from the firmware file into the memory flash, the single-chip microcomputer receives the check code of the firmware file, and checks all the written data packets by the check code of the firmware file, that is, the entire firmware file composed of all the written data packets is checked to achieve secondary verification. After the verification is successful, the firmware upgrade is completed, and the single-chip microcomputer closes the serial port and timer resources. Data verification is to ensure the integrity of the data. A check code is calculated for the original data using a specified algorithm, and the receiving party calculates a check code using the same algorithm. If it is the same as the check code provided with the data, it means that the data is complete. Commonly used data verification algorithms include parity check Parity Check, bcc XOR check method (block check character), crc cyclic redundancy check (Cyclic Redundancy Check), md5 check and digital signature and Hamming code check, etc. When the firmware upgrade device receives the firmware upgrade command, the firmware upgrade device calculates the firmware file according to the algorithm, calculates the check code of the firmware file, and then splits the firmware file into several data packets, and when splitting the data packet, the check code of the data packet is calculated by the algorithm, and then the data packet and the check code of the data packet are sent together to the single-chip microcomputer. After receiving the data packet, the single-chip microcomputer calculates the check code of the data packet by the same algorithm. If the calculated check code is the same as the received check code, the check is successful. After the single-chip microcomputer receives all the data packets, the check code of the firmware file composed of all the data packets is calculated by the same algorithm, and then the calculated check code of the firmware file is compared with the check code of the received firmware file. If they are the same, the check is successful and the single-chip microcomputer completes the upgrade. Preferably, the present application uses parity check ParityCheck for data verification. In data storage and transmission, an additional bit is added to the byte to detect errors. The parity bit can be calculated by XORing the data bits. The parity bit is checked based on whether the number of "1" in the digits of a set of binary codes being transmitted is odd or even. The use of an odd number is called odd parity, and vice versa, it is called even parity. The type of parity to be used is predetermined. Usually, a parity bit is specially set to make the number of "1" in this set of codes odd or even. If odd parity is used, when the receiving end receives this set of codes, it checks whether the number of "1" is an odd number, thereby determining the correctness of the transmitted code.For example, when the data packet transmitted by the firmware upgrade device is 1000110, the number of "1" in the transmitted data is an odd number. If odd parity is used, the transmitted data is 1000110 (0); if even parity is used, the transmitted data is 1000110 (1). After receiving the data packet, the single-chip microcomputer determines the number of "1" in the data packet to determine whether the transmitted data packet is correct. When the single-chip microcomputer described in the present application performs a firmware upgrade, the firmware upgrade device splits the firmware file into several data packets, which is convenient for the single-chip microcomputer to receive the firmware file. In addition, during the firmware upgrade process, when the single-chip microcomputer receives the data packets separated from the firmware file, it will also receive the check code of the data packet. When any data packet has an error, the single-chip microcomputer will know, which is convenient for the single-chip microcomputer to terminate the subsequent useless data packet transmission process and reduce the time cost of the firmware upgrade. After receiving the data packet of the firmware file, the single-chip microcomputer verifies the received data packet through the check code, and then after receiving all the data packets, the firmware file is verified through the check code to achieve secondary verification and improve the accuracy of the firmware upgrade.
[0020] As one embodiment, in step A1, the single-chip microcomputer determines whether an upgrade signal is received, including the following steps: after the single-chip microcomputer is powered on, the serial port and the timer are initialized. The single-chip microcomputer sets a timer, and then determines whether a set number of download signals are received within a set time. Preferably, the single-chip microcomputer sets a 100ms timer, and the single-chip microcomputer receives 5 download signals within 500ms, that is, the timer sends a pulse every 100ms, and the single-chip microcomputer receives 5 download signals after the timer sends 5 pulses, and determines that an upgrade signal is received. If the single-chip microcomputer receives a set number of download signals within the set time, it is determined that the single-chip microcomputer receives an upgrade signal and performs a firmware upgrade. If the single-chip microcomputer does not receive a set number of download signals within the set time, it is determined that the single-chip microcomputer does not receive an upgrade signal, and the firmware upgrade is not performed. The single-chip microcomputer performs a firmware upgrade only when it receives a set number of download signals within the set time, thereby improving the reliability of the handshake and preventing the single-chip microcomputer from mistakenly entering the download mode.
[0021] As one embodiment, after receiving the upgrade signal, the single-chip microcomputer enters the download mode, and then the single-chip microcomputer receives the data packet and the verification code of the current data packet through the serial port interrupt. The single-chip microcomputer uses the serial port data interrupt to receive data, and then uses the serial port idle interrupt to verify whether the received data packet is accurate, thereby increasing the data reception rate.
[0022] As one embodiment, after the MCU firmware upgrade is completed or not, it will jump to the initial address of the MCU running program, and then set the interrupt vector offset according to the initial address. The MCU sets the interrupt vector offset through the initial address to ensure that the interrupted service program can be correctly executed when the service program is interrupted due to firmware upgrade or other factors.
[0023] As one embodiment, when the single-chip microcomputer performs data packet verification or firmware file verification, if a verification error occurs, the single-chip microcomputer stops the firmware upgrade and sends an error signal to the firmware upgrade device, so that the firmware upgrade device updates the firmware file and resends the firmware file. During the single-chip microcomputer firmware upgrade process, if the verification code is out of sync once, the single-chip microcomputer will send an error signal to the firmware upgrade device, so that the firmware upgrade device will re-update and improve the accuracy of the firmware upgrade.
[0024] A control method for a firmware upgrade device, the control method comprising the following steps: B1: After the firmware upgrade device is connected to a single-chip microcomputer, it sends an upgrade signal to the single-chip microcomputer to make the single-chip microcomputer enter a download mode. B2: The firmware upgrade device splits the firmware file into data packets, and then sends the data packets and the check codes of the data packets to the single-chip microcomputer. B3: After sending all the data packets to the single-chip microcomputer, the firmware upgrade device sends the check code of the firmware file to the single-chip microcomputer to complete the firmware upgrade. When the single-chip microcomputer is performing a firmware upgrade, the firmware upgrade device splits the firmware file into several data packets, which facilitates the single-chip microcomputer to receive the firmware file and improves the efficiency of the single-chip microcomputer in performing firmware upgrades.
[0025] As one embodiment, the firmware upgrade device sends an upgrade signal to the single-chip microcomputer, including the following steps: after the firmware upgrade device is connected to the single-chip microcomputer, it sends a set number of download signals to the single-chip microcomputer within a set time, so that the single-chip microcomputer enters the download mode. If the single-chip microcomputer does not enter the download mode, the firmware upgrade device sends a set number of download signals to the single-chip microcomputer again within a set time. Preferably, the set time is 500ms and the set number is 5. The firmware upgrade device improves the reliability of the handshake by sending a set number of download signals as an upgrade signal within a set time, thereby preventing the single-chip microcomputer from mistakenly entering the download mode.
[0026] As one embodiment, the firmware upgrade device splits the firmware file into data packets, including the following steps: the firmware upgrade device splits the firmware file into a number of data packets not greater than Nk. The firmware upgrade device sends the data packets and the check codes of the data packets to the single-chip microcomputer in the splitting order. Wherein, N is a natural number greater than 0. Preferably, N is 1, that is, the firmware upgrade device splits the firmware file into data packets not greater than 1k. The firmware upgrade device splits the firmware file into a number of data packets, which facilitates the single-chip microcomputer to receive the firmware file and improves the efficiency of the single-chip microcomputer in firmware upgrade.
[0027] As one embodiment, during the firmware upgrade process, if the firmware upgrade device receives an error signal sent by the single-chip microcomputer, the firmware upgrade device updates the firmware file, and after the firmware file update is completed, the firmware file is directly split into data packets and sent to the single-chip microcomputer connected to the firmware upgrade device. After completing the firmware file update, the firmware upgrade device directly transmits the updated firmware file to the single-chip microcomputer, and the firmware file does not need to send an upgrade signal to the single-chip microcomputer again, thereby improving the efficiency of the firmware upgrade.
[0028] A control method for a single-chip microcomputer firmware upgrade system, the control method comprising the following steps: S1: After the firmware upgrade device is connected to the single-chip microcomputer, an upgrade signal is sent to the single-chip microcomputer to make the single-chip microcomputer enter a download mode. S2: The firmware upgrade device splits the firmware file into data packets, and then sends the data packets and the check code of the current data packet to the single-chip microcomputer. S3: The single-chip microcomputer receives the data packets split into the firmware file and the check code of the data packets, and verifies the received data packets by the check code of the data packets, and then the single-chip microcomputer writes the data packets after successful verification into the memory. S4: After the single-chip microcomputer writes all the data packets split into the firmware file into the memory, it receives the check code of the firmware file, and verifies all the written data packets by the check code of the firmware file, and completes the firmware upgrade after successful verification. When the single-chip microcomputer described in the present application performs a firmware upgrade, the firmware upgrade device splits the firmware file into several data packets, which facilitates the single-chip microcomputer to receive the firmware file and improves the efficiency of the single-chip microcomputer in performing firmware upgrades. After receiving the data packet of the firmware file, the microcontroller verifies the received data packet through the check code, and then after receiving all the data packets, it verifies the firmware file through the check code to achieve secondary verification and improve the accuracy of firmware upgrade.
[0029] As one embodiment, after the firmware upgrade device sends the data packet and the verification code of the current data packet to the single-chip microcomputer, the single-chip microcomputer verifies the received data packet through the verification code and writes the verified data packet into the memory flash. Then the firmware upgrade device sends the next data packet and the verification code of the data packet to the single-chip microcomputer. After the single-chip microcomputer verifies a data packet, it receives the next data packet, so that the single-chip microcomputer does not need to receive useless data, thereby improving the speed of firmware upgrade.
[0030] As one embodiment, the single-chip computer determines whether an upgrade signal is received, including the following steps: after the single-chip computer is powered on, the serial port and the timer are initialized. The single-chip computer sets a timer, and then determines whether a set number of download signals are received within a set time. Preferably, the single-chip computer sets a 100ms timer, and the single-chip computer receives 5 download signals within 500ms, that is, the timer sends a pulse every 100ms, and the single-chip computer receives 5 download signals after the timer sends 5 pulses, and determines that an upgrade signal is received. If the single-chip computer receives a set number of download signals within the set time, it is determined that the single-chip computer receives an upgrade signal and performs a firmware upgrade. If the single-chip computer does not receive a set number of download signals within the set time, it is determined that the single-chip computer does not receive an upgrade signal and does not perform a firmware upgrade. The single-chip computer receives a set number of download signals within the set time before performing a firmware upgrade, thereby improving the reliability of the handshake and preventing the single-chip computer from mistakenly entering the download mode.
[0031] As one embodiment, after receiving the upgrade signal, the single-chip microcomputer enters the download mode, and then the single-chip microcomputer receives the data packet and the verification code of the current data packet through the serial port interrupt. The single-chip microcomputer uses the serial port data interrupt to receive data, and then uses the serial port idle interrupt to verify whether the received data packet is accurate, thereby increasing the data reception rate.
[0032] As one embodiment, after the MCU firmware upgrade is completed or not, it will jump to the initial address of the MCU running program, and then set the interrupt vector offset according to the initial address. The MCU sets the interrupt vector offset through the initial address to ensure that the interrupted service program can be correctly executed when the service program is interrupted due to firmware upgrade or other factors.
[0033] As one embodiment, when the single-chip microcomputer performs data packet verification or firmware file verification, if a verification error occurs, the single-chip microcomputer stops the firmware upgrade and sends an error signal to the firmware upgrade device, so that the firmware upgrade device updates the firmware file and resends the firmware file. During the single-chip microcomputer firmware upgrade process, if the verification code is out of sync once, the single-chip microcomputer will send an error signal to the firmware upgrade device, so that the firmware upgrade device will re-update and improve the accuracy of the firmware upgrade.
[0034] As one embodiment, the firmware upgrade device sends an upgrade signal to the single-chip microcomputer, including the following steps: after the firmware upgrade device is connected to the single-chip microcomputer, it sends a set number of download signals to the single-chip microcomputer within a set time, so that the single-chip microcomputer enters the download mode. If the single-chip microcomputer does not enter the download mode, the firmware upgrade device sends a set number of download signals to the single-chip microcomputer again within a set time. Preferably, the set time is 500ms and the set number is 5. The firmware upgrade device improves the reliability of the handshake by sending a set number of download signals as an upgrade signal within a set time, thereby preventing the single-chip microcomputer from mistakenly entering the download mode.
[0035] As one embodiment, the firmware upgrade device splits the firmware file into data packets, including the following steps: the firmware upgrade device splits the firmware file into a number of data packets not greater than Nk. The firmware upgrade device sends the data packets and the check codes of the data packets to the single-chip microcomputer in the splitting order. Wherein, N is a natural number greater than 0. Preferably, N is 1, that is, the firmware upgrade device splits the firmware file into data packets not greater than 1k. The firmware upgrade device splits the firmware file into a number of data packets, which facilitates the single-chip microcomputer to receive the firmware file and improves the efficiency of the single-chip microcomputer in firmware upgrade.
[0036] As one embodiment, during the firmware upgrade process, if the firmware upgrade device receives an error signal sent by the single-chip microcomputer, the firmware upgrade device updates the firmware file, and after the firmware file update is completed, the firmware file is directly split into data packets and sent to the single-chip microcomputer connected to the firmware upgrade device. After completing the firmware file update, the firmware upgrade device directly transmits the updated firmware file to the single-chip microcomputer, and the firmware file does not need to send an upgrade signal to the single-chip microcomputer again, thereby improving the efficiency of the firmware upgrade.
[0037] In the description of the specification, the description with reference to the terms "one embodiment", "preferably", "example", "specific example" or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention, and the schematic expressions of the above terms in this specification do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. The connection method connected in the description of the specification has obvious effects and practical effectiveness.
[0038] Through the description of the above structure and principle, technicians in the relevant technical field should understand that the present invention is not limited to the above-mentioned specific implementation methods. Improvements and substitutions based on the present invention using the well-known technology in the field all fall within the protection scope of the present invention and should be defined by the claims.
Claims
1. A control method for a single chip microcomputer, characterized in that: The control method comprises the following steps: A1: The MCU is powered on, and then the MCU determines whether an upgrade signal is received. If no upgrade signal is received, the firmware upgrade is not performed. If an upgrade signal is received, the process proceeds to step A2; A2: The single-chip microcomputer receives the data packets and the check codes of the data packets split from the firmware file, and checks the received data packets by the check codes of the data packets. Then, the single-chip microcomputer writes the data packets after the check into the memory, and then goes to step A3; A3: After the MCU writes all the data packets split into the firmware file into the memory, it receives the verification code of the firmware file and verifies all the written data packets through the verification code of the firmware file. After the verification is successful, the firmware upgrade is completed.
2. The control method of a single chip microcomputer according to claim 1, characterized in that: In step A1, the single chip computer determines whether an upgrade signal is received, including the following steps: After the microcontroller is powered on, the serial port and timer are initialized; The single chip microcomputer sets a timer and then determines whether a set number of download signals are received within the set time; If the MCU receives a set number of download signals within a set time, it is determined that the MCU receives an upgrade signal and performs a firmware upgrade; If the single-chip microcomputer does not receive the set number of download signals within the set time, it is determined that the single-chip microcomputer has not received the upgrade signal and the firmware upgrade is not performed.
3. The control method of a single chip microcomputer according to claim 2, characterized in that: After receiving the upgrade signal, the microcontroller enters the download mode, and then the microcontroller receives the data packet and the check code of the current data packet through the serial port interrupt.
4. The control method of a single chip microcomputer according to claim 3, characterized in that: After the MCU firmware upgrade is completed or not, it will jump to the initial address of the MCU running program, and then set the interrupt vector offset according to the initial address.
5. The control method of a single chip microcomputer according to claim 1, characterized in that: When the single-chip microcomputer performs data packet verification or firmware file verification, if a verification error occurs, the single-chip microcomputer stops the firmware upgrade and sends an error signal to the firmware upgrade device, so that the firmware upgrade device updates the firmware file and resends the firmware file.
6. A method for controlling a firmware upgrade device, characterized in that: The control method comprises the following steps: B1: After the firmware upgrade device is connected to the MCU, it sends an upgrade signal to the MCU, causing the MCU to enter the download mode; B2: The firmware upgrade device splits the firmware file into data packets, and then sends the data packets and the checksum of the data packets to the microcontroller; B3: After sending all the data packets to the single-chip microcomputer, the firmware upgrade device sends the verification code of the firmware file to the single-chip microcomputer to complete the firmware upgrade.
7. A method for controlling a firmware upgrade device according to claim 6, characterized in that: The firmware upgrade device splits the firmware file into data packets, including the following steps: The firmware upgrade device splits the firmware file into a number of data packets no larger than Nk; The firmware upgrade device sends the data packet and the check code of the data packet to the single chip microcomputer in sequence according to the splitting order; Wherein, N is a natural number greater than 0.
8. The method for controlling a firmware upgrade device according to claim 6, characterized in that: During the firmware upgrade process, if the firmware upgrade device receives an error signal sent by the single-chip microcomputer, the firmware upgrade device updates the firmware file, and after the firmware file update is completed, directly splits the firmware file into data packets and sends them to the single-chip microcomputer connected to the firmware upgrade device.
9. A control method for a single-chip microcomputer firmware upgrade system, characterized in that: The control method comprises the following steps: S1: After the firmware upgrade device is connected to the MCU, it sends an upgrade signal to the MCU, causing the MCU to enter the download mode; S2: The firmware upgrade device splits the firmware file into data packets, and then sends the data packets and the checksum of the current data packet to the microcontroller; S3: The MCU receives the data packets and the check codes of the data packets split from the firmware file, and checks the received data packets by the check codes of the data packets. Then, the MCU writes the data packets after the check is successfully completed into the memory. S4: After the single chip microcomputer writes all the data packets split into the firmware file into the memory, it receives the verification code of the firmware file, and verifies all the written data packets through the verification code of the firmware file. After the verification is successful, the firmware upgrade is completed.
10. The control method of a single chip microcomputer firmware upgrade system according to claim 9, characterized in that: After the firmware upgrade device sends the data packet and the check code of the current data packet to the microcontroller, the microcontroller verifies the received data packet through the check code and writes the verified data packet into the memory. Then the firmware upgrade device sends the next data packet and the check code of the data packet to the microcontroller.
Citation Information
Cited By
Firmware file burning method and system-on-chip
CN120196338A
