A method for upgrading multiple controllers based on OTA technology
Through the upgrade mode of server-terminal 1-terminal 2, wireless communication equipment and serial port communication is used to realize the simplified OTA program upgrade of multi-control units of underwater unmanned aerial vehicles, solving the labor-intensive and cost-effective problems in the existing technology, and is suitable for multi-control unit systems.
Patent Information
- Application Number
- CN202210476615.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-30
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2042-04-30
AI Technical Summary
In the underwater unmanned aircraft control system, the existing technology requires the placing of the aircraft on land or manned to perform wired upgrades, which is laborious and not suitable for large-scale aircraft. In the server-terminal mode, both control units need to have wireless communication functions, which increases costs.
The program upgrade mode of server-terminal 1-terminal 2 is adopted, and the upper computer and security control unit are connected to the wireless communication device, and the upgrade program is issued in segments and checked. The main control unit and security control unit use serial communication for data forwarding.
With limited wireless communication equipment, it is realized to simplify the upgrade of OTA programs of multiple control units, effectively utilize the aircraft space and reduce costs, and is suitable for systems of two or more control units.
Smart Images

Figure CN114980203B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of underwater unmanned vehicle control systems and relates to an upgrade method for multiple controllers based on OTA technology. Background Art
[0002] The control system of an underwater unmanned vehicle usually consists of a main control unit and a security control unit, and needs to be completely sealed to prevent water from entering. When the control system program needs to be upgraded, if a wired method is used to upgrade the program, the vehicle needs to be placed on land or someone needs to go underwater to connect the cable and then upgrade. The wired upgrade method is more troublesome and laborious, and it is even more unsuitable when the vehicle is heavy. Therefore, the use of OTA technology to upgrade the program is an ideal choice. Usually, the application scenario of OTA is the server-terminal mode, but the underwater unmanned vehicle consists of two control units and both control units need to be upgraded. If the server-terminal mode is used, both control units need to have wireless communication functions. In order to effectively utilize the vehicle space and reduce costs, the present invention proposes a program upgrade mode of server-terminal 1-terminal 2. Summary of the Invention
[0003] Technical problems to be solved
[0004] In order to avoid the shortcomings of the existing technology, the present invention proposes an upgrade method for multiple controllers based on OTA technology to solve the problem of realizing OTA program upgrade of multiple control units when the underwater unmanned vehicle control system has only one wireless communication device.
[0005] Technical Solution
[0006] A method for upgrading multiple controllers based on OTA technology, characterized by including a program upgrade host computer, wireless communication equipment, and underwater unmanned vehicles; the underwater unmanned vehicles have a security control unit with wireless communication capabilities and a main control unit without wireless communication capabilities, and the main control unit and the security control unit use serial port communication. The upgrade steps are as follows:
[0007] Step 1: When the control unit needs to be upgraded, first open the upgrade host computer and select the control unit to be upgraded. Then connect the upgrade host computer and the security control unit via wireless communication equipment. The host computer reads the upgrade file, obtains the valid data size of the file, and splits the data and calculates the checksum according to the RAM size of the control unit to be upgraded.
[0008] Step 2: The host computer sends an upgrade command to the security control unit via a wireless device, informing it of the upgrade size, total checksum, and upgrade frame number. The security control unit determines whether it is upgrading itself or the main control unit based on the upgrade command. If it is upgrading itself, it responds to the host computer's upgrade preparation instruction. If it is upgrading the main control unit, it enters the serial port transparent transmission mode and forwards all data between the host computer and the main control unit. After receiving the host computer program upgrade command, the main control unit responds. After receiving the response command, the host computer sends the upgrade program and checksum in segments.
[0009] Step 3: The control unit that receives the program places the received check code in the verification area set in the flash, and the program data in the upgrade area in the flash. After all programs are received, the program is verified. If the calculated check code of each segment is exactly the same as the check code sent by the host computer, it indicates that the program has been successfully sent. The upgrade area data is overwritten with the program area, the program upgrade is completed, and the host computer is notified.
[0010] The specific steps are:
[0011] Step 1) Establishing a wireless communication link: When a control unit of the controller needs to be upgraded, a wireless communication device that can communicate with the wireless communication device of the aircraft is connected to any available serial port of the computer;
[0012] Step 2) Test whether the wireless communication is successful: the host computer calls the computer serial port connected to the wireless communication device and sends a hexadecimal format message (0xAA, 0x06, 0x03, 0x00, 0xFF, 0xB4). The last byte is used as a check bit, which is equal to the lower 8 bits of the sum of the first 5 bytes of data in the message, that is, 0xB4 = (0xAA + 0x06 + 0x03 + 0x00 + 0xFF) & 0xFF; if a response message (0xAA, 0x06, 0x03, 0x00, 0xFF, 0xB4) returned by the control unit is received, it means that the host computer software and the control unit have successfully established a wireless communication link;
[0013] Step 3) Host computer operation:
[0014] 1. When the main control unit needs to be upgraded, select the main control unit option in the upgrade host interface; when the security control unit needs to be upgraded, select the security control unit option in the upgrade host interface;
[0015] 2. The host computer reads the binary program file to be upgraded on the local computer and calculates the effective data size of the file. It then segments the program into segments with a maximum size of 40K bytes and calculates the checksum for each segment.
[0016] Step 4) Program delivery: The host computer delivers a hexadecimal message to the security control unit via a wireless device. The message data includes the control unit of the program to be upgraded, the number of program segments to be delivered, and the check code for each segment.
[0017] After receiving the program upgrade message from the host computer, the security control unit calculates the message length Len and the sum of all data in the first Len-1 bytes of the message SUM, SUM = sum(1, Len-1); then the security unit verifies the validity of the message, that is, it determines whether the first byte is equal to 0xAA, the second byte is equal to Len, the third byte is equal to 0x10, and the last byte is equal to SUM; if all four conditions are met at the same time, the upgrade message is considered valid; otherwise, it is considered invalid and an invalid message (0xAA, 0x08, 0x10, 0x00, 0xFF, 0xFF, 0xFF, 0xBF) is sent to the host computer. After receiving the message, the host computer displays a pop-up window indicating an error message.
[0018] After the security unit determines that the message is valid, it determines whether it is a security unit upgrade or a main control unit upgrade based on the "MCU address". MCU is the address: 0x00 indicates a security unit; 0x01 indicates a main control unit. If it is a security unit upgrade, it responds to the host computer with a message that it is ready for the upgrade and stores the checksum and segment number of each program segment in the memory. The message format is as follows:
[0019]
[0020] If the security unit determines that the main control unit is being upgraded, it will enter the serial port transparent transmission mode. All subsequent data received from the host computer will be forwarded to the main control unit. It will not exit the transparent transmission mode until it receives the upgrade completion message. After receiving the program upgrade instruction from the host computer, the main control unit will store the check code and segment number of each program segment into the memory and respond. The message format is as follows:
[0021]
[0022] After receiving the response message, the host computer verifies the validity of the message. If the verification is valid, it will send the first program file and display the progress bar.
[0023] Step 5) Program reception and verification: The control unit that is currently upgrading the program puts the first segment of program data received into the upgrade area in the flash and calculates the cumulative sum CALC_CRC1 of all bytes of this segment of program. The control unit verifies each segment of program received during the program upgrade process. If the check code is inconsistent with the received check code, that is, CRC1 is not equal to CRC1, the above message is resent to notify the host computer to resend the program file of this segment.
[0024] CALC_CRC1 is equal to CRC1, which proves that the received data is correct. The control unit determines whether there is more data to be received based on the number of received program segments. If there is more than one segment, it sends a message in the following format to request the second segment of the program:
[0025] After receiving and verifying the message, the host computer sends the second program.
[0026] The control unit that is currently upgrading the program will place the second segment of the received program data into the upgrade area of the flash memory and calculate the cumulative sum of all bytes of this segment, CALC_CRC2. If CALC_CRC2 is equal to CRC2, it proves that the received data is correct. Similar to the judgment of the completion of the first segment, it determines whether there is more data to be received. If it is greater than the second segment, it sends a message in the following format to request the delivery of the third segment of the program:
[0027]
[0028] When the control unit completes receiving all programs and the verification code of each program segment is exactly the same as the verification code sent by the host computer, it indicates that all program files have been sent successfully. The control unit overwrites the upgrade area data with the program running area, and the program upgrade is completed. Then it sends a message to inform the host computer. After the host computer receives the message and verifies it, it displays a pop-up window of "Upgrade Successful" and the upgrade progress bar shows 100%; the message format is as follows:
[0029]
[0030]
[0031] The host computer message verification algorithm is as follows: the host computer calculates the message length Len and calculates the sum SUM of all data in the first Len-1 bytes of the message, SUM=sum(1, Len-1); then performs a validity check on the message, i.e., determines that the first byte is equal to 0xAA, the second byte is equal to 0x03, and the last byte is equal to SUM; if all three conditions are met at the same time, the upgrade message is determined to be valid.
[0032] Beneficial effects
[0033] The present invention proposes an upgrade method for multiple controllers based on OTA technology, and proposes a program upgrade mode of a server-terminal 1-terminal 2. When the control unit needs to perform a program upgrade, first open the upgrade host computer and select the control unit to be upgraded, and connect the upgrade host computer and the security control unit through a wireless communication device. The host computer reads the upgrade file, obtains the valid data size of the file, and performs data splitting and calculation of the check code according to the RAM size of the control unit to be upgraded. The host computer sends an upgrade instruction to the security control unit through the wireless device, informing the upgrade size, total check word, and number of upgrade frames. The security control unit determines whether it is upgrading itself or the main control unit according to the upgrade instruction. If it is upgrading itself, it responds to the host computer that it is ready for the upgrade; if it is upgrading the main control, it enters the serial port transparent transmission mode and forwards all data between the host computer and the main control unit. After receiving the program upgrade instruction from the host computer, the main control unit responds. After receiving the response instruction, the host computer sends the upgrade program and check code in segments. The control unit of the receiving program places the received check code in the verification area set in the flash, and the program data in the upgrade area in the flash. After all programs are received, the program is verified. If the calculated check code of each segment is exactly the same as the check code sent by the host computer, it indicates that the program has been successfully sent. The data in the upgrade area is overwritten with the program area, the program upgrade is completed and the host computer is notified.
[0034] The present invention solves the problem that when an underwater unmanned vehicle consists of two control units and both control units need to be upgraded, the server-terminal mode requires both control units to have wireless communication functions, effectively utilizes the space of the vehicle and reduces costs, makes the program upgrade of multiple controllers more simplified, and can be expanded to systems with more than two control units requiring program upgrades. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 :flow chart DETAILED DESCRIPTION
[0036] The present invention will now be further described with reference to the embodiments and accompanying drawings:
[0037] An OTA-based multi-controller upgrade system includes a program upgrade host computer, wireless communication equipment, an underwater unmanned vehicle security control unit with wireless communication capabilities, and a main control unit without wireless communication capabilities. The main control unit and the security control unit communicate via serial ports. The program upgrade technical solution is as follows:
[0038] 1. Establish a wireless communication link
[0039] When it is necessary to upgrade the program of a control unit of the controller, first open the upgrade host computer on the computer where the upgrade host computer software is installed; connect a wireless communication device that can communicate with the wireless communication device of the aircraft to any available serial port of the computer;
[0040] 2. Test whether wireless communication is successful
[0041] Click the "Connect" button in the upgraded host software. The host computer calls the computer serial port connected to the wireless communication device and sends a hexadecimal format message (0xAA, 0x06, 0x03, 0x00, 0xFF, 0xB4). The last byte is used as a check bit, which is equal to the lower 8 bits of the sum of the first 5 bytes of data in the message, that is, 0xB4 = (0xAA + 0x06 + 0x03 + 0x00 + 0xFF) & 0xFF. If a response message (0xAA, 0x06, 0x03, 0x00, 0xFF, 0xB4) is received from the control unit, it indicates that the host software and the control unit have successfully established a wireless communication link.
[0042] 3. Host computer operation
[0043] A. When the main control unit needs to be upgraded, select the main control unit option in the upgrade host computer interface; when the security control unit needs to be upgraded, select the security control unit option in the upgrade host computer interface.
[0044] B. The host computer reads the binary program file to be upgraded on the local computer and calculates the effective data size of the file. It then segments the program into segments with a maximum size of 40K bytes and calculates the checksum for each segment.
[0045] For example: if the total file size is 76KB, it is divided into two segments, the first segment is 40KB long, and the second segment is 36KB long; if the total file size is 90KB, it is divided into three segments, the first segment is 40KB long, the second segment is 40KB long, and the third segment is 10KB long; the checksum is equal to the lower 8 bits of the sum of all the data in the segment, that is, checksum = sum(1,size)&0xff(size: the size of each segment);
[0046] 4. Program issuance
[0047] Click the "Start Program Upgrade" button on the host computer, and the host computer will send a hexadecimal message to the security control unit through the wireless device. The message data includes the control unit of the program to be upgraded, the number of program segments to be sent, and the check code of each segment. The message format sent is illustrated by two segments:
[0048]
[0049] MCU address: 0x00 indicates the security unit; 0x01 indicates the main control unit;
[0050] Code segment number: 0x02 means the program is divided into 2 segments;
[0051] The first CRC segment: represents the checksum of the first segment of the program;
[0052] The second CRC segment: represents the checksum of the second segment of the program;
[0053] Cumulative sum: 0x1B = (0xAA + 0x08 + 0x10 + 0x00 + 0x02 + 0x12 + 0x45) & 0xFF;
[0054] After receiving the program upgrade message from the host computer, the security control unit calculates the message length Len and the sum of all data in the first Len-1 bytes of the message SUM, SUM = sum(1, Len-1); then the security unit verifies the validity of the message, that is, it determines whether the first byte is equal to 0xAA, the second byte is equal to Len, the third byte is equal to 0x10, and the last byte is equal to SUM; if all four conditions are met at the same time, the upgrade message is considered valid; otherwise, it is considered invalid and an invalid message (0xAA, 0x08, 0x10, 0x00, 0xFF, 0xFF, 0xFF, 0xBF) is sent to the host computer. After receiving the message, the host computer displays a pop-up window indicating an error message.
[0055] After the security unit determines that the message is valid, it determines whether it is a security unit upgrade or a main control unit upgrade based on the "MCU address" (MCU address: 0x00 indicates a security unit upgrade; 0x01 indicates a main control unit upgrade). If it is a security unit upgrade, it responds to the host computer with a message indicating that it is ready for upgrade and stores the checksum and segment number of each program segment in the memory. The message format is as follows:
[0056]
[0057] If the security unit determines that the main control unit is being upgraded, it will enter the serial port transparent transmission mode, and all subsequent data received from the host computer will be forwarded to the main control unit. It will not exit the transparent transmission mode until it receives the upgrade completion message. After receiving the host computer program upgrade instruction, the main control unit will store the check code and segment number of each program segment into the memory and respond. The message format is as follows:
[0058]
[0059]
[0060] After receiving the response message, the host computer performs a message validity check. If the verification is valid, it will send the first program file and display the sending progress bar.
[0061] The host computer message verification algorithm is as follows:
[0062] The host computer calculates the message length Len and the sum SUM of all data in the first Len-1 bytes of the message, where SUM = sum(1, Len-1). It then performs a validity check on the message, determining whether the first byte is equal to 0xAA, the second byte is equal to 0x03, and the last byte is equal to SUM. If all three conditions are met, the upgrade message is considered valid.
[0063] 5. Program reception and verification
[0064] The control unit that is currently upgrading the program will place the first received program data into the upgrade area in the flash memory and calculate the cumulative sum of all bytes of this program, CALC_CRC1. During the upgrade process, the control unit will verify each received program segment. If the verification code is inconsistent with the received verification code, that is, CRC1 is not equal to CRC1, the control unit will resend the above message to notify the host computer to resend the program file for this segment.
[0065] CALC_CRC1 is equal to CRC1, which proves that the received data is correct. The control unit determines whether there is more data to be received based on the number of received program segments. If there is more than one segment, it sends a message in the following format to request the second segment of the program:
[0066]
[0067] After receiving and verifying the message, the host computer sends the second program.
[0068] The control unit that is currently upgrading the program will place the second segment of the received program data into the upgrade area of the flash memory and calculate the cumulative sum of all bytes of this segment, CALC_CRC2. If CALC_CRC2 is equal to CRC2, it proves that the received data is correct. Similar to the judgment of the completion of the first segment, it determines whether there is more data to be received. If it is greater than the second segment, it sends a message in the following format to request the delivery of the third segment of the program:
[0069]
[0070] When the control unit completes receiving all programs and the verification code of each program segment is exactly the same as the verification code sent by the host computer, it indicates that all program files have been sent successfully. The control unit will overwrite the upgrade area data with the program running area, and the program upgrade is completed. Then it sends a message to inform the host computer. After the host computer receives the message and verifies it, it will display a pop-up window of "Upgrade Successful" and the upgrade progress bar will show 100%. The message format is as follows:
[0071]
[0072] The present invention simplifies the program upgrade of multiple controllers and can be extended to a system with more than two control units for program upgrade.
Claims
1. A method for upgrading multiple controllers based on OTA technology, characterized in that The system includes a program upgrade host computer, wireless communication equipment, and an underwater unmanned vehicle; the underwater unmanned vehicle includes a security control unit with wireless communication function and a main control unit without wireless communication function, and the main control unit and the security control unit use serial port communication. The specific steps are as follows: Step 1) Establishing a wireless communication link: When a control unit of the controller needs to be upgraded, a wireless communication device that can communicate with the wireless communication device of the aircraft is connected to any available serial port of the computer; Step 2) Test whether the wireless communication is successful: the host computer calls the computer serial port connected to the wireless communication device and sends a hexadecimal format message (0xAA, 0x06, 0x03, 0x00, 0xFF, 0xB4). The last byte is used as a check bit, which is equal to the lower 8 bits of the sum of the first 5 bytes of data in the message, that is, 0xB4 = (0xAA + 0x06 + 0x03 + 0x00 + 0xFF) & 0xFF; if a response message (0xAA, 0x06, 0x03, 0x00, 0xFF, 0xB4) returned by the control unit is received, it means that the host computer software and the control unit have successfully established a wireless communication link; Step 3) Host computer operation:
1. When the main control unit needs to be upgraded, select the main control unit option in the upgrade host interface; when the security control unit needs to be upgraded, select the security control unit option in the upgrade host interface; 2. The host computer reads the binary program file to be upgraded on the local computer and calculates the effective data size of the file. It then segments the program into segments with a maximum size of 40K bytes and calculates the checksum for each segment. Step 4) Program delivery: The host computer delivers a hexadecimal message to the security control unit via a wireless device. The message data includes the control unit of the program to be upgraded, the number of program segments to be delivered, and the check code for each segment. After receiving the program upgrade message from the host computer, the security control unit calculates the message length Len and the sum of all data in the first Len-1 bytes of the message SUM, SUM = sum(1, Len-1); then the security control unit verifies the validity of the message, that is, determines whether the first byte is equal to 0xAA, the second byte is equal to Len, the third byte is equal to 0x10, and the last byte is equal to SUM; if all four conditions are met at the same time, the message is considered valid; otherwise, it is considered invalid and an invalid message (0xAA, 0x08, 0x10, 0x00, 0xFF, 0xFF, 0xFF, 0xBF) is sent to the host computer. After receiving the message, the host computer displays a pop-up window indicating an error message. After the security control unit determines that the message is valid, it determines whether it is a security control unit upgrade or a main control unit upgrade based on the MCU address. MCU is the address: 0x00 indicates the security control unit; 0x01 indicates the main control unit. If it is a security control unit upgrade, it responds to the host computer with a message that it is ready for upgrade and stores the check code and segment number of each program segment in the memory. The message format is as follows: Data header 0xAA Identifier 0x03 MCU address 0x00 Code segment number 0x01 First segment CRC 0x12 Accumulated sum 0xED If the security control unit determines that the upgrade is for the main control unit, it will enter the serial port transparent transmission mode. All subsequent data received from the host computer will be forwarded to the main control unit. All data received from the main control unit will be forwarded to the host computer until the upgrade completion message is received. The transparent transmission mode will not be exited until the main control unit receives the host computer program upgrade instruction. After receiving the host computer program upgrade instruction, the main control unit will store the check code and segment number of each program segment into the memory and respond. The message format is as follows: Data header 0xAA Identifier 0x03 MCU address 0x01 Code segment number 0x01 First segment CRC 0x12 The cumulative sum is 0xEE After receiving the response message, the host computer verifies the validity of the message. If the verification is valid, it will send the first program file and display the progress bar. Step 5) Program reception and verification: The control unit that is currently upgrading the program puts the first segment of program data received into the upgrade area in the flash and calculates the cumulative sum CALC_CRC1 of all bytes of this segment of program. The control unit verifies each segment of program received during the program upgrade process. If the checksum is inconsistent with the received checksum, that is, CALC_CRC1 is not equal to CRC1, the above message is resent to notify the host computer to resend the program file. CALC_CRC1 is equal to CRC1, which proves that the received data is correct. The control unit determines whether there is more data to be received based on the number of received program segments. If there is more than one segment, it sends a message in the following format to request the second segment of the program: Data header 0xAA Identifier 0x03 MCU address 0xxx Code segment number 0x02 First segment CRC 0x45 The cumulative sum is 0xEE After receiving and verifying the message, the host computer sends the second program. The control unit that is currently upgrading the program will place the second segment of the received program data into the upgrade area of the flash memory and calculate the cumulative sum of all bytes of this segment, CALC_CRC2. If CALC_CRC2 is equal to CRC2, it proves that the received data is correct. Similar to the judgment of the completion of the first segment, it determines whether there is more data to be received. If it is greater than the second segment, it sends a message in the following format to request the delivery of the third segment of the program: Data header 0xAA Identifier 0x03 MCU address 0xxx Code segment number 0x03 First segment CRC 0x45 The cumulative sum is 0xEE When the control unit completes receiving all programs and the verification code of each program segment is exactly the same as the verification code sent by the host computer, it indicates that all program files have been sent successfully. The control unit overwrites the upgrade area data with the program running area, and the program upgrade is completed. Then it sends a message to inform the host computer. After the host computer receives the message and verifies it, it displays a pop-up window indicating that the upgrade is successful and the upgrade progress bar shows 100%. The message format is as follows: Data header 0xAA Identifier 0x03 MCU address 0xxx Code segment number 0xff The last CRC segment is 0x12 The accumulated sum is 0xEE.
2. The method for upgrading multiple controllers based on OTA technology according to claim 1, characterized in that: The host computer message verification algorithm is as follows: the host computer calculates the message length Len and calculates the sum SUM of all data in the first Len-1 bytes of the message, SUM=sum(1, Len-1); then performs a validity check on the message, i.e., determines that the first byte is equal to 0xAA, the second byte is equal to 0x03, and the last byte is equal to SUM; if all three conditions are met at the same time, the message is determined to be valid.
Citation Information
Patent Citations
Electronic device information transmission method
CN103942080A
Method, device and system for stably realizing batch OTA upgrading of terminal equipment, and equipment
CN110769411A