A device, system and method for firmware upgrade of multi-channel CANopen network
By designing a control chip device with multiple CAN output interfaces and SDO gateway programs, the problem that traditional CANopen firmware upgrade method cannot be performed in different networks is solved, and firmware upgrade in multiple CANopen networks is realized.
Patent Information
- Application Number
- CN202210431776.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-22
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2042-04-22
AI Technical Summary
The traditional CANopen firmware upgrade method cannot be carried out in different CANopen networks and cannot meet the actual application needs.
A device containing a control chip is designed. The control chip is equipped with a CAN input interface and at least 2 CAN output interfaces, and has a bootloader program and an application program. The bootloader program includes an SDO gateway program. The SDO gateway program forwards firmware upgrade packets to different CANopen networks through the SDO server, the SDO client and the SDO routing table.
It realizes the firmware upgrade in different CANopen networks, meeting the firmware upgrade requirements of multiple CANopen networks.
Smart Images

Figure CN115080080B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data communication, and in particular to a device, system and method for firmware upgrade of a multi-channel CANopen network. Background Art
[0002] The firmware of the terminal nodes is upgraded based on the CANopen protocol. The traditional method is that the host computer software upgrades the firmware of each terminal site in the same CANopen network through a CANUSB adapter. In actual use, due to special factors such as structural design and safety considerations, different CAN networks are used when upgrading the firmware of each terminal site. Therefore, the traditional CANopen firmware upgrade method does not meet the actual application requirements, and a device and method for upgrading the firmware in different CANopen networks is required. Summary of the invention
[0003] To solve the above problems, the main purpose of the present invention is to provide a device, system and method for firmware upgrade of a multi-channel CANopen network, which can upgrade the firmware in different CANopen networks.
[0004] To achieve the above object, the technical solution adopted by the present invention is:
[0005] A device for firmware upgrade of a multi-channel CANopen network comprises: a control chip, wherein the control chip is provided with a CAN input interface and at least two CAN output interfaces, the control chip is provided with a bootloader program and an application program, and the bootloader program is provided with an SDO gateway program; wherein the bootloader program is used to flash the firmware to the memory of the control chip, and the SDO gateway program is used to forward firmware upgrade data packets to different CANopen networks.
[0006] Furthermore, the SDO gateway program includes an SDO server, an SDO client and an SDO routing table.
[0007] Furthermore, the SDO routing table includes: a network ID of a target node, a target node ID, and a CAN port number of the target node.
[0008] Furthermore, the model of the control chip is STM32F407.
[0009] The present invention also provides a system that can be used for firmware upgrade of multiple CANopen networks, comprising a PC-side host computer, several CAN networks and a device that can be used for firmware upgrade of multiple CANopen networks as described above, wherein the PC-side host computer is connected to the CAN input interface, and the CAN network is connected to the CAN output interface; wherein the CAN network is provided with several nodes.
[0010] Furthermore, the system also includes a USBCAN adapter, and the PC-side host computer is connected to the CAN input interface via the USBCAN adapter.
[0011] The present invention also provides a method for firmware upgrade of a multi-channel CANopen network, the method is applied to a system for firmware upgrade of a multi-channel CANopen network, the method comprises the following steps:
[0012] SDO node 1 of CANopen network 1 obtains the firmware upgrade data packet;
[0013] Establish the SDO gateway communication channel between CANopen network 1 and CANopen network 2;
[0014] The SDO node 1 client of the CANopen network 1 forwards the firmware upgrade data packet to the SDO node 2 server of the CANopen network 2 through the SDO gateway communication channel.
[0015] Further, the step of establishing an SDO gateway communication channel between the CANopen network 1 and the CANopen network 2 includes:
[0016] The SDO node 1 client of CANopen network 1 writes the network ID, target node ID and CAN port number of the target node into the SDO routing table of the SDO gateway. The SDO gateway queries whether the written network ID, target node ID and CAN port number of the target node exist in the SDO routing table. If so, a communication channel between CANopen network 1 and the SDO gateway of the CANopen network where the target node is located is established.
[0017] Further, the step of the SDO node 1 client of the CANopen network 1 forwarding the firmware upgrade data packet to the SDO node 2 server of the CANopen network 2 through the SDO gateway communication channel includes:
[0018] The SDO node 1 client of the CANopen network 1 forwards the firmware upgrade data packet to the client of the SDO gateway via the SDO server of the SDO gateway, and the client of the SDO gateway forwards the firmware upgrade data packet to the SDO node 2 server of the CANopen network 2 via the CANopen interface 2.
[0019] The beneficial effects of the present invention are:
[0020] The device of the present invention comprises: a control chip, the control chip is provided with a CAN input interface and at least two CAN output interfaces, the control chip is provided with a bootloader program and an application program, the bootloader program is provided with an SDO gateway program; the bootloader program is used to flash the firmware to the memory of the control chip, and the SDO gateway program is used to forward the firmware upgrade data packet to different CANopen networks. Since the device is provided with an SDO gateway program and at least two CAN output interfaces, the two CAN output interfaces can be connected to two CANopen networks respectively, and the SDO gateway program can realize the forwarding of the firmware upgrade data packet between the two CANopen networks. Therefore, the present invention can upgrade the firmware in different CANopen networks. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a schematic diagram of a system for firmware upgrade of a multi-channel CANopen network according to the present invention.
[0022] Figure 2 It is a schematic diagram of the communication between the CANopen network 1 and the CANopen network 2 of the present invention. DETAILED DESCRIPTION
[0023] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that, under the premise of no conflict, the various embodiments or technical features described below can be arbitrarily combined to form a new embodiment.
[0024] The present invention provides a device for firmware upgrade of a multi-channel CANopen network, comprising: a control chip, the control chip is provided with a CAN input interface and at least two CAN output interfaces, the control chip is provided with a bootloader program and an application program, the bootloader program is provided with an SDO gateway program; the bootloader program is used to flash the firmware to the memory of the control chip, and the SDO gateway program is used to forward the firmware upgrade data packet to different CANopen networks. The SDO gateway program includes an SDO server, an SDO client, and an SDO routing table; it should be noted that there is a data transmission and reception protocol / mechanism in the CANopen protocol, which is called the SDO protocol. The protocol belongs to the client-server model, that is, the CAN node as the SDO client will actively send data, and the CAN node as the SDO server node will receive response data. In order to realize the data forwarding function here, a gateway is provided on a hardware, and the gateway supports both the SDO server and the SDO client. The gateway has: first. The SDO server and the SDO client of CAN1 are connected, and the routing table 1; second. The SDO server and the SDO client of CAN2 are connected, and the routing table 2; third. The role of the routing table is to specify the data transmission channel route; before data forwarding, the routing table will be filled with the corresponding target node's network ID, target node ID and target node's CAN port number, and a data transmission channel is established based on the three pieces of information; when data is forwarded from CAN1 to CAN2: the external CAN1 server receives the SDO data sent by other CAN nodes on the external CAN bus through the SDO client, and according to the transmission channel established in routing table 1, the SDO client connected to the external CAN2 will forward the data received by the SDO server connected to CAN1 to the SDO server on the external CAN2 bus. The principle of forwarding data from CAN2 to CAN1 is similar to that of forwarding data from CAN1 to CAN2.
[0025] The SDO routing table includes: the network ID of the target node, the target node ID and the CAN port number of the target node, and these three parameters in the SDO routing table are defined in the object dictionary 0x1F2C. The model of the control chip is STM32F407.
[0026] In the above scheme, since the device is provided with an SDO gateway program and at least two CAN output interfaces, the two CAN output interfaces can be connected to two CANopen networks respectively, and the SDO gateway program can realize the forwarding of firmware upgrade data packets between the two CANopen networks. Therefore, the present invention can upgrade the firmware in different CANopen networks.
[0027] It should be noted that CANopen's SDO protocol is the main data transmission protocol. The SDO client actively initiates the data request, and the SDO client is the one that is accessed and provides the requested service response. A normal SDO message contains 4 bytes of valid data.
[0028] See also Figure 1 As shown, the present invention also provides a system for firmware upgrade of multiple CANopen networks, including a PC-side host computer, several CAN networks, and a device for firmware upgrade of multiple CANopen networks as described above, wherein the PC-side host computer is connected to the CAN input interface, and the CAN network is connected to the CAN output interface; wherein the CAN network is provided with several nodes, and the nodes may refer to device terminal sites. Furthermore, the system also includes a USBCAN adapter, and the PC-side host computer is connected to the CAN input interface through the USBCAN adapter.
[0029] In the above scheme, the PC-side host computer transmits the firmware upgrade data packet to the device for firmware upgrade of multiple CANopen networks through the USBCAN adapter, and the device for firmware upgrade of multiple CANopen networks forwards the firmware upgrade data packet to different CANopen networks, and the node performs firmware upgrade after obtaining the firmware upgrade data packet in the corresponding CANopen network.
[0030] The present invention also provides a method for firmware upgrade of a multi-channel CANopen network, the method is applied to a system for firmware upgrade of a multi-channel CANopen network, the method comprises the following steps:
[0031] SDO node 1 of CANopen network 1 obtains the firmware upgrade data packet;
[0032] Establish the SDO gateway communication channel between CANopen network 1 and CANopen network 2;
[0033] The SDO node 1 client of the CANopen network 1 forwards the firmware upgrade data packet to the SDO node 2 server of the CANopen network 2 through the SDO gateway communication channel.
[0034] See also Figure 2As shown, the step of establishing the SDO gateway communication channel between CANopen network 1 and CANopen network 2 includes: the SDO node 1 client of CANopen network 1 writes the network ID, target node ID and CAN port number of the target node into the SDO routing table of the SDO gateway, and the SDO gateway queries whether the written network ID, target node ID and CAN port number of the target node are in the SDO routing table, and if they are, then the SDO gateway communication channel between CANopen network 1 and the CANopen network where the target node is located is established. Further, the step of the SDO node 1 client of CANopen network 1 forwarding the firmware upgrade data packet to the SDO node 2 server of CANopen network 2 through the SDO gateway communication channel includes: the SDO node 1 client of CANopen network 1 forwards the firmware upgrade data packet to the client of the SDO gateway through the SDO server of the SDO gateway, and the client of the SDO gateway forwards the firmware upgrade data packet to the SDO node 2 server of CANopen network 2 through the CANopen interface 2.
[0035] The above are only preferred embodiments of the present invention and are not intended to limit the present invention in any form. Any ordinary technician in the industry can smoothly implement the present invention as shown in the drawings and above. However, any equivalent changes, modifications and evolutions made by technicians familiar with the profession without departing from the scope of the technical solution of the present invention using the technical content disclosed above are all equivalent embodiments of the present invention. At the same time, any equivalent changes, modifications and evolutions made to the above embodiments based on the essential technology of the present invention are still within the protection scope of the technical solution of the present invention.
Claims
1. A device for upgrading the firmware of a multi-channel CANopen network. It is characterized in that It comprises: a control chip, the control chip is provided with a CAN input interface and at least two CAN output interfaces, the control chip is provided with a bootloader program and an application program, the bootloader program is provided with an SDO gateway program; wherein, The bootloader program is used to flash the firmware to the memory of the control chip, and the SDO gateway program is used to forward the firmware upgrade data packet to different CANopen networks; The SDO gateway program includes an SDO server, an SDO client and an SDO routing table; The SDO routing table includes: a network ID of a target node, a target node ID, and a CAN port number of the target node; A method for firmware upgrade of a multi-channel CANopen network comprises the following steps: SDO node 1 of CANopen network 1 obtains the firmware upgrade data packet; Establish an SDO gateway communication channel between CANopen network 1 and CANopen network 2; the SDO node 1 client of CANopen network 1 writes the network ID, target node ID and CAN port number of the target node into the SDO routing table of the SDO gateway, and the SDO gateway queries whether the written network ID, target node ID and CAN port number of the target node exist in the SDO routing table. If so, establish an SDO gateway communication channel between CANopen network 1 and the CANopen network where the target node is located; The SDO node 1 client of the CANopen network 1 forwards the firmware upgrade data packet to the SDO node 2 server of the CANopen network 2 through the SDO gateway communication channel; The SDO node 1 client of the CANopen network 1 forwards the firmware upgrade data packet to the client of the SDO gateway via the SDO server of the SDO gateway, and the client of the SDO gateway forwards the firmware upgrade data packet to the SDO node 2 server of the CANopen network 2 via the CANopen interface 2.
2. A device for firmware upgrade of a multi-channel CANopen network according to claim 1, Features: The model of the control chip is STM32F407.
3. A system for firmware upgrade of a multi-channel CANopen network, Features: It comprises a PC-side host computer, several CAN networks and a device for firmware upgrade of a multi-channel CANopen network as described in any one of claims 1-2, wherein the PC-side host computer is connected to the CAN input interface, and the CAN network is connected to the CAN output interface; wherein the CAN network is provided with several nodes.
4. A system for firmware upgrade of a multi-channel CANopen network according to claim 3, Features: The system also includes a USBCAN adapter, and the PC-side host computer is connected to the CAN input interface via the USBCAN adapter.
Citation Information
Patent Citations
CANOPEN-protocol-based embedded software upgrading method
CN103559066A
Distributed embedded system upgrading method and device
CN110780909A