Software parallel upgrading method and system based on multiple CANFD channels and medium thereof
The software upgrade method, which uses parallel transmission of multiple CANFD channels and a dual verification mechanism, solves the problems of low efficiency and insufficient real-time performance in traditional CAN bus upgrade methods, and achieves efficient, accurate and rapid upgrades for multiple devices simultaneously.
Patent Information
- Application Number
- CN202511480944.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-16
- Publication Date
- 2025-11-21
AI Technical Summary
Traditional CAN bus software upgrade methods have limitations in data transmission rate and bandwidth, which cannot meet the needs of high data volume and multi-task parallel processing, resulting in high upgrade time cost and easy errors, and failing to meet real-time requirements.
A software parallel upgrade method based on multiple CANFD channels is adopted, which transmits upgrade files in parallel through multiple CANFD channels and introduces a dual verification mechanism to ensure the accuracy and efficiency of upgrade files, rewriting only the erroneous areas rather than rewriting the entire file.
It enables simultaneous upgrades of multiple terminal devices without host intervention, improving upgrade efficiency, reducing programming time, and ensuring the accuracy and stability of the upgrade process.
Smart Images

Figure CN120994227A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of software upgrading, in particular to a software parallel upgrading method and system based on multiple CANFD channels and a medium thereof. BACKGROUND
[0002] With the development of intelligence in recent years, the application requirements of high-speed data transmission and large data volume in the field of intelligent manufacturing are becoming higher and higher, and the control devices in the field of automobile electronics and robots are becoming more and more diversified. The software upgrading method based on the traditional CAN bus has certain limitations in terms of data transmission rate and bandwidth. In high data volume and busy network, the delay and queuing time of messages increase, and especially when dealing with multiple tasks that need to be processed in parallel or upgrading programs at the same time, the efficiency is very low.
[0003] The current traditional upgrading method is to use a host computer to control the software upgrading of multiple terminal devices. The host computer sends single package upgrading programs to terminal devices in sequence according to the ID of the terminal device, and the terminal device program is written and verified. This can avoid conflicts on the bus and ensure that the upgrading is completed in sequence. However, it also brings the impact of spending a lot of upgrading time cost, which cannot meet the requirements of real-time scenes, such as simultaneous upgrading of multiple terminal devices or simultaneous sending of emergency tasks. Moreover, if the software fails to be written and verified in the terminal device, the complete upgrading scheme needs to be re-executed, which consumes more time. SUMMARY
[0004] The main purpose of the embodiments of the present application is to provide a software parallel upgrading method and system based on multiple CANFD channels and a medium thereof. The multiple CANFD channel data transmission realizes simultaneous software upgrading of multiple terminal devices without the intervention of the host computer, improves the upgrading efficiency, adds a double verification mechanism to ensure the accuracy during the upgrading process, and only needs to write the wrong address area without rewriting the entire software program after the writing error, thereby reducing the writing time.
[0005] To achieve the above purpose, the first aspect of the embodiments of the present application provides a software parallel upgrading method based on multiple CANFD channels, which is applied to a software parallel upgrading system. The software parallel upgrading system includes a lower computer and multiple terminal devices. The lower computer includes multiple CANFD channels. The CANFD channels and the terminal devices are connected in a frame transmission mode. The memory of the lower computer is provided with a receiving writing area. The method includes the following steps: The lower computer obtains an upgrading file and caches the upgrading file to the receiving writing area; The lower computer performs file checking on the upgrade file to obtain a first checking result, and if the first checking result represents that the checking is correct, frame information of the upgrade file is distributed in parallel to the plurality of terminal devices based on a CANFD channel, the frame information including a plurality of data frames and a burn format between the plurality of data frames; After each terminal device receives the frame information, the plurality of data frames are burned to a storage space according to the burn format, and data checking is performed on burn addresses of the plurality of data frames to obtain a second checking result, if the second checking result represents that the checking is incorrect, first error information including the error burn address of the incorrect checking is fed back to the lower computer; The lower computer receives the first error information, matches the first retransmission data frame corresponding to the upgrade file in the receiving and burning area according to the error burn address, and sends the first retransmission data frame to the terminal device that feeds back the first error information.
[0006] Further, in some embodiments, the software parallel upgrade system further includes an upper computer, the upper computer and the lower computer are in communication connection, a communication mode between the upper computer and the lower computer is PXI bus communication, before the lower computer obtains the upgrade file, the method further includes: The upper computer responds to a request for software upgrade, and determines one or more target files to be burned according to the request; The upper computer packs and reorganizes the one or more target files to obtain the upgrade file, and sends the upgrade file in the form of packet transmission to the lower computer.
[0007] Further, in some embodiments, the upper computer packs and reorganizes the one or more target files to obtain the upgrade file, including the following steps: Data grouping is performed on the one or more target files to obtain a plurality of data packets, byte data of a single target file is stored in each data packet, packet header data of the data packet includes an identification number, and packet body data of the data packet includes a data frame; The identification number and the data frame of each data packet are checked respectively, if the checking is passed, each data packet is packaged according to a preset priority order to obtain the upgrade file, and if the checking is not passed, new data packets are obtained by re-grouping the target file, and the identification number and the data frame of the new data packets are checked.
[0008] Further, in some embodiments, the lower computer performs file checking on the upgrade file to obtain a first checking result, including: The plurality of data packets in the upgrade file are received one by one in the form of packet transmission; After receiving each data packet, the data packet is unpacked to obtain packet header data and packet body data of the data packet, and data checking is performed on the packet body data according to the packet header data to obtain a third checking result corresponding to the data packet; If all the third check results corresponding to the data packets represent no error, it is determined that the first check result represents no error. If one or more third check results corresponding to the data packets represent error, it is determined that the first check result represents error.
[0009] Further, in some embodiments, the memory of the lower machine is also provided with an error burning area, and the method further comprises: If the first check result represents error, the lower machine determines the data packet whose third check result represents error as an error data packet, and stores the error data packet in the error burning area; The lower machine feeds back the error data packet to the upper machine through the PXI bus; The upper machine matches the corresponding new data packet according to the error data packet, and retransmits the new data packet to the lower machine; The lower machine receives the new data packet, and overwrites the new data packet in the cache position corresponding to the error data packet in the receiving burning area.
[0010] Further, in some embodiments, after the lower machine receives the first error information, the method further comprises: The first error information is filled into the error burning area; If the lower machine receives the second error information fed back by the terminal device, the second error information is compared with the first error information, and when the second error information is different from the first error information, the second error information is filled into the error burning area.
[0011] Further, in some embodiments, after the lower machine receives the second error information from the terminal device, the method further comprises: When the second error information is the same as the first error information, the lower machine transmits the second error information to the upper machine; The upper machine matches the corresponding second retransmission data frame according to the second error information, and feeds back the second retransmission data frame to the lower machine; The lower machine receives the second retransmission data frame, overwrites the second retransmission data frame in the corresponding cache position in the receiving burning area, and sends the second retransmission data frame to the terminal device feeding back the second error information.
[0012] To achieve the above object, a second aspect of the embodiment of the application provides a software parallel upgrading system, which comprises: A lower machine and a plurality of terminal devices, the lower machine comprising a plurality of CANFD channels, the CANFD channels being connected with the terminal devices in a frame transmission mode, and the memory of the lower machine being provided with a receiving burning area; The lower computer is configured to obtain the upgrade file, cache the upgrade file to a receiving burning area, and perform file verification on the upgrade file to obtain a first verification result. If the first verification result indicates that the verification is correct, frame information of the upgrade file is distributed in parallel to the plurality of terminal devices based on a CANFD channel. The frame information includes a plurality of data frames and a burning format between the plurality of data frames. The terminal device is configured to burn the plurality of data frames to a storage space according to the burning format after receiving the frame information, perform data verification on burning addresses of the plurality of data frames to obtain a second verification result, and feed back first error information to the lower computer if the second verification result indicates that the verification is incorrect. The first error information includes error burning addresses that are incorrect. The lower computer is further configured to receive the first error information, match new data frames corresponding to the upgrade file in the receiving burning area according to the error burning addresses, and send the new data frames to the terminal device that feeds back the error burning addresses.
[0013] Further, in some embodiments, the software parallel upgrade system further includes: The upper computer is in communication connection with the lower computer, and the communication manner between the upper computer and the lower computer is PXI bus communication. The upper computer is configured to determine one or more target files to be burned according to a request for software upgrade in response to the request, pack and recombine the one or more target files to obtain the upgrade file, and send the upgrade file to the lower computer in the form of packet transmission.
[0014] To achieve the above object, a third aspect of the embodiments of the present application provides a storage medium, which is a computer readable storage medium, and stores a computer program. The computer program is executed by a processor to implement the software parallel upgrade method of the first aspect of the embodiments.
[0015] In the embodiments of the present application, the following beneficial effects are achieved: the present application obtains an upgrade file through a lower machine, caches the upgrade file to a receiving burning area, performs file checking on the upgrade file to obtain a first checking result, if the first checking result represents that the checking is correct, distributes frame information of the upgrade file to a plurality of terminal devices in parallel based on a CANFD channel, the frame information includes a plurality of data frames and a burning format between the plurality of data frames, and then realizes simultaneous software upgrade of the plurality of terminal devices through a plurality of CANFD channel data transmissions, without the intervention of a host computer, thereby improving upgrade efficiency; then, after each terminal device receives the frame information, the plurality of data frames are burned to a storage space according to the burning format, and data checking is performed on burning addresses of the plurality of data frames to obtain a second checking result, if the second checking result represents that the checking is incorrect, first error information is fed back to the lower machine, and then the accuracy in the upgrade process is ensured by adding a double checking mechanism; the lower machine receives the first error information, matches a first retransmission data frame corresponding to the upgrade file in the receiving burning area according to an error burning address, and sends the first retransmission data frame to the terminal device that feeds back the first error information, and then the entire software program after burning error does not need to be burned again, only the address area of the burning error needs to be burned, thereby reducing the burning time. BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1 is an optional flowchart of the software parallel upgrade method based on the multiple CANFD channels provided by the embodiments of the present application; Figure 2 is another optional flowchart of the software parallel upgrade method based on the multiple CANFD channels provided by the embodiments of the present application; Figure 3 is an optional flowchart of the software parallel upgrade method based on the multiple CANFD channels provided by the embodiments of the present application; Figure 1 is an optional flowchart before step S101 in the method; Figure 4 is an optional flowchart of the software parallel upgrade method based on the multiple CANFD channels provided by the embodiments of the present application; Figure 3 is an optional flowchart of step S302 in the method; Figure 5 is an optional flowchart of the software parallel upgrade method based on the multiple CANFD channels provided by the embodiments of the present application; Figure 3 is another optional flowchart of step S302 in the method; Figure 6 is an optional schematic diagram of data grouping of a target file provided by the embodiments of the present application; Figure 7 is an optional flowchart of the software parallel upgrade method based on the multiple CANFD channels provided by the embodiments of the present application; Figure 1 is an optional flowchart of step S102 in the method; Figure 8 is an optional flowchart after the lower machine performs file checking on the upgrade file provided by the embodiments of the present application; Figure 9is an optional flowchart provided by the embodiment of the present application after the lower computer receives the first error information; Figure 10 is an optional flowchart provided by the embodiment of the present application after the lower computer compares the second error information with the first error information; Figure 11 is an optional structure diagram of the software parallel upgrading system provided by the embodiment of the present application; Figure 12 is an optional hardware structure schematic diagram of the electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application.
[0018] In the description of the present application, it should be understood that the orientation description, such as the orientation or position relationship indicated by up, down, front, back, left, right, etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application.
[0019] It should also be noted that in the description of the present application, the meaning of several is more than one, the meaning of multiple is more than two, greater than, less than, more than, etc. are understood as not including the number, above, below, etc. are understood as including the number. If it is described as first, second, it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features or the sequence of indicated technical features.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0021] In the description of the present application, the description of the terms "one embodiment", "some embodiments", "exemplary embodiment", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the description, the exemplary description of the above terms does 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.
[0022] With the development of intelligence in recent years, the application demand for high-speed data transmission and large data volume in the field of intelligent manufacturing is getting higher and higher, and the control equipment in the field of automobile electronics and robots is becoming more and more diversified. The software upgrade method by traditional CAN bus has certain limitations in data transmission rate and bandwidth, and in high data volume and busy network, the delay and queuing time of messages increase, especially when dealing with multiple tasks that need to be processed in parallel or upgrading programs at the same time, the efficiency is very low.
[0023] The traditional upgrade method is to use a host computer to control the software upgrade of multiple terminal devices. The single package upgrade program is sent in sequence according to the terminal device ID, and the terminal device program is written and verified. This can avoid conflicts on the bus and ensure that the upgrade is completed in sequence, but it also brings the impact of spending a lot of upgrade time cost, which cannot meet the requirements of real-time scenarios, such as simultaneous upgrade of multiple terminal devices or simultaneous issuance of emergency tasks. Moreover, if the software fails to burn and verify in the terminal device, the complete upgrade scheme needs to be re-executed, which consumes more time.
[0024] Therefore, the application provides a software parallel upgrade method and system based on multiple CANFD channels and a medium thereof. The software of multiple terminal devices is upgraded simultaneously through multiple CANFD channel data transmission without the intervention of a host computer, which improves the upgrade efficiency and adds a double verification mechanism to ensure the accuracy of the upgrade process. Moreover, only the address area with errors needs to be burned, which reduces the burning time.
[0025] The application embodiment provides a software parallel upgrade method and system based on multiple CANFD channels and a medium thereof. The following embodiments are used for illustration.
[0026] In the first aspect, a software parallel upgrade method based on multiple CANFD channels is described.
[0027] Referring to Figure 1 and Figure 2 , Figure 1 is an optional flowchart of the software parallel upgrade method based on multiple CANFD channels provided by the application embodiment, Figure 2is another optional flowchart of the software parallel upgrading method based on the multiple CANFD channels provided in the application, which is applied to a software parallel upgrading system, the software parallel upgrading system comprising an upper computer, a lower computer, and multiple terminal devices, the lower computer comprising multiple CANFD channels, the CANFD channels being in a frame transmission mode of communication connection with the terminal devices, the upper computer being in communication connection with the lower computer, the communication mode between the upper computer and the lower computer being PXI bus communication, the memory of the lower computer being provided with a receiving and burning area and an error burning area, and the method can comprise but is not limited to steps S101 to S104.
[0028] Step S101: The lower computer acquires an upgrading file and caches the upgrading file to the receiving and burning area.
[0029] In a possible embodiment, in order to more efficiently manage and utilize storage resources, a file partition system is designed in the lower computer, taking a double data rate synchronous dynamic random access memory (DDR) as an example, the lower computer splits the DDR into a receiving and burning area DDRF0 and an error burning area DDRF1. Such partition design can realize effective isolation and management of different state files. After acquiring the upgrading file, the lower computer caches it to the receiving and burning area DDRF0, which is a region specially reserved for receiving and preparing to burn the file, providing a stable data storage basis for subsequent file processing and distribution operations.
[0030] Step S102: The lower computer performs file verification on the upgrading file to obtain a first verification result, and if the first verification result represents that the verification is correct, the frame information of the upgrading file is distributed in parallel to the multiple terminal devices based on the CANFD channels.
[0031] The frame information comprises multiple data frames and a burning format between the multiple data frames.
[0032] It should be noted that the lower computer performs file verification on the upgrading file to ensure the integrity and correctness of the file. If the first verification result represents that the verification is correct, it means that the upgrading file acquired by the lower computer does not have data loss, and the next operation can be performed. At this time, the lower computer distributes the frame information of the upgrading file to the multiple terminal devices in parallel through the CANFD channels. The advantage of this parallel distribution mode is that it can improve the data transmission efficiency and realize that multiple devices receive the upgrading file information at the same time, thereby improving the overall upgrading speed and collaboration of the system.
[0033] Step S103: After each terminal device receives the frame information, the multiple data frames are burned to the storage space according to the burning format, and the burning addresses of the multiple data frames are verified to obtain a second verification result, and if the second verification result represents that the verification is incorrect, the first error information is fed back to the lower computer.
[0034] The first error information includes an error writing address.
[0035] Specifically, after the terminal device receives the frame information of the upgrade file distributed in parallel by the lower machine through the CANFD channel, the terminal device first writes a plurality of data frames to the storage space Flash of the terminal device in sequence according to a preset writing format. The writing format can include specific frame start identifier, data length specification, frame sequence number arrangement and other parameters to ensure that the data can be accurately stored in the corresponding position. During the writing process, the terminal device records the writing address of each data frame. After all the data frames are written, the terminal device starts a data checking program for the writing addresses. The checking method can use an algorithm such as CRC checking to calculate and compare the check values of the actual writing data and the expected data, thereby obtaining a second check result. If the second check result indicates that the check is incorrect, that is, there is a data writing error or a storage error, the terminal device generates first error information including detailed error information. The first error information includes error writing address, frame sequence number, error type and other key contents to accurately locate the problem by the lower machine. Then, the terminal device feeds back the first error information to the lower machine through the pre-set CANFD channel.
[0036] Step S104: The lower machine receives the first error information, matches the first retransmission data frame corresponding to the upgrade file in the receiving writing area according to the error writing address, and sends the first retransmission data frame to the terminal device that feeds back the first error information.
[0037] It should be noted that there are multiple CANFD channels in the lower machine. The TSALL function of the CANFD channel is used to realize the function of sending multiple frames at a time, realize the upgrade function of multiple terminal devices, and does not need software and CPU intervention, effectively reducing the CPU resource and software overhead problem, making the overall operation efficiency of the lower machine higher.
[0038] In one possible embodiment, when the lower machine receives the first error information sent by the terminal device via the CANFD channel, since the error information contains the key content of the error burning address of the terminal device during the data burning process, it provides a basis for the lower machine to accurately locate the problem data. The lower machine triggers its internal retransmission mechanism immediately upon receiving the error information. First, the lower machine will carry out data retrieval operation in the received burning area according to the error burning address, aiming to match the first retransmission data frame in the upgrade file corresponding to the error address. This process involves address mapping and data matching, ensuring accurate extraction of the required retransmission data frame from the massive data in the received burning area. After successfully matching the first retransmission data frame, the lower machine re-sends the first retransmission data frame to the terminal device that sent the first error information through the same communication channel (CANFD channel) as before. The entire retransmission process follows strict data transmission specifications and timing requirements, ensuring that the terminal device can accurately receive and process the retransmission data, thereby making up for the error in the initial burning process, effectively improving the reliability and stability of the entire system in the multi-terminal device upgrade scenario, providing key support for ensuring data transmission integrity and upgrade success rate, and avoiding the need for the terminal device to re-burn the entire software program after burning errors. Only the error address area needs to be burned, solving the problem of excessive time required for re-burning.
[0039] Further, referring to Figure 3 , it is an optional flowchart provided by the embodiments of the present application before step S101 in the method, which can include but is not limited to steps S301 to S302. Figure 3 Figure 1 Step S301: The upper machine responds to the request for software upgrade and determines one or more target files to be burned according to the request.
[0040] Step S302: The upper machine packs and reorganizes the one or more target files to obtain an upgrade file, and sends the upgrade file to the lower machine in the form of packet transmission.
[0041] Step S302: The upper machine packs and reorganizes the one or more target files to obtain an upgrade file, and sends the upgrade file to the lower machine in the form of packet transmission.
[0042] In one possible embodiment, when a user or system triggers a software upgrade request, the host computer responds immediately. This request may be issued through a user interface, a pre-defined upgrade plan, or a remote command. Upon receiving the request, the host computer activates its internal upgrade management module to parse the request. During parsing, the host computer retrieves and determines one or more target files to be burned from a pre-defined file repository or remote server based on key parameters such as the target device type, software version information, and upgrade requirements contained in the request. These target files can be application files, firmware files, configuration files, etc., covering all necessary components required for terminal device software upgrades. After determining the target files, the host computer enters the file processing stage. To ensure the integrity and compatibility of the upgrade files, it performs a packaging and reassembly operation on these target files. During packaging, the host computer will divide the upgrade files into packets based on the target device's storage capacity, communication protocol, and other characteristics. The packet transmission can be divided into fixed-size data packets or segmented according to the logical structure of the file content. In this way, the upgrade file is split into multiple smaller data packets, each containing specific identification and sequence information so that the lower-level computer can accurately receive and reassemble them. The host computer generates upgrade files and sends them to the slave computer in packets via the selected communication channel (CANFD channel). During transmission, the host computer also monitors the transmission status in real time, detects and corrects any possible transmission errors, and ensures that the upgrade files are delivered to the slave computer completely and accurately, laying the foundation for subsequent upgrade operations.
[0043] Furthermore, refer to Figure 4 and Figure 5 As shown, Figure 4 This is provided by the embodiments of this application. Figure 3 An optional flowchart for step S302, Figure 5 This is provided by the embodiments of this application. Figure 3 Another optional flowchart for step S302, the method may include, but is not limited to, steps S401 to S402.
[0044] Step S401: Group one or more target files into data packets to obtain multiple data packets.
[0045] Each data packet contains byte data of a single target file; the packet header data includes the selected CANFD channel number, the total number of data packets in the file, the current data packet's sort number in the file, the current data packet's write address, the data payload (maximum 48 bytes, data with a payload less than 48 bytes is padded with zeros), the packet checksum, and the identifier (SN); the packet body data includes the data frame.
[0046] Step S402: check the identification number and data frame of each data packet respectively, if the check is passed, package each data packet according to the preset priority order to obtain the upgrade file; if the check is not passed, re-group the target file to obtain new data packets and check the identification number and data frame of the new data packets.
[0047] In one possible embodiment, referring to Figure 6 , Figure 6 is an optional schematic diagram provided by the embodiments of the present application for data grouping of target files. When the host computer determines one or more target files, it enters the file processing stage. First, data grouping operation is performed on the target files, the purpose of which is to split each target file into multiple data blocks that are easy to manage and transmit, and the data blocks are divided according to the set data block size (the size of each data block is 48 bytes), and each data block is encapsulated into a data packet Fn (n corresponds to the file number of the target file). Then, the identification number and data frame of each data packet Fn are checked, the check value of each data packet is calculated and compared with the check value of the original file, and then for the data packets that pass the check, the host computer packages them according to the preset priority order to obtain the upgrade file BF; if the check is not passed, the target file is re-grouped to obtain new data packets and the identification number and data frame of the new data packets are checked.
[0048] The priority order can be set according to system criticality, dependency relationship or user-defined rules, for example: there are three target files MSG0, MSG1 and MSG2, and the corresponding priority of MSG0, MSG1 and MSG2 is 1, 2 and 3, then the package form of the upgrade file BF can be [F0-MSG0 data packet, F1-MSG0 data packet, F1-MSG1 data packet, F2-MSG0 data packet, F2-MSG1 data packet, F2-MSG2 data packet].
[0049] It should be noted that the host computer transmits the upgrade file BF to the lower computer through the PXI bus DMA mode according to the entire package of 4096 bytes (corresponding to 128 data packets), the efficiency of the PXI bus in transferring 4096 byte blocks reaches about 72%, only about 350us (there are protocol overhead, bus competition and other factors) of time is needed, compared with the time of 500us required for sending 64*64 byte blocks, the transmission efficiency is improved.
[0050] Referring to Figure 7 , Figure 7 is an optional flowchart of step S102 in Figure 1 the embodiments provided by the present application, which can include but is not limited to steps S701 to S703.
[0051] Step S701: Receive multiple data packets from the upgrade file one by one in the form of packet transmission.
[0052] Step S702: If the third verification result corresponding to all data packets is characterized as error-free, then the first verification result is determined to be error-free.
[0053] Step S703: If the third verification result corresponding to one or more data packets indicates that the verification is incorrect, then the first verification result will be determined to be incorrect.
[0054] In one possible embodiment, the lower-level machine receives multiple data packets sent by the upper-level machine one by one in the form of packet transmission. Each data packet may be subject to interference or damage during transmission, thus requiring strict verification. Upon receiving each data packet, the lower-level machine immediately starts a verification program, calculates the checksum of the received data packet, and compares it with the checksum embedded in the data packet to obtain the third verification result for each data packet. This result is cached in real time in the receive / write area for subsequent statistical processing. After the lower-level machine has received all data packets, it enters the verification result analysis stage. The lower-level machine scans and counts all the third verification results in the receive / write area one by one. If the third verification results corresponding to all data packets indicate that the verification is error-free, that is, the checksums of all data packets are consistent and no errors have occurred, then the first verification result is determined to be error-free. At this time, the lower-level machine reassembles these data packets into a complete upgrade file, preparing for subsequent distribution operations. Conversely, if the third verification results corresponding to one or more data packets indicate that the verification is erroneous, that is, there are inconsistencies in the checksums of the data packets, then the first verification result is determined to be erroneous. In this situation, the lower-level machine feeds back the error information to the upper-level machine via the PXI bus, so that the upper-level machine can take corresponding measures, such as resending the problematic data packet or performing other error correction operations.
[0055] Furthermore, refer to Figure 8 As shown, Figure 8 This is an optional flowchart provided in the embodiments of this application after the lower-level machine performs file verification on the upgrade file. The method may include, but is not limited to, steps S801 to S804.
[0056] Step S801: If the first verification result indicates that the verification is incorrect, the lower-level machine determines the data packet with the third verification result indicating that the verification is incorrect as an erroneous data packet and transfers the erroneous data packet to the error writing area.
[0057] Step S802: The lower-level machine sends the error data packet back to the upper-level machine via the PXI bus.
[0058] Step S803: The host computer matches the corresponding new data packet according to the error data packet, and retransmits the new data packet to the lower computer.
[0059] Step S804: The lower computer receives the new data packet, and overwrites the new data packet to the cache position corresponding to the error data packet in the receiving burn-in area.
[0060] In a possible embodiment, when the first check result represents a check error, the lower computer starts an error processing mechanism. First, the lower computer screens all the third check results, accurately identifies and determines the data packets represented as check errors as error data packets. These error data packets may be caused by signal interference in the transmission process, temporary failure of the storage medium, or other unpredictable factors. In order to not affect the subsequent correct data processing process, the lower computer separates these error data packets from the original receiving burn-in area and stores them in the error burn-in area specially used for storing error data. This storage operation not only helps to isolate error data and prevent it from being misused, but also provides a basis for subsequent error analysis and data recovery. Subsequently, the lower computer uses the PXI bus to feed back the key information of the error data packet to the host computer. The PXI bus has the characteristics of high bandwidth and low delay, which ensures that the error information can be quickly and accurately transmitted to the host computer, so that the host computer can know the problem in the data transmission process in the first time. After the host computer receives the information of the error data packet, it matches the corresponding new data packet in the original target file or backup data according to the characteristic information of the error data packet, such as the check code and identification number of the data packet. After the matching is successful, the host computer retransmits the new data packet to the lower computer through the same CANFD channel as before. After the lower computer receives the new data packet, it performs necessary check operations to ensure the integrity and accuracy of the new data packet. After the check is passed, the lower computer accurately overwrites the new data packet to the cache position corresponding to the original error data packet in the receiving burn-in area. The overwrite operation uses an atomic write mechanism, that is, it writes to the receiving burn-in area first, and then replaces the original error data at one time, ensuring the reliability and consistency of data update, and avoiding the problem of inconsistent data caused by intermediate failure during data update.
[0061] Referring to Figure 9 , the Figure 9 is an optional flowchart provided by the lower computer after receiving the first error information, which can include but is not limited to steps S901 to S902.
[0062] Step S901: Fill the first error information into the error burn-in area.
[0063] Step S902: If the lower-level machine receives the second error information from the terminal device, it compares the second error information with the first error information. If the second error information is different from the first error information, the second error information is filled into the error writing area.
[0064] In one possible implementation, when the lower-level machine receives a first error message from the terminal device, it fills the error writing area with the first error message. During a subsequent upgrade process, if the lower-level machine receives a second error message from the terminal device, it means that the terminal device has discovered a new error during the writing process. At this time, the lower-level machine will initiate an error message comparison mechanism. Specifically, the lower-level machine will compare the second error message with the first error message already stored in the error writing area field by field, including the identifier of the error data packet, the writing address, and the error type. When the comparison result shows that the second error message is different from the first error message, it indicates that a new, unrecorded error has occurred. At this time, the lower-level machine treats the second error message as a new error record and fills it into the error writing area, storing it together with the first error message. This process ensures the comprehensiveness and timeliness of the error information recorded in the error writing area, providing complete error data support for subsequent system debugging and optimization.
[0065] It should be noted that through this error information management and comparison mechanism, the lower-level machine can effectively track error changes during the upgrade process and update error records in a timely manner, thereby improving the reliability and maintainability of the entire upgrade system and helping R&D personnel to quickly locate the root cause of the problem and optimize the upgrade process.
[0066] Reference Figure 10 As shown, Figure 10 This is an optional flowchart of the lower-level machine comparing the second error information with the first error information provided in the embodiments of this application. The method may include, but is not limited to, steps S1001 to S1003.
[0067] Step S1001: When the second error message is the same as the first error message, the lower-level machine sends the second error message to the upper-level machine.
[0068] Step S1002: The host computer matches the corresponding second retransmission data frame according to the second error information, and feeds back the second retransmission data frame to the slave computer.
[0069] Step S1003: The lower-level device receives the second retransmission data frame, overwrites the second retransmission data frame into the corresponding buffer position in the receiving and writing area, and sends the second retransmission data frame to the terminal device that provides feedback on the second error information.
[0070] In a possible embodiment, when the lower machine receives and compares the second error information fed back by the terminal device with the first error information stored by the lower machine, if the two are the same, the lower machine transmits the second error information to the upper machine. After the upper machine receives the second error information, the data recovery module is immediately started. According to the key content in the second error information, such as the identification of the error data packet and the burning address, the corresponding second retransmission data frame is matched in the original target file or the backup data. After the matching is successful, the upper machine feeds back the second retransmission data frame to the lower machine through the same communication channel as before. After the lower machine receives the second retransmission data frame, the necessary checking operation is performed to ensure the integrity and accuracy of the data. After the checking is passed, the lower machine accurately overwrites the second retransmission data frame to the corresponding cache position in the receiving burning area. The overwrite operation adopts the atomic writing mechanism, that is, the original error data is replaced at one time after being written into the temporary buffer area, so as to ensure the reliability and consistency of data update and avoid the problem of inconsistent data caused by fault in the middle of the way. At the same time, the lower machine sends the second retransmission data frame to the terminal device that feeds back the second error information, so as to ensure that the terminal device can receive the correct data for subsequent burning operation. Through this process, the lower machine and the upper machine closely cooperate, effectively solve the problem of the same error information in the upgrading process, ensure the accuracy and integrity of the upgrading file data, and improve the reliability of the entire upgrading system and the stability of data transmission.
[0071] In a second aspect, the embodiments of the present application also provide a software parallel upgrading system, referring to Figure 11 , Figure 11 The software parallel upgrading system provided by the embodiments of the present application has an optional structure diagram. The software parallel upgrading system 1100 includes: The upper machine 1101, the lower machine 1102 and a plurality of terminal devices 1103. The lower machine 1102 includes a plurality of CANFD channels. The CANFD channels and the terminal devices 1103 are connected in a frame transmission manner. The upper machine 1101 and the lower machine 1102 are connected in communication. The communication manner between the upper machine 1101 and the lower machine 1102 is PXI bus communication. The memory of the lower machine 1102 is provided with a receiving burning area and an error burning area. The upper machine 1101 is configured to respond to a request for software upgrading, determine one or more target files to be burned according to the request, pack and recombine the one or more target files to obtain an upgrading file, and send the upgrading file to the lower machine 1102 in the form of packet transmission. The lower machine 1102 is configured to obtain the upgrade file, cache the upgrade file to the receiving burn area, and perform file verification on the upgrade file to obtain a first verification result. If the first verification result indicates that the verification is correct, frame information of the upgrade file is distributed in parallel to the plurality of terminal devices 1103 based on the CANFD channel. The frame information includes a plurality of data frames and a burn format between the plurality of data frames. The terminal device 1103 is configured to, after receiving the frame information, burn the plurality of data frames to the storage space according to the burn format, and perform data verification on the burn addresses of the plurality of data frames to obtain a second verification result. If the second verification result indicates that the verification is incorrect, first error information is fed back to the lower machine 1102. The first error information includes the error burn address that is incorrect. The lower machine 1102 is further configured to receive the first error information, match a new data frame corresponding to the upgrade file in the receiving burn area according to the error burn address, and send the new data frame to the terminal device 1103 that feeds back the error burn address.
[0072] The above-mentioned software parallel upgrade system 1100 and the above-mentioned software parallel upgrade method are based on the same inventive concept. The above process describes that, in the embodiment of the present application, the lower machine obtains the upgrade file, caches the upgrade file to the receiving burn area, performs file verification on the upgrade file to obtain a first verification result, and if the first verification result indicates that the verification is correct, frame information of the upgrade file is distributed in parallel to the plurality of terminal devices based on the CANFD channel. The frame information includes a plurality of data frames and a burn format between the plurality of data frames. Then, through the plurality of CANFD channel data transmissions, the plurality of terminal devices are simultaneously software upgraded without the intervention of the host, and the upgrade efficiency is improved. Then, after each terminal device receives the frame information, the plurality of data frames are burned to the storage space according to the burn format, and data verification is performed on the burn addresses of the plurality of data frames to obtain a second verification result. If the second verification result indicates that the verification is incorrect, first error information is fed back to the lower machine. Then, through the addition of the double verification mechanism, the accuracy in the upgrade process is ensured. The lower machine receives the first error information, matches a first retransmission data frame corresponding to the upgrade file in the receiving burn area according to the error burn address, and sends the first retransmission data frame to the terminal device that feeds back the first error information. Then, without re-burning the entire software program after the burn error, only the error address region is burned, and the burn time is reduced.
[0073] The embodiment of the present application further provides an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the software parallel upgrade method described above is implemented. The electronic device can be any intelligent terminal including a mobile phone, a tablet computer, a vehicle-mounted computer, etc.
[0074] Please refer to Figure 12 , Figure 12is an optional hardware structure schematic diagram of an electronic device provided by an embodiment of the present application, and the electronic device comprises: The processor 1201 can be implemented in a manner of a general-purpose CPU (Central Processing Unit), a microprocessor, an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits, and is used to execute a related program to implement the QSPI serial port switching method and / or the cache data reading method provided by the embodiments of the present application. The memory 1202 can be implemented in a form of a ROM (ReadOnly Memory), a static storage device, a dynamic storage device, or a RAM (Random Access Memory). The memory 1202 can store an operating system and other application programs. When the technical solutions provided by the embodiments of the present application are implemented by software or firmware, the related program codes are stored in the memory 1202 and are called and executed by the processor 1201 to implement the QSPI serial port switching method and / or the cache data reading method provided by the embodiments of the present application. The input / output interface 1203 is used to realize information input and output. The communication interface 1204 is used to realize the communication interaction between the device and other devices, and can realize the communication in a wired manner (for example, a USB, a network cable, etc.) or in a wireless manner (for example, a mobile network, WIFI, Bluetooth, etc.). The bus 1205 is used to transmit information between various components (for example, the processor 1201, the memory 1202, the input / output interface 1203, and the communication interface 1204) of the device. The processor 1201, the memory 1202, the input / output interface 1203, and the communication interface 1204 are connected to each other in the device through the bus 1205.
[0075] The embodiments of the present application further provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the software parallel upgrading method provided by the embodiments of the present application.
[0076] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory can include a high-speed random access memory and can also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include a memory disposed remotely from the processor, which can be connected to the processor through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0077] The embodiments described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0078] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and can include more or fewer steps than shown in the figures, or combine certain steps, or different steps.
[0079] The device embodiments described above are only schematic, and the units described as separate components can or can not be physically separate, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0080] Those skilled in the art can understand that all or some of the steps in the above disclosed method, the functional modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations.
[0081] The terms "first", "second", "third", "fourth" and the like used in the specification of the present application and the above-described drawings, if any, are used to distinguish similar objects, and do not necessarily have to describe a particular order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0082] It should be understood that, in the application, "at least one" refers to one or more, and "multiple" refers to two or more. "And / or" is used to describe the association relationship of the associated objects, which means that there can be three relationships, for example, "A and / or B" can represent three cases of only A, only B, and A and B existing at the same time, wherein A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after it. "At least one of the following" or similar expressions means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b or c can represent a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, and c can be single or multiple.
[0083] In several embodiments provided in the application, it should be understood that the disclosed system and method can be implemented in other ways. For example, the system embodiments described above are only illustrative, for example, the division of the above units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0084] The units described above as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment scheme.
[0085] In addition, the functional units in each embodiment of the application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0086] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer accessible storage medium. Based on such understanding, the technical solutions of the present application, essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes multiple instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program storage media.
[0087] The preferred embodiments of the embodiments of the present application are described above with reference to the accompanying drawings, and are not limited to the scope of the embodiments of the present application. Any modifications, equivalent replacements and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of the embodiments of the present application.
Claims
1. A software parallel upgrade method based on multiple CANFD channels, applied to a software parallel upgrade system, characterized in that, The software parallel upgrade system includes a lower-level machine and multiple terminal devices. The lower-level machine includes multiple CANFD channels, which communicate with the terminal devices via frame transmission. The lower-level machine's memory has a receive / write area. The method includes: The lower-level machine obtains the upgrade file and caches the upgrade file in the receiving and writing area; The lower-level machine performs file verification on the upgrade file and obtains a first verification result. If the first verification result indicates that the verification is correct, the frame information of the upgrade file is distributed in parallel to multiple terminal devices based on the CANFD channel. The frame information includes multiple data frames and the burning format between the multiple data frames. After receiving the frame information, each terminal device writes multiple data frames to the storage space according to the writing format, and performs data verification on the writing addresses of the multiple data frames to obtain a second verification result. If the second verification result indicates that the verification is incorrect, the first error information is fed back to the lower-level machine. The first error information includes the incorrect writing address of the verification error. The lower-level machine receives the first error information, matches the first retransmission data frame corresponding to the upgrade file in the receiving and writing area according to the error writing address, and sends the first retransmission data frame to the terminal device that fed back the first error information.
2. The software parallel upgrade method according to claim 1, characterized in that, The software parallel upgrade system also includes a host computer, which is connected to the slave computer via a communication connection. The communication method between the host computer and the slave computer is PXI bus communication. Before the slave computer obtains the upgrade file, the method further includes: The host computer responds to the software upgrade request and determines one or more target files to be burned according to the request; The host computer packages and reassembles one or more target files to obtain the upgrade file, and sends the upgrade file to the slave computer in the form of packet transmission.
3. The software parallel upgrade method according to claim 2, characterized in that, The host computer packages and reassembles one or more target files to obtain the upgrade file, including the following steps: One or more target files are grouped into multiple data packets; each data packet contains byte data of a single target file; the header data of each data packet includes an identifier, and the body data of each data packet includes the data frame. The identifiers and data frames of the multiple data packets are verified respectively. If the verification passes, the data packets are grouped together according to a preset priority order to obtain the upgrade file. If the verification fails, the target file is regrouped to obtain new data packets, and the identifiers and data frames of the new data packets are verified.
4. The software parallel upgrade method according to claim 3, characterized in that, The lower-level machine performs file verification on the upgrade file to obtain a first verification result, including: The multiple data packets in the upgrade file are received one by one in the form of packet transmission; For each data packet received, the data packet is unpacked to obtain the packet header data and packet body data, and the packet body data is verified based on the packet header data to obtain the third verification result corresponding to the data packet; If the third verification result corresponding to all the data packets is characterized as verification error-free, then the first verification result is determined to be characterized as verification error-free. If the third verification result corresponding to one or more of the data packets indicates that the verification is incorrect, then the first verification result will be determined to be incorrect.
5. The software parallel upgrade method according to claim 4, wherein the lower-level machine's memory further comprises an error-writing area, and the method further comprises: If the first verification result indicates that the verification is incorrect, the lower-level machine determines the data packet whose third verification result indicates that the verification is incorrect as an erroneous data packet, and transfers the erroneous data packet to the error writing area; The lower-level machine feeds back the error data packet to the upper-level machine through the PXI bus; The host computer matches the corresponding new data packet based on the erroneous data packet, and retransmits the new data packet to the slave computer; The lower-level machine receives the new data packet and overwrites the new data packet into the cache location corresponding to the erroneous data packet in the receiving and writing area.
6. The software parallel upgrade method according to claim 5, characterized in that, After the lower-level machine receives the first error information, the method further includes: Fill the error programming area with the first error message; If the lower-level machine receives the second error information from the terminal device, it compares the second error information with the first error information. If the second error information is different from the first error information, it fills the error writing area with the second error information.
7. The software parallel upgrade method according to claim 6, characterized in that, After the lower-level machine receives the second error information from the terminal device and compares the second error information with the first error information, the method further includes: When the second error message is the same as the first error message, the lower-level machine transmits the second error message to the upper-level machine; The host computer matches the corresponding second retransmission data frame according to the second error information, and feeds back the second retransmission data frame to the slave computer. The lower-level machine receives the second retransmission data frame, overwrites the second retransmission data frame into the corresponding buffer position in the receiving and writing area, and sends the second retransmission data frame to the terminal device that provides feedback on the second error information.
8. A software parallel upgrade system, characterized in that, include: The lower-level machine includes a lower-level machine and multiple terminal devices. The lower-level machine includes multiple CANFD channels. The CANFD channels communicate with the terminal devices in a frame transmission manner. The memory of the lower-level machine is provided with a receiving and writing area. The lower-level machine is used to acquire the upgrade file, cache the upgrade file in the receiving and writing area, and perform file verification on the upgrade file to obtain a first verification result. If the first verification result indicates that the verification is correct, the frame information of the upgrade file is distributed in parallel to multiple terminal devices based on the CANFD channel. The frame information includes multiple data frames and the writing format between the multiple data frames. After receiving the frame information, the terminal device writes multiple data frames to the storage space according to the writing format, and performs data verification on the writing addresses of the multiple data frames to obtain a second verification result. If the second verification result indicates that the verification is incorrect, the terminal device feeds back the first error information to the lower-level machine. The first error information includes the incorrect writing address of the verification error. The lower-level machine is also used to receive the first error information, match the new data frame corresponding to the upgrade file in the receiving and writing area according to the error writing address, and send the new data frame to the terminal device that fed back the error writing address.
9. The software parallel upgrade system according to claim 8, characterized in that, Also includes: The host computer is connected to the slave computer via a communication connection, and the communication method between the host computer and the slave computer is PXI bus communication. The host computer is used to respond to a software upgrade request, determine one or more target files to be burned according to the request, and reassemble the one or more target files to obtain the upgrade file, and send the upgrade file to the slave computer in the form of packet transmission.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the software parallel upgrade method as described in claims 1 to 7.