Firmware upgrading method for medical equipment
Through the CAN bus and CAN extended frame ID structure, efficient and secure firmware upgrades of medical equipment are achieved, complex and unsafe traditional methods are solved, and the efficiency and reliability of the upgrade process are improved.
Patent Information
- Application Number
- CN202411664883.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-11-20
AI Technical Summary
Traditional firmware upgrade methods in medical equipment are complex and unsafe, and it is difficult to cope with rapidly changing upgrade needs. The serial communication lacks flexibility and is susceptible to security threats, affecting system stability and security.
The CAN bus is used to electrically connect multiple single-chip microcontrollers, and through structured communication protocols and data transmission mechanisms, the firmware upgrade is used to use the CAN extended frame ID structure to achieve accurate identification and subcontract transmission of target devices, reducing operational complexity and risks.
It improves the efficiency and reliability of the firmware upgrade process, ensures stability and security, and is suitable for medical equipment scenarios with high safety and reliability requirements.
Smart Images

Figure CN119149076A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of medical equipment, and in particular to a firmware upgrade method for medical equipment. Background Art
[0002] In the medical and industrial fields, the increasing complexity of equipment has made multi-MCU integration the norm. However, this architecture faces many challenges in upgrading and maintenance. Traditional methods, such as directly upgrading the firmware of the MCU through the JTAG or UART interface, not only require the removal of the device casing, but are cumbersome and rely on professionals, increasing maintenance costs and uncertainty in on-site operations. In addition, although the main control MPU can achieve control by connecting to the MCU one by one through multiple serial ports, it is inefficient and limits the scalability of the system.
[0003] In medical equipment, serial communication is widely used between chips. Although it is stable, it lacks flexibility and is difficult to cope with rapidly changing upgrade requirements. The direct firmware distribution model is vulnerable to security threats, such as file tampering, which may cause device performance degradation or even paralysis, seriously affecting system stability and security.
[0004] There is currently no effective technical solution to the above problems. Summary of the invention
[0005] The purpose of this application is to provide a firmware upgrade method for medical equipment to reduce operational complexity and risks, thereby combining the advantages of high efficiency, safety, and ease of operation.
[0006] The present application provides a firmware upgrade method for a medical device, wherein the firmware of the medical device is upgraded through an upgrade terminal, wherein the upgrade terminal is electrically connected to multiple single-chip microcomputers of the medical device through a CAN bus; The firmware upgrade method of the medical device is executed based on the upgrade end, and comprises the following steps: S1. Shake hands with the target device based on the first CAN extended frame ID structure, the device code and firmware size information of the target device. The target device is a single-chip microcomputer that currently needs to upgrade its firmware. The first CAN extended frame ID structure includes: a priority code, a command code page number, a command code, an extended data packet mark code, a source device code and a target device code, which are arranged in sequence. The extended data packet mark code is used to mark the frame number of the data packet, the source device code is used to indicate the device code of the data sending device, and the target device code is used to indicate the device code of the data receiving device. S2, dividing the firmware data packet into a plurality of data packets composed of data frames; S3. Construct a CAN extended frame for each data frame based on the first CAN extended frame ID structure, and send it to the target device that has completed the handshake.
[0007] The firmware upgrade method for medical equipment of the present application realizes reliable firmware upgrade of medical equipment in a multi-MCU system through a structured communication protocol and data transmission mechanism. It can accurately identify the target device, effectively transmit firmware data, and improve the efficiency and reliability of the upgrade process through packet transmission. It is particularly suitable for scenarios such as medical equipment that have high requirements for security and reliability, and can ensure the stability and accuracy of the firmware upgrade process.
[0008] The firmware upgrade method for medical equipment, wherein step S1 comprises: S11, establishing a first frame ID conforming to the first CAN extended frame ID structure based on a first command representing the start of handshake, the device code of the upgrade end, and the device code of the target device, establishing a first CAN frame based on the first frame ID and sending the first CAN frame through a CAN bus, wherein data of the first CAN frame includes the firmware size information; S12. After receiving the third CAN frame sent by the target device, shake hands with the target device, the third CAN frame is established by the target device based on the third frame ID, and after the target device receives the firmware size information according to the target device code in the first frame ID, the third frame ID that conforms to the first CAN extended frame ID structure is established based on the third command representing that the upgrade is ready, the device code of the upgrade end, and the device code of the target device.
[0009] The firmware upgrade method for medical equipment of the present application realizes reliable handshake communication between the upgrade end and the target device by using technical features such as the frame ID structure of the CAN extended frame, the sending of the first CAN frame, the receiving of the third CAN frame, the use of command coding and the application of device coding.
[0010] The firmware upgrade method for medical equipment, wherein the step between step S11 and step S12 further includes the following steps: S1A. Based on the second command representing data verification, the device code of the upgrade end, and the device code of the target device, a second frame ID that conforms to the first CAN extended frame ID structure is established. Based on the second frame ID, two second CAN frames are established and the second CAN frames are sent through the CAN bus. The data of the two second CAN frames are split based on the first MD5 code, and the first MD5 code is obtained by performing MD5 calculation based on the firmware data packet.
[0011] The firmware upgrade method for medical equipment, wherein step S12 comprises: S121. After receiving the third CAN frame sent by the target device, a fourth frame ID conforming to the first CAN extended frame ID structure is established based on a fourth command representing a successful handshake, the device code of the upgrade end, and the device code of the target device; a fourth CAN frame is established based on the fourth frame ID and the fourth CAN frame is sent through the CAN bus.
[0012] The firmware upgrade method for medical equipment, wherein step S2 comprises: S21, dividing the firmware data packet into a plurality of data frames based on 8 bytes, and reorganizing the data frames into a plurality of data packets according to the tag capacity of the extended data packet tag code.
[0013] The firmware upgrade method for medical equipment, wherein step S3 comprises: S31. Based on the fifth command representing data transmission, the device code of the upgrade end, and the device code of the target device, a fifth frame ID that conforms to the first CAN extended frame ID structure is established; based on the fifth frame ID, a fifth CAN frame is established and the fifth CAN frame is sent through the CAN bus; the data of each of the fifth CAN frames includes a data frame in the data packet, and the frame number of the data frame in the data packet is recorded in the extended data packet tag code in the fifth frame ID.
[0014] The firmware upgrade method for medical equipment, wherein step S3 further comprises: S32. After each data packet is sent, a sixth frame ID that conforms to the first CAN extended frame ID structure is established based on a sixth command representing data packet verification, the device code of the upgrade end, and the device code of the target device. A sixth CAN frame is established based on the sixth frame ID and the sixth CAN frame is sent through the CAN bus. The data of the sixth CAN frame includes a verification code corresponding to the data packet that has been sent.
[0015] The firmware upgrade method for medical equipment, wherein the priority code length is 3 bits, the command code page code length is 1 bit, the command code length is 8 bits, the extended data packet mark code length is 5 bits, the source device code length is 6 bits, and the target device code length is 6 bits.
[0016] In the firmware upgrade method for medical equipment, the extended data packet mark code is 0, indicating that the corresponding data packet is sent without subpacketization.
[0017] From the above, it can be seen that the present application provides a firmware upgrade method for medical equipment. The firmware upgrade method for medical equipment realizes reliable firmware upgrade of medical equipment in a multi-microcontroller system through a structured communication protocol and data transmission mechanism. It can accurately identify the target device, effectively transmit firmware data, and improve the efficiency and reliability of the upgrade process through packet transmission. It is particularly suitable for scenarios such as medical equipment that have high requirements for security and reliability, and can ensure the stability and accuracy of the firmware upgrade process. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 This is a schematic diagram of the structure of the first CAN extended frame ID structure.
[0019] Figure 2 A flowchart of a firmware upgrade method for a medical device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0021] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0022] Please refer to Figure 1 The firmware upgrade method of the medical device provided in the present application establishes relevant frame data based on the first CAN extended frame ID structure to realize the firmware upgrade of multiple single-chip microcomputers, wherein the first CAN extended frame ID structure includes: priority code, command code page number, command code, extended data packet mark code, source device code and target device code arranged in sequence; The extended data packet mark code is used to mark the frame number of the data packet, the source device code is used to indicate the device code of the data sending device, and the destination device code is used to indicate the device code of the data receiving device.
[0023] Specifically, the CAN extended frame is a frame type in the CAN protocol used to transmit longer identifiers (29-bit binary ID) and data fields. In order to be suitable for firmware upgrades of medical devices, this application redesigns the frame ID structure in the CAN extended frame (corresponding to the identifier in the extended frame) to make the CAN extended frame suitable for firmware upgrades of medical devices.
[0024] More specifically, if Figure 1 As shown, the priority code is recorded as p, the command code page number is recorded as pg, the command code is recorded as cmd, the extended data packet mark code is recorded as DID, the source device code is recorded as DST, and the target device code is recorded as SRC.
[0025] More specifically, the first CAN extended frame ID structure makes full use of the characteristics of the CAN bus while overcoming its limitations in long data transmission and command types. Among them, priority coding can ensure the timely transmission of important information, and different priorities can be set according to different types of data or commands. Command coding can configure different commands in each data transmission link to distinguish the operation phase according to usage requirements. The command coding page number can further expand the command types that can be filled in the command coding. Its combination with the command coding allows the system to perform more operations sufficient to cover the firmware upgrade process, greatly increasing the flexibility of the upgrade process. The expanded data packet marking coding is used to mark the frame number of the data packet, realizing effective support for long data, making the transmission of large firmware files possible. The source device coding and the target device coding clarify the sending and receiving devices of the data, improve the accuracy and security of communication, and reserve sufficient space for system expansion.
[0026] In practical applications, this CAN extended frame ID structure can be applied to the firmware upgrade process of a multifunctional vital signs monitor. For example, a monitor that includes an electrocardiogram (ECG) module, a blood oxygen saturation (SpO2) module, and a non-invasive blood pressure (NIBP) module, each module has its own device code. During the upgrade process, the upgrade end (such as the central control system of a hospital) can send firmware updates to multiple modules simultaneously through the CAN bus.
[0027] More specifically, based on the above-mentioned first CAN extended frame ID structure, the master control system of the medical equipment can accurately control the data flow to ensure that the correct module receives the corresponding firmware update. At the same time, priority coding allows regular data transmission to be interrupted when necessary to execute emergency commands or transmit critical data. The extended data packet marker coding allows large firmware files to be divided into multiple data packets for orderly transmission, greatly improving transmission efficiency. Compared with traditional methods, the first CAN extended frame ID structure of the embodiment of the present application utilizes the characteristics of the CAN bus while overcoming its limitations in long data transmission and command types, greatly increasing the types and flexibility of executable operations, so that the firmware upgrade process can be more finely controlled and adapt to complex upgrade scenarios.
[0028] The first CAN extended frame ID structure is used in the firmware upgrade of medical equipment, so that the medical equipment can establish a CAN extended frame to transmit firmware data packets through the CAN bus according to the frame ID structure, so that the firmware upgrade process of multiple microcontrollers in the medical equipment does not need to remove the device casing, which greatly reduces the operation complexity and risk, has the advantages of high efficiency, safety, and easy operation, and provides better system scalability.
[0029] Please refer to Figure 2 , after determining the form of the first CAN extended frame ID structure, some embodiments of the present application provide a firmware upgrade method for a medical device, which upgrades the firmware of the medical device through an upgrade end, and the upgrade end is electrically connected to multiple single-chip microcomputers of the medical device through a CAN bus; The firmware upgrade method of the medical device is executed based on the upgrade end, and includes the following steps: S1. Shake hands with the target device based on the first CAN extended frame ID structure, the device code and firmware size information of the target device. The target device is a single-chip microcomputer that currently needs to upgrade its firmware. The first CAN extended frame ID structure includes: priority code, command code page number, command code, extended data packet mark code, source device code and target device code, which are arranged in sequence. The extended data packet mark code is used to mark the frame number of the data packet. The source device code is used to indicate the device code of the data sending device. The target device code is used to indicate the device code of the data receiving device. S2, dividing the firmware data packet into a plurality of data packets composed of data frames; S3. Construct a CAN extended frame for each data frame based on the first CAN extended frame ID structure, and send it to the target device that has completed the handshake.
[0030] Specifically, the upgrade end is used to transmit the firmware data packet to the corresponding single-chip microcomputer for firmware upgrade, which can be a firmware upgrader or a main controller in the medical device.
[0031] More specifically, the firmware upgrade method for medical equipment in the embodiment of the present application adopts a specific frame ID structure of a CAN extended frame, ensures that the target device is ready through a handshake mechanism, divides the firmware data packet into multiple data frames, and uses the frame ID structure of the CAN extended frame to construct and send data frames, thereby realizing reliable firmware upgrades of medical equipment in a multi-microcontroller system. The method can accurately identify the target device, effectively transmit firmware data, and improve the efficiency and reliability of the upgrade process through packet transmission.
[0032] More specifically, the firmware data packets may be divided based on the data field size of the CAN frame (usually 8 bytes) to obtain multiple data frames that conform to the data field size, which may be reassembled into multiple data packets based on the capacity encoded by the extended data packet marker.
[0033] More specifically, during the data transmission process, each CAN frame contains specific command codes, such as data transmission commands, check commands, etc. The extended packet marker code is used to identify the position of each data frame in the data packet so that the receiving end can correctly reassemble the data. The source device code and the target device code ensure the accuracy of data transmission and prevent the data from being received by the wrong device.
[0034] The firmware upgrade method for medical equipment in the embodiment of the present application realizes reliable firmware upgrade of medical equipment in a multi-MCU system through a structured communication protocol and data transmission mechanism. It can accurately identify the target device, effectively transmit firmware data, and improve the efficiency and reliability of the upgrade process through packet transmission. It is particularly suitable for scenarios such as medical equipment that have high requirements for security and reliability, and can ensure the stability and accuracy of the firmware upgrade process. The method establishes a CAN extended frame based on the frame ID structure provided in the first aspect, so that the medical device can establish a CAN extended frame according to the frame ID structure through the CAN bus to transmit the firmware data packet, so that the firmware upgrade process of multiple MCUs in the medical device does not require the removal of the device casing, which greatly reduces the complexity and risk of operation, has the advantages of high efficiency, safety, and easy operation, and provides better system scalability.
[0035] In some preferred embodiments, step S1 comprises: S11, establishing a first frame ID conforming to a first CAN extended frame ID structure based on a first command representing the start of a handshake, a device code of the upgrade end, and a device code of the target device, establishing a first CAN frame based on the first frame ID and sending the first CAN frame through a CAN bus, wherein data of the first CAN frame includes firmware size information; S12. After receiving the third CAN frame sent by the target device, shake hands with the target device. The third CAN frame is established by the target device based on the third frame ID. After the target device receives the firmware size information according to the target device code in the first frame ID, the target device establishes a third frame ID that conforms to the first CAN extended frame ID structure based on the third command representing that the upgrade is ready, the device code of the upgrade end, and the device code of the target device.
[0036] Specifically, the firmware upgrade method of the medical device of the embodiment of the present application realizes reliable handshake communication between the upgrade end and the target device by using the frame ID structure of the CAN extended frame, the transmission of the first CAN frame, the reception of the third CAN frame, the use of command coding, and the application of device coding. This handshake mechanism realizes reliable communication between the upgrade end and the target device through the CAN bus, ensures the reliability and security of the upgrade process, and can effectively prevent misoperation and unauthorized access; among them, the use of command coding can not only distinguish the different stages of the handshake process, but also can be extended to the entire upgrade process, making the entire upgrade process more structured and controllable.
[0037] More specifically, during the reception of the third CAN frame, the upgrade end can set a timeout mechanism. For example, if the third CAN frame of the target device is not received within 5 seconds, the handshake is considered to have failed, and the upgrade process can be terminated or re-initiated. This mechanism can effectively prevent the upgrade process from waiting indefinitely due to communication problems.
[0038] More specifically, in some other implementations, the application of device codes can be further refined. For example, the 6-digit device code can be divided into a 2-digit device type code and a 4-digit device serial number, which can not only distinguish different devices, but also identify the type of device, providing more information for subsequent upgrade strategies.
[0039] More specifically, in an embodiment of the present application, the sending of the first CAN frame starts the handshake process, and the firmware size information carried provides the target device with the necessary upgrade preparation information. The target device responds to the third CAN frame, which enables the upgrade end to confirm that the target device is ready for upgrade, and also verifies the availability of the communication link. The use of command coding and device coding runs through the entire process to ensure the accuracy and security of communication. This handshake mechanism has significant advantages over traditional firmware upgrade methods: first, it makes full use of the characteristics of the CAN bus to achieve efficient and reliable communication; second, by using the frame ID structure of the CAN extended frame, it can transmit more information within a limited data length, thereby improving communication efficiency; third, the use of command coding and device coding enhances the security of the system and effectively prevents misoperation and unauthorized access.
[0040] More specifically, in the embodiment of the present application, the first command of the first frame ID in the first CAN frame represents that the upgrade end initiates a handshake operation on the target device, and the third command of the third frame ID in the third CAN frame represents that the target device can normally receive the first CAN frame and is in an upgrade-ready state. The data in the third CAN frame can contain any value, and in the embodiment of the present application, it is preferably 1.
[0041] In some preferred embodiments, the steps between step S11 and step S12 further include: S1A. Based on the second command representing data verification, the device code of the upgrade end, and the device code of the target device, a second frame ID that conforms to the first CAN extended frame ID structure is established. Based on the second frame ID, two second CAN frames are established and sent through the CAN bus. The data of the two second CAN frames are split based on the first MD5 code, and the first MD5 code is obtained by performing MD5 calculation based on the firmware data packet.
[0042] Specifically, the first MD5 code is verification data for verifying the data integrity of the firmware data packet, which may be pre-stored in the encapsulation structure corresponding to the firmware data packet, or may be generated based on the calculation of the decrypted firmware data packet by the upgrade end.
[0043] More specifically, generally speaking, the length of the MD5 code is 16 bytes, and the length of the data field of the CAN frame is 8 bytes. Therefore, the firmware upgrade method of the medical device in the embodiment of the present application uses two second CAN frames to transmit the first MD5 code to the target device, which adapts to the data length limitation of the CAN bus and ensures the complete transmission of the verification data.
[0044] More specifically, the firmware size information and the first MD5 code are both characteristic data of the firmware data packet. Transmitting these data based on the handshake establishment process can enable the target device to obtain the corresponding data characteristics of the target device in advance, so that the target device can immediately verify whether the firmware data packet is successfully transmitted based on these characteristic data at the end of data transmission.
[0045] More specifically, step S1A is closely integrated with the handshake process, and a data verification step is inserted after sending the firmware size information and before receiving the target device ready information, which not only ensures the integrity of the firmware data, but also optimizes the entire upgrade process.
[0046] It should be noted that the data fields of the two second CAN frames respectively contain the first 8 bytes and the last 8 bytes of the first MD5 code. After receiving the two frames, the target device can reassemble the complete first MD5 code and verify it when receiving firmware data later.
[0047] More specifically, in this implementation, the third command of the third frame ID in the third CAN frame represents that the target device can normally receive the first CAN frame and the second CAN frame and is in an upgrade-ready state.
[0048] In some preferred embodiments, step S12 includes: S121. After receiving the third CAN frame sent by the target device, a fourth frame ID that conforms to the first CAN extended frame ID structure is established based on the fourth command representing a successful handshake, the device code of the upgrade end, and the device code of the target device; a fourth CAN frame is established based on the fourth frame ID and the fourth CAN frame is sent through the CAN bus.
[0049] Specifically, the firmware upgrade method for medical devices in the embodiment of the present application ensures the success of the handshake between the upgrade end and the target device by adding an additional confirmation step in the handshake process; specifically, when the upgrade end receives the third CAN frame sent by the target device (indicating that the target device is ready for upgrade), the upgrade end will send a fourth CAN frame again to confirm the success of the handshake. This two-way confirmation mechanism significantly improves the reliability and stability of the firmware upgrade process, and is particularly suitable for the field of medical devices with high requirements for security and reliability.
[0050] More specifically, by introducing this additional handshake confirmation step, the technical solution of the present application significantly improves the reliability and security of the medical device firmware upgrade process. Compared with the traditional one-way handshake method, this two-way confirmation mechanism can effectively prevent upgrade failures caused by communication errors or misunderstandings, thereby reducing device downtime and maintenance costs.
[0051] More specifically, in the embodiment of the present application, the fourth command of the fourth frame ID in the fourth CAN frame represents that the upgrade end and the target device have successfully handshaked and can perform CAN communication normally. The data in the fourth CAN frame can contain any value. In the embodiment of the present application, it is preferably 1.
[0052] In some preferred embodiments, step S2 comprises: S21. Divide the firmware data packet into multiple data frames based on 8 bytes, and reorganize the data frames into multiple data packets according to the tag capacity of the extended data packet tag code.
[0053] Specifically, since the CAN protocol stipulates that a maximum of 8 bytes of data can be transmitted per frame, in the embodiment of the present application, the firmware data packet is split based on 8 bytes to obtain multiple data frames, which can fully utilize the transmission capacity of CAN communication. At the same time, the scheme also takes into account the tag capacity of the extended data packet tag code, and recombines the divided data frames into multiple data packets. The purpose of doing this is to fully utilize the capacity of the extended data packet tag code in the frame ID structure of the CAN extended frame, so that the number of data frames contained in each data packet matches the capacity of the tag code. This design can improve the efficiency of data transmission and reduce the overhead during the transmission process.
[0054] More specifically, this division and reorganization method not only solves the transmission problem of firmware data, but also optimizes the transmission efficiency. By matching the number of data frames with the tag encoding capacity, the system can transmit the maximum number of data frames in each data packet, thereby reducing the total number of data packets and reducing the transmission overhead. In addition, this method also improves the traceability and error recovery capabilities of the data. Each data frame has a unique identifier in the data packet (extended packet tag encoding). If an error occurs during transmission, the system can accurately locate the specific data frame without retransmitting the entire data packet.
[0055] More specifically, in an embodiment of the present application, the maximum number of data frames of each data packet is the maximum capacity of the extended data packet marker code minus one. For example, in an implementation where the extended data packet marker code length is 5 bits, the value of the extended data packet marker code is 0-31, so the maximum number of data frames of each data packet is 30; wherein, the case where the extended data packet marker code is 31 is used to indicate that the corresponding data packet has been sent, to trigger the next stage of data packet to be sent or to trigger the target device to verify the integrity of the data packet just received, to ensure that data transmission is carried out in an orderly manner.
[0056] In some preferred embodiments, step S3 comprises: S31. Based on the fifth command representing data transmission, the device code of the upgrade end, and the device code of the target device, a fifth frame ID that conforms to the first CAN extended frame ID structure is established. Based on the fifth frame ID, a fifth CAN frame is established and the fifth CAN frame is sent through the CAN bus. The data of each fifth CAN frame includes a data frame in a data packet, and the frame number of the data frame in the data packet is recorded in the extended data packet mark code in the fifth frame ID.
[0057] Specifically, in this implementation, the target device receives and stores the content (i.e., data frame) in the data field of the fifth CAN frame according to the fifth command, thereby realizing segmented reception and reassembly of the data packet. Each CAN frame contains a data frame, and this design makes data transmission more flexible and controllable. The frame number of the data frame in the data packet is recorded in the extended data packet tag code of the frame ID, which helps the receiving end to correctly assemble and sort the received data.
[0058] More specifically, the solution of the present application forms a complete firmware upgrade process with the previous handshake process and data packet division step. The handshake process ensures the correct connection between the upgrade end and the target device, the data packet division step divides the large firmware file into small units suitable for CAN bus transmission, and this step realizes the efficient transmission of these data units.
[0059] In some preferred embodiments, step S3 further includes: S32. After each data packet is sent, a sixth frame ID that conforms to the first CAN extended frame ID structure is established based on a sixth command representing data packet verification, the device code of the upgrade end, and the device code of the target device. A sixth CAN frame is established based on the sixth frame ID and sent through the CAN bus. The data of the sixth CAN frame includes a verification code corresponding to the data packet that has been sent.
[0060] Specifically, this method introduces a packet verification mechanism, which is implemented by sending a CAN frame containing a verification code after each packet is sent. Specifically, the sixth command is used to represent the packet verification operation, and the encoding of the upgrade end and the target device is used to ensure that the verification information is accurately transmitted to the correct device. The sixth frame ID that conforms to the specific structure is constructed to ensure the correct identification and processing of the verification frame. The sixth CAN frame carries the verification code corresponding to the completed data packet, which is used by the receiving end to verify the data integrity.
[0061] More specifically, the verification code can be generated using a variety of algorithms, such as CRC32, MD5, or SHA256, etc. The selection of a suitable verification algorithm requires a balance between computational complexity and security.
[0062] More specifically, this verification mechanism is combined with the data transmission method mentioned above to form a complete data transmission and verification system. During the data transmission process, each data packet is sent through the fifth CAN frame, followed by the corresponding verification code through the sixth CAN frame. This tightly combined transmission and verification method can detect and correct transmission errors in a timely manner while ensuring transmission efficiency.
[0063] In some preferred embodiments, after executing step S32, after obtaining the verification code, the target device uses the verification code to verify the previously received data packet to generate a verification result, and then establishes a seventh frame ID that conforms to the first CAN extended frame ID structure based on the seventh command representing the verification feedback, the device code of the upgrade end, and the device code of the target device, establishes a seventh CAN frame based on the seventh frame ID and sends the seventh CAN frame to the upgrade end via the CAN bus, and the data of the seventh CAN frame contains the verification result.
[0064] Specifically, after receiving the data packet, the target device will use the check code to verify the received data packet and generate a check result. This check result will be fed back to the upgrade end through the CAN bus and transmitted using a specific CAN extended frame structure.
[0065] More specifically, in practical applications, the verification process is a segmented verification process, which is used to verify the integrity of each data packet split from the firmware data packet.
[0066] More specifically, this solution is closely integrated with the aforementioned data transmission and check code sending process to form a complete data transmission-check-feedback loop. This loop can not only detect and locate transmission errors in a timely manner, but also provide a basis for subsequent error handling.
[0067] In the specific implementation process, after the target device receives the data packet and the check code, it will first use the same check algorithm to check the received data packet. Then, the calculated check result is compared with the received check code. If the two are consistent, it means that the data packet is transmitted correctly; if they are inconsistent, it means that an error may have occurred during the transmission process.
[0068] It should be noted that the verification result can be a verification pass or a verification fail, which can be marked by a specific data field, such as data 1 indicates that the verification passed.
[0069] More specifically, in this way, the system can quickly discover and locate transmission errors during the firmware upgrade process, providing a basis for subsequent error handling, thereby improving the reliability and efficiency of the firmware upgrade.
[0070] In some preferred embodiments, step S3 further includes: S33, receiving the seventh CAN frame and extracting the verification result. When the verification result is passed, sending the next data packet based on step S31; when the verification result is failed, resending the corresponding data packet that failed the verification based on step S31.
[0071] Specifically, the technical solution introduces a verification mechanism during the data packet transmission process and takes corresponding processing measures according to the verification results to ensure the accuracy and integrity of the data packet transmission. Specifically, the solution sends a CAN frame containing a verification code each time a data packet is sent. After the target device receives the data packet and the verification code, it will perform a verification and return the verification result. The upgrade end decides the next operation based on the received verification result: if the verification result is passed, it means that the data packet has been correctly received, and the upgrade end will continue to send the next data packet; if the verification result is not passed, it means that the data packet may have an error during the transmission process, and the upgrade end will resend the data packet. The working principle of this mechanism is to ensure that each data packet can be correctly received through real-time data verification and targeted retransmission; when a transmission error occurs, the system can quickly identify and automatically correct it without restarting the entire upgrade process, which can better cope with possible data transmission errors in complex network environments and reduce the risk of upgrade failure, thereby providing more reliable protection for the safe operation of medical equipment.
[0072] In some preferred embodiments, after the target device receives the firmware data packet, it verifies the integrity of the firmware data packet based on the first MD5 code; if the firmware data packet is complete, the target device performs a firmware upgrade based on the BootLoader and generates an upgrade result, and then establishes an eighth frame ID that conforms to the first CAN extended frame ID structure based on an eighth command representing upgrade feedback, the device code of the upgrade end, and the device code of the target device, establishes an eighth CAN frame based on the eighth frame ID and sends the eighth CAN frame to the upgrade end via the CAN bus, and the data of the eighth CAN frame contains the upgrade result; if the firmware data packet is incomplete, the target device establishes a ninth frame ID that conforms to the first CAN extended frame ID structure based on the ninth command representing the failure of the MD5 check, the device code of the upgrade end, and the device code of the target device, establishes a ninth CAN frame based on the ninth frame ID and sends the ninth CAN frame to the upgrade end via the CAN bus.
[0073] Specifically, the verification process of the first MD5 code can be performed in a variety of ways. For example, the target device can perform MD5 calculation on the received firmware data packet, and then compare the calculation result with the first MD5 code sent by the upgrade end.
[0074] More specifically, when the firmware data packet is complete, the BootLoader can first perform a version check on the firmware to ensure that the new firmware version is higher than the current version. Then, the BootLoader can write the new firmware to the specified storage area and set the corresponding flag bit to indicate the upgrade status. After the upgrade is completed, the system can automatically restart to load the new firmware.
[0075] More specifically, this design and the aforementioned handshake and data transmission process form a complete firmware upgrade process. After the firmware data packet is transmitted, the first MD5 code transmitted in the handshake phase is used for MD5 verification, which greatly improves the reliability of the upgrade process.
[0076] More specifically, in practical applications, this approach can effectively prevent firmware corruption caused by network interference, storage errors, or malicious attacks.
[0077] In some preferred implementations, the firmware data packet is stored in the upgrade end based on a packaging structure after encryption, and the packaging structure includes: a target device code, an encryption type, a first MD5 code, and the encrypted firmware data packet.
[0078] Specifically, the technical solution uses a specific encapsulation structure to store encrypted firmware data packets, which contains multiple key information: the target device code ensures that the firmware data packet can be accurately sent to the correct medical device; the encryption type indicates the encryption method of the firmware data, which helps the receiving end to correctly decrypt it; the first MD5 code is used to verify the integrity of the firmware data packet to prevent the data from being tampered with or damaged during transmission; the encrypted firmware data packet can improve the security of the firmware content and prevent unauthorized access. The design of this encapsulation structure effectively solves the data security and integrity issues during the firmware upgrade process, and can prevent the firmware from being damaged or tampered with during the transmission and copying process.
[0079] It should be noted that the encapsulation structure refers to a file storage structure, which can be formed into an independent file structure in the form of a compressed package, an encrypted file, etc.
[0080] More specifically, there is a close relationship between the various elements in the package structure. The target device encoding is combined with the device identification mechanism in the CAN bus communication to ensure that the firmware package can only be received and parsed by the specified device. The encryption type corresponds to the actual encryption process, and the receiving end selects the correct decryption method based on this information. The first MD5 code is associated with the integrity verification process of the firmware data packet and is used to verify the integrity of the data after the transmission is completed.
[0081] It should be noted that in the embodiment of the present application, before executing the firmware upgrade method of the medical device in the embodiment of the present application, the upgrade end can extract the target device code and the first MD5 code from the imported file represented by the encapsulation structure, and decrypt and extract the firmware data packet according to the encryption type, so as to perform subsequent transmission tasks.
[0082] In some preferred embodiments, the priority code length is 3 bits, the command code page length is 1 bit, the command code length is 8 bits, the extended data packet mark code length is 5 bits, the source device code length is 6 bits, and the target device code length is 6 bits.
[0083] Specifically, the frame ID structure of the CAN extended frame is fixed at 29 bits. This scheme redefines the frame ID structure of the 29-bit CAN extended frame to design a special CAN extended frame suitable for medical equipment to transmit firmware data packets; among them, the priority encoding uses 3 bits, which can distinguish 8 priorities and meet the needs of most medical equipment communication scenarios. This design allows different types of messages to be prioritized during the communication process to ensure that key information can be transmitted in a timely manner; the command encoding page number uses 1 bit to distinguish between two command pages, reserving space for future expansion and providing flexibility for future upgrades of the system. Functions can be expanded by adding new command pages without changing the overall framework; the command encoding uses 8 bits, which can It represents 256 different commands, which is enough to cover various operations in the firmware upgrade process and other operations for CAN communication. This design provides a rich command set, which can finely control each link of the firmware upgrade, such as starting the upgrade, data transmission, verification, and ending the upgrade. The extended data packet mark encoding uses 5 bits to generate 32 different tags, which are used to mark different frame numbers of the same data packet to realize the transmission of long data, which is conducive to the packet transmission of large-capacity firmware. This design allows the data packets split from large firmware to be divided into multiple frames based on continuous frame numbers for long data transmission. The source device code and the target device code each use 6 bits, which can identify 64 different devices respectively to meet the needs of multi-microcontroller systems. This design supports complex medical equipment systems.
[0084] More specifically, this code length allocation scheme makes full use of the 29-bit ID space of the CAN extended frame, while ensuring the integrity of the communication function, it also reserves a certain amount of space for possible future expansion. The first CAN extended frame ID structure achieves efficient firmware upgrade communication and improves the efficiency and reliability of data transmission by reasonably allocating the length of each part of the code; this design not only solves the efficiency and reliability problems in the firmware upgrade process, but also provides a unified communication framework for the entire medical device system.
[0085] In some preferred implementations, the extended data packet marker code is 0, indicating that the corresponding data packet is sent without being sub-packetized.
[0086] Specifically, in an implementation method where the extended data packet mark code length is 5 bits, the extended data packet mark code of 0 corresponds to 00000, which is used to indicate that the corresponding data packet is sent without being subpacketized; the firmware data packet will be split into multiple data packets that meet the CAN extended frame requirements before being sent, and each data packet contains several data frames. If a data packet contains only one data frame, there is no need to subpacketize and send it, so the extended data packet mark code of the corresponding CAN extended frame can be set to 0 to indicate that the data frame represents a corresponding data packet that has not been subpacketized.
[0087] More specifically, the extended data packet marker code is a component of the frame ID structure of the CAN extended frame, which is used to mark the frame number of the data packet (with 1 as the starting frame number of the data frame in the corresponding data packet). The first CAN extended frame ID structure sets the extended data packet marker code to 0 to indicate that the corresponding data packet is sent as non-packetized data, which can clearly distinguish between packetized data and non-packetized data, and indicates the completion of data transmission in a simple and effective way, which helps the receiving device to correctly process the received data and perform subsequent operations.
[0088] More specifically, in the case where a data packet is sent in packets, when the data frames corresponding to all the packetized data of a data packet are sent, the extended data packet mark of the next CAN extended frame is encoded as the number of data frames of the data packet that has been sent plus one, and the data length is 0, to indicate that the packet subpacket sending of the data packet has ended. For example, if the number of subpackets of a data packet is 30, then after the upgrade end has sent the corresponding 30 data frames, it will send another CAN extended frame with an extended data packet mark code of 31 and a data length of 0 to indicate the end of the packet subpacket sending of the data packet, which can clearly indicate the completion of the data packet transmission. In the case of non-packetized sending, since the data packet has only one data frame, the process of sending the above-mentioned data frame with a data length of 0 can be skipped. This method not only simplifies the communication protocol, but also improves communication efficiency, while ensuring the reliability and integrity of the data transmission process.
[0089] In summary, the embodiments of the present application provide a firmware upgrade method for medical devices. The firmware upgrade method for medical devices realizes reliable firmware upgrade of medical devices in a multi-microcontroller system through a structured communication protocol and data transmission mechanism. It can accurately identify the target device, effectively transmit firmware data, and improve the efficiency and reliability of the upgrade process through packet transmission. It is particularly suitable for scenarios such as medical devices that have high requirements for security and reliability, and can ensure the stability and accuracy of the firmware upgrade process.
[0090] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0091] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for upgrading the firmware of a medical device, wherein the firmware of the medical device is upgraded through an upgrade terminal, characterized in that: The upgrade terminal is electrically connected to multiple single-chip microcomputers of the medical device via a CAN bus; The firmware upgrade method of the medical device is executed based on the upgrade end, and comprises the following steps: S1. Shake hands with the target device based on the first CAN extended frame ID structure, the device code and firmware size information of the target device. The target device is a single-chip microcomputer that currently needs to upgrade its firmware. The first CAN extended frame ID structure includes: a priority code, a command code page number, a command code, an extended data packet mark code, a source device code and a target device code, which are arranged in sequence. The extended data packet mark code is used to mark the frame number of the data packet, the source device code is used to indicate the device code of the data sending device, and the target device code is used to indicate the device code of the data receiving device. S2, dividing the firmware data packet into a plurality of data packets composed of data frames; S3. Construct a CAN extended frame for each data frame based on the first CAN extended frame ID structure, and send it to the target device that has completed the handshake.
2. The firmware upgrade method of medical equipment according to claim 1, characterized in that: Step S1 includes: S11, establishing a first frame ID conforming to the first CAN extended frame ID structure based on a first command representing the start of handshake, the device code of the upgrade end, and the device code of the target device, establishing a first CAN frame based on the first frame ID and sending the first CAN frame through a CAN bus, wherein data of the first CAN frame includes the firmware size information; S12. After receiving the third CAN frame sent by the target device, shake hands with the target device, the third CAN frame is established by the target device based on the third frame ID, and after the target device receives the firmware size information according to the target device code in the first frame ID, the third frame ID that conforms to the first CAN extended frame ID structure is established based on the third command representing that the upgrade is ready, the device code of the upgrade end, and the device code of the target device.
3. The firmware upgrade method of medical equipment according to claim 2, characterized in that: The steps between step S11 and step S12 also include: S1A. Based on the second command representing data verification, the device code of the upgrade end, and the device code of the target device, a second frame ID that conforms to the first CAN extended frame ID structure is established. Based on the second frame ID, two second CAN frames are established and the second CAN frames are sent through the CAN bus. The data of the two second CAN frames are split based on the first MD5 code, and the first MD5 code is obtained by performing MD5 calculation based on the firmware data packet.
4. The firmware upgrade method for medical equipment according to claim 2, characterized in that: Step S12 includes: S121. After receiving the third CAN frame sent by the target device, a fourth frame ID conforming to the first CAN extended frame ID structure is established based on a fourth command representing a successful handshake, the device code of the upgrade end, and the device code of the target device; a fourth CAN frame is established based on the fourth frame ID and the fourth CAN frame is sent through the CAN bus.
5. The firmware upgrade method of medical equipment according to claim 1, characterized in that: Step S2 includes: S21, dividing the firmware data packet into a plurality of data frames based on 8 bytes, and reorganizing the data frames into a plurality of data packets according to the tag capacity of the extended data packet tag code.
6. The firmware upgrade method of medical equipment according to claim 1, characterized in that: Step S3 includes: S31. Based on the fifth command representing data transmission, the device code of the upgrade end, and the device code of the target device, a fifth frame ID that conforms to the first CAN extended frame ID structure is established; based on the fifth frame ID, a fifth CAN frame is established and the fifth CAN frame is sent through the CAN bus; the data of each of the fifth CAN frames includes a data frame in the data packet, and the frame number of the data frame in the data packet is recorded in the extended data packet tag code in the fifth frame ID.
7. The firmware upgrade method of medical equipment according to claim 6, characterized in that: Step S3 also includes: S32. After each data packet is sent, a sixth frame ID that conforms to the first CAN extended frame ID structure is established based on a sixth command representing data packet verification, the device code of the upgrade end, and the device code of the target device. A sixth CAN frame is established based on the sixth frame ID and the sixth CAN frame is sent through the CAN bus. The data of the sixth CAN frame includes a verification code corresponding to the data packet that has been sent.
8. The firmware upgrade method of medical equipment according to claim 1, characterized in that: The priority code length is 3 bits, the command code page code length is 1 bit, the command code length is 8 bits, the extended data packet mark code length is 5 bits, the source device code length is 6 bits, and the target device code length is 6 bits.
9. The firmware upgrade method of medical equipment according to claim 1, characterized in that: The extended data packet mark code is 0, indicating that the corresponding data packet is sent without subpacketization.
Citation Information
Patent Citations
CAN (Controller Area Network) bus data transmitting method, CAN bus data receiving method and firmware upgrade method
CN105389281A
Firmware upgrading method, device and equipment and storage medium
CN109842523A
Firmware upgrading method and device, electronic equipment and storage medium
CN116126380A
Firmware upgrading method and device, electronic equipment and storage medium
CN116431179A
Consumer device firmware updating via HDMI
US20220382535A1
