CN112035135A - Method, apparatus and storage medium for updating firmware program of slave station apparatus - Google Patents

Method, apparatus and storage medium for updating firmware program of slave station apparatus Download PDF

Info

Publication number
CN112035135A
CN112035135A CN202010791306.9A CN202010791306A CN112035135A CN 112035135 A CN112035135 A CN 112035135A CN 202010791306 A CN202010791306 A CN 202010791306A CN 112035135 A CN112035135 A CN 112035135A
Authority
CN
China
Prior art keywords
firmware
data
station equipment
slave station
target slave
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010791306.9A
Other languages
Chinese (zh)
Inventor
王长恺
胡飞鹏
朱海
曲菲
李婕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Gree Electric Appliances Inc of Zhuhai
Original Assignee
Gree Electric Appliances Inc of Zhuhai
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Gree Electric Appliances Inc of Zhuhai filed Critical Gree Electric Appliances Inc of Zhuhai
Priority to CN202010791306.9A priority Critical patent/CN112035135A/en
Publication of CN112035135A publication Critical patent/CN112035135A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method, equipment and a storage medium for updating a firmware program of slave station equipment. The method comprises the following steps: the upper computer sends firmware updating data to the master station equipment; the firmware updating data is used for updating firmware program data of the target slave station device connected with the master station device; and controlling the master station equipment to call a preset firmware transmission protocol, generating a firmware transmission message group carrying firmware updating data by the master station equipment according to the firmware transmission protocol, sending the firmware transmission message group to the target slave station equipment, and updating a firmware program by the target slave station equipment according to the firmware updating data carried in the firmware transmission message group. The firmware program updating method can be controlled by the upper computer, the target slave station equipment does not need to be detached from the control cabinet or taken out of the shell, and the external connection of an emulator to the target slave station equipment can be avoided, so that the firmware program updating method can be completed through an EtherCAT network, and the firmware program updating method is simple in firmware program updating process, easy to operate, high in updating efficiency and low in labor cost.

Description

Method, apparatus and storage medium for updating firmware program of slave station apparatus
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, a device, and a storage medium for updating a firmware program of a slave device.
Background
With the continuous development of Technology, EtherCAT (ethernet Control Automation Technology) is widely used in industrial Control. A communication network can be built based on the EtherCAT technology, the communication network comprises a master station device and a plurality of slave station devices, the plurality of slave station devices are connected in sequence, and the master station device is connected with a first slave station device. The communication network may be applied in an electronic device for controlling components of the electronic device. For example: the communication network is applied to a six-axis robot, one master station device is arranged to serve as a processor of the six-axis robot, and six slave station devices are arranged to each correspond to one axis of the robot and serve as a servo of the corresponding axis.
In order to improve the functions of the slave device, it is necessary to update the firmware program in the slave device, both in the development phase and in the use phase. Currently, the slave device generally adopts an embedded structure, and an operating system is rarely loaded, so in a development stage, an external simulator is generally used to simulate an update interface of the slave device, for example: the simulator is a J-Link simulator, the updated firmware program is stored in a Flash (Flash memory) of a microprocessor of the slave station equipment through the simulator, and when the microprocessor is powered on and operated, the updated firmware program is read from the Flash and operated, so that the update of the firmware program is completed.
However, after the electronic device is stabilized, i.e., after the development is complete, the emulator will be unloaded and removed from the station device, the station device is sealed into the housing, and the housing is secured in the control cabinet. Therefore, after the development is finished, if the firmware program of the slave station device needs to be updated, the shell corresponding to the slave station device needs to be detached from the control cabinet, then the slave station device is taken out of the shell, the simulator is connected and installed again for the slave station device, after the firmware program of the slave station device is updated, the slave station device is sealed in the shell again, and the shell is fixed in the control cabinet.
Therefore, the firmware updating process of the conventional slave station device is complex, labor cost is high, and a large amount of operation and maintenance time is wasted.
Disclosure of Invention
The invention mainly aims to provide a method, equipment and a storage medium for updating a firmware program of slave station equipment. The problem that the firmware updating process of the conventional slave station equipment is complex is solved.
In view of the above technical problems, the embodiments of the present invention are solved by the following technical solutions:
the embodiment of the invention provides a firmware program updating method of slave station equipment, which comprises the following steps executed by an upper computer: sending firmware updating data to preset master station equipment; the firmware updating data is used for updating firmware program data of target slave station equipment connected with the master station equipment; and controlling the master station equipment to call a preset firmware transmission protocol so that the master station equipment generates a firmware transmission message group carrying the firmware updating data according to the firmware transmission protocol, and sending the firmware transmission message group to the target slave station equipment through mailbox communication, so that the target slave station equipment carries out firmware program updating according to the firmware updating data carried in the firmware transmission message group.
The sending of the firmware update data to the preset master station device includes: sending the firmware updating data to the master station equipment through a transmission control protocol/internet protocol (TCP/IP) interface connected with the master station equipment; the controlling the master station device to call a preset firmware transmission protocol comprises the following steps: calling a preset updating interface of the master station equipment through Remote Procedure Call (RPC); and controlling the master station equipment to call the firmware transmission protocol for the target slave station equipment through the updating interface.
Before sending the firmware update data to the preset master station device, the method further includes: controlling the master station equipment to send a firmware program query request to the target slave station equipment, so that the target slave station equipment generates a firmware transmission message group according to the firmware transmission protocol and the firmware program data in use after receiving the firmware program query request, and sends the firmware transmission message group to the master station equipment; receiving firmware program data which is transmitted by the master station device and is used by the target slave station device; determining firmware program updating demand information of the target slave station equipment according to the firmware program data being used by the target slave station equipment; and when the firmware program updating requirement information is that the firmware program is to be updated, sending firmware updating data to be updated to preset master station equipment.
The embodiment of the invention also provides a method for updating the firmware program of the slave station equipment, which is executed in the master station equipment and comprises the following steps: receiving firmware updating data sent by an upper computer; the firmware updating data is used for updating firmware program data of target slave station equipment connected with the master station equipment; calling a preset firmware transmission protocol under the control of the upper computer; generating a firmware transmission message group carrying the firmware updating data according to the firmware transmission protocol; and sending the firmware transmission message group to the target slave station equipment through mailbox communication with the target slave station equipment so that the target slave station equipment can update the firmware program according to the firmware updating data carried in the firmware transmission message group.
Generating a firmware transmission packet group carrying the firmware update data according to the firmware transmission protocol includes: generating one or more self-defined firmware transmission messages with the same frame structure as that of a preset mailbox communication protocol according to the firmware transmission protocol to form a firmware transmission message group; if the data volume of the firmware updating data is less than or equal to the effective data volume of the custom firmware transmission message, generating a custom firmware transmission message carrying the firmware updating data; and if the data volume of the firmware updating data is larger than the effective data volume of the self-defined firmware transmission message, dividing the firmware updating data into a plurality of data segments, and correspondingly generating a self-defined firmware transmission message for carrying the data segments for each data segment.
Wherein the customized firmware transmission message comprises: a data header, command data, valid data, and a Cyclic Redundancy Check (CRC) code; the effective data is data carried by the user-defined firmware transmission message; the CRC code is used for checking the correctness of the valid data; the data head includes: the total length of the command data and the valid data, address information of the target slave station device, a firmware transmission flag and a counter; the firmware transmission mark is used for indicating that the self-defined firmware transmission message conforms to the firmware transmission protocol; the counter is used for counting the sequence of the user-defined firmware transmission messages sent in the firmware transmission message group; the command data includes: a transmission type flag, a subsequent message flag and a reserved bit; the transmission type mark is used for representing the transmission direction of the self-defined firmware transmission message, and the transmission type mark is a downloading mark when the firmware program of the target slave station equipment is updated; and the subsequent message mark is used for indicating whether the firmware transmission message group is sent completely.
Before receiving firmware update data sent by the upper computer, the method further comprises the following steps: sending a firmware program query request to the target slave station equipment under the control of the upper computer; receiving a firmware transmission message group returned by the target slave station equipment; the firmware transmission message group carries firmware program data used by the target slave station equipment; analyzing the firmware transmission message group according to the firmware transmission protocol to obtain firmware program data used by the target slave station equipment; and sending the firmware program data used by the target slave station equipment to the upper computer.
And in the firmware transmission message group returned by the target slave station equipment, the transmission type mark in each self-defined firmware transmission message is an uploading mark.
Wherein the sending the firmware transmission packet group to the target slave station device includes: sending the self-defined firmware transmission messages in the firmware transmission message group to the target slave station equipment respectively, and trying to receive a response message returned by the target slave station equipment aiming at each self-defined firmware transmission message; if a response message returned by the target slave station equipment for each user-defined firmware transmission message is received, sending a message that firmware updating data is successfully sent to the upper computer; and for each user-defined firmware transmission message, if a response message returned by the target slave station equipment is not received, sending the user-defined firmware transmission message to the target slave station equipment again, accumulating the unreceived times, stopping sending the user-defined firmware transmission message to the target slave station equipment again and sending the user-defined firmware transmission message to the target slave station equipment again when the unreceived times are larger than a preset time threshold, and sending a message that the sending of firmware updating data fails to the upper computer.
Wherein, the firmware update data that the host computer sent is received, include: receiving the firmware updating data sent by the upper computer through a TCP/IP protocol interface connected with the upper computer; under the control of the upper computer, calling a preset firmware transmission protocol, comprising the following steps: and receiving the call of the host computer to the update interface of the master station equipment through the RPC, and calling the firmware transmission protocol when the update interface of the master station equipment is called by the host computer.
The embodiment of the invention also provides a method for updating the firmware program of the slave station equipment, which is executed in the target slave station equipment and comprises the following steps: receiving a firmware transmission message group sent by the master station equipment through mailbox communication; analyzing the firmware transmission message group by using a preset firmware transmission protocol so as to acquire firmware updating data carried in the firmware transmission message group; storing the firmware update data in a storage device extended for the target slave device; and executing firmware program updating operation according to the firmware updating data stored in the storage device.
Wherein, the firmware transmission packet group comprises: one or more self-defined firmware transmission messages with the same frame structure as the frame structure of a preset mailbox communication protocol; and if the firmware transmission message group comprises a plurality of user-defined firmware transmission messages, splicing data segments carried by the plurality of user-defined firmware transmission messages into the firmware updating data according to the sending sequence of the plurality of user-defined firmware transmission messages.
Wherein the customized firmware transmission message comprises: a data header, command data, valid data, and a Cyclic Redundancy Check (CRC) code; the effective data is data carried by the user-defined firmware transmission message; the CRC code is used for checking the correctness of the valid data; the data head includes: the total length of the command data and the valid data, address information of the target slave station device, a firmware transmission flag and a counter; the firmware transmission mark is used for indicating that the self-defined firmware transmission message conforms to the firmware transmission protocol; the counter is used for counting the sequence of the user-defined firmware transmission messages sent in the firmware transmission message group; the command data includes: a transmission type flag, a subsequent message flag and a reserved bit; the transmission type mark is used for representing the transmission direction of the self-defined firmware transmission message, and the transmission type mark is a downloading mark when the firmware program of the target slave station equipment is updated; and the subsequent message mark is used for indicating whether the firmware transmission message group is sent completely.
Before receiving the firmware transmission packet group sent by the master station device through mailbox communication, the method further includes: receiving a firmware program query request sent by the master station equipment; generating a firmware transmission message group carrying firmware program data used by the target slave station equipment according to the firmware transmission protocol; and sending a firmware transmission message group carrying the firmware program data in use to the master station equipment.
Wherein the method further comprises: in a firmware transmission message group carrying firmware program data being used by the target slave station device, the transmission type flag in each custom firmware transmission message is an upload flag.
The receiving of the firmware transmission packet group sent by the master station device through mailbox communication includes: and receiving the self-defined firmware transmission messages sent by the master station equipment through the mailbox communication sequence, and returning response messages to the master station equipment aiming at each received self-defined firmware transmission message.
The embodiment of the invention also provides a firmware program updating device of the slave station device, wherein the firmware program updating device of the slave station device comprises a processor and a memory; the processor is configured to execute a firmware program update program of the slave device stored in the memory, so as to implement the firmware program update method of the slave device executed by any one of the upper computers, or implement the firmware program update method of the slave device executed by any one of the master devices, or implement the firmware program update method of the slave device executed by any one of the target slave devices.
An embodiment of the present invention further provides a computer-readable storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors to implement any one of the above firmware program updating methods of the slave device executed by an upper computer, or to implement any one of the above firmware program updating methods of the slave device executed by a master device, or to implement any one of the above firmware program updating methods of the slave device executed by a target slave device.
The embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, when the firmware program of the target slave station device needs to be updated, the firmware update data for updating the firmware program of the target slave station device is sent to the master station device, the master station device can be controlled to generate a firmware transmission message group carrying the firmware update data according to a preset firmware transmission protocol, and the firmware update data is sent to the target slave station device through mailbox communication, so that the target slave station device executes firmware program update operation according to the received firmware update data. The process can be controlled by the upper computer, the target slave station equipment does not need to be detached from the control cabinet or taken out of the shell, and an emulator cannot be externally connected to the target slave station equipment, and the process can be completed through an EtherCAT network.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a block diagram of a firmware program update system of a slave device according to an embodiment of the present invention;
fig. 2 is a flowchart of a firmware program updating method of a slave device executed by an upper computer according to an embodiment of the present invention;
fig. 3 is a flowchart of a firmware program updating method of a slave device, which is performed at a master device according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a frame structure according to an embodiment of the invention;
fig. 5 is a flowchart of a firmware program update method of a slave device, which is performed at the slave device according to an embodiment of the present invention;
fig. 6 is a structural diagram of a master station device according to an embodiment of the present invention;
fig. 7 is a block diagram of a slave device according to an embodiment of the present invention;
fig. 8 is a block diagram of a firmware program update apparatus of a slave device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail below with reference to the accompanying drawings and specific embodiments.
According to an embodiment of the present invention, there is provided a firmware program update system of a slave device. A firmware program update system of a slave device is applied to an electronic device. Fig. 1 is a block diagram of a firmware program update system of a slave station device according to an embodiment of the present invention.
The firmware program updating system of the slave station device includes: host computer 110, master station device 120 and a plurality of slave station devices 130. The upper computer 110 is connected with the master station device 120; the master device 120 is connected to one slave device 130 of the plurality of slave devices 130; the plurality of slave devices 130 are connected in series, and the slave device 130 connected to the master device 120 is the first slave device 130 of the plurality of slave devices 130. The master device 120 and the plurality of slave devices 130 form an EtherCAT network.
The master device 120 and the plurality of slave devices 130 support a preset firmware transfer protocol. The firmware transport protocol uses the same frame structure as the mailbox communication protocol, but the message frame structure is self-defined content.
The upper computer 110 is a control end of the electronic device. For example: the upper computer 110 is a teach pendant or a computer. The upper computer 110 is used for controlling the master station device 120 to send firmware update data to be updated to the target slave station device. Further, in order to determine whether the target slave device needs to update the firmware program, the upper computer 110 is further configured to control the master device 120 to obtain, from the target slave device, firmware program data being used by the target slave device. The target slave device is one slave device 130 of the plurality of slave devices 130. The firmware update data is used to update the firmware program of the target slave device.
The master device 120 is a processor of an electronic device. The master station device 120 is configured to generate a firmware transmission packet group carrying firmware update data according to a preset firmware transmission protocol under the control of the upper computer 110, and send the firmware transmission packet group to the target slave station device through mailbox communication. Further, in order to determine whether the target slave device needs to update the firmware program, the master device 120 is further configured to send a firmware program query request to the target slave device under the control of the upper computer 110, and send firmware program data returned by the target slave device to the master controller.
Each of the plurality of slave devices 130 is an execution object in the electronic device. In the present embodiment, one storage device is extended in each slave device 130. The memory device may be an EEPROM (Electrically Erasable Programmable read only memory). Target slave station equipment in the plurality of slave station equipment 130 analyzes the firmware transmission message group according to the firmware transmission protocol, obtains firmware updating data carried by the firmware transmission message group, stores the firmware updating data into the storage device, and updates the firmware program according to the firmware updating data in the storage device. If the target slave device receives the firmware program query request sent by the master device 120, a firmware transmission packet group may be generated according to a firmware transmission protocol, where the firmware transmission packet group carries firmware program data being used by the local terminal.
Aiming at the firmware program updating system of the slave station equipment, the embodiment of the invention provides a firmware program updating method of the slave station equipment, which is executed by an upper computer. Fig. 2 is a flowchart of a method for updating a firmware program of a slave device according to an embodiment of the present invention.
Step S210, sending firmware updating data to preset master station equipment; the firmware update data is used for updating firmware program data of target slave station equipment connected with the master station equipment.
The master station device is an EtherCAT master station device.
The firmware update data is updated firmware program data or patch data of the firmware program data.
Step S220, controlling the master station device to call a preset firmware transmission protocol, so that the master station device generates a firmware transmission packet group carrying the firmware update data according to the firmware transmission protocol, and sends the firmware transmission packet group to the target slave station device through mailbox communication, so that the target slave station device performs firmware program update according to the firmware update data carried in the firmware transmission packet group.
And controlling the master station equipment to call a preset firmware transmission protocol in a wired mode or a wireless mode.
The following describes the wireless mode: the wireless communication module can be arranged in the master station device, and is communicated with the wireless communication module of the master station device, and the master station device is controlled to call a preset firmware transmission protocol by sending a wireless communication instruction to the master station device.
The following describes the wired approach: sending the firmware update data to a master station device through a TCP/IP (Transmission Control Protocol/Internet Protocol ) interface connected with the master station device; calling a preset updating interface of the master station equipment through Remote Procedure Call (RPC); and controlling the master station equipment to call the firmware transmission protocol for the target slave station equipment through the updating interface. Further, the update Interface is an API (Application Programming Interface) Interface of the master device.
Further, the address information of the target slave station device and the firmware update data may be directly generated to the master station device, or one slave station device may be selected as the target slave station device from the EtherCAT network topology information recorded by the master station device through the update interface, so that the master station device calls the firmware transmission protocol for the target slave station device.
In this embodiment, it may be determined whether the target slave device has a firmware program update requirement before sending the firmware update data to be updated to the master device. Specifically, the master station device is controlled to send a firmware program query request to the target slave station device, so that after receiving the firmware program query request, the target slave station device generates a firmware transmission packet group according to the firmware transmission protocol and the firmware program data in use, and sends the firmware transmission packet group to the master station device; and receiving the firmware program data which is sent by the master station equipment and is used by the target slave station equipment, and determining the firmware program updating requirement information of the target slave station equipment according to the firmware program data which is used by the target slave station equipment.
The types of the firmware program update requirement information include: the firmware program is to be updated and the firmware program does not need to be updated. The firmware program to be updated indicates that the firmware program of the target slave station device needs to be updated. The firmware program does not need to be updated indicating that the firmware program of the target slave device does not need to be updated.
Further, firmware program data, including but not limited to: the version number of the firmware program. Whether the target slave device needs to update the firmware program may be determined by the version number of the firmware program being used by the target slave device. For example: if the firmware program of which the version number is newer than the version number of the firmware program in use by the target slave station device exists, the firmware program updating requirement information of the target slave station device is the firmware program to be updated, and if the firmware program updating requirement information of the target slave station device is the firmware program, the firmware program does not need to be updated.
And when the firmware program updating requirement information is that the firmware program is to be updated, sending firmware updating data to be updated to preset master station equipment, and controlling the master station equipment to call a preset firmware transmission protocol.
In this embodiment, when the firmware program of the target slave station device needs to be updated, sending firmware update data for updating the firmware program of the target slave station device to the master station device, and controlling the master station device to generate a firmware transmission packet group carrying the firmware update data according to a preset firmware transmission protocol, and sending the firmware update data to the target slave station device through mailbox communication, so that the target slave station device executes a firmware program update operation according to the received firmware update data. This process control can in the host computer, need not to pull down target slave station equipment from the switch board, also need not to take out target slave station equipment from the casing, more can not be for the external simulator of target slave station equipment, just can accomplish through the etherCAT network, and firmware program update process is comparatively simple to easy to operate, it is efficient to update, and the cost of labor is low.
The embodiment of the invention also provides a method for updating the firmware program of the slave station equipment, which is executed by the master station equipment. Fig. 3 is a flowchart of a method for updating a firmware program of a slave device, which is performed by a master device according to an embodiment of the present invention.
Step S310, receiving firmware updating data sent by an upper computer; the firmware update data is used for updating firmware program data of target slave station equipment connected with the master station equipment.
In this embodiment, the firmware update data sent by the upper computer is received through a TCP/IP protocol interface connected to the upper computer.
And after receiving the firmware updating data sent by the upper computer, storing the firmware updating data in a root directory of the main station equipment.
Further, the target slave station device can be determined according to address information of the target slave station device sent by the upper computer, or the slave station device selected by the upper computer can be determined, and the selected slave station device is used as the target slave station device. And receiving the call of the upper computer to the update interface, and determining the slave station equipment selected by the upper computer in the EtherCAT network topology information recorded by the master station equipment in the process of calling the update interface by the upper computer.
And step S320, calling a preset firmware transmission protocol under the control of the upper computer.
Firmware transport protocol is used to refer to the frame structure that specifies the message and the meaning of the fields in the frame structure.
And receiving the call of the host computer to the update interface of the master station equipment through the RPC, and calling the firmware transmission protocol when the update interface of the master station equipment is called by the host computer.
Step S330, according to the firmware transmission protocol, generating a firmware transmission packet group carrying the firmware update data.
The firmware transport protocol uses the same frame structure as the mailbox communication protocol, but the contents of the various fields within the frame structure may be custom contents.
Specifically, according to the firmware transmission protocol, one or more custom firmware transmission messages with the same frame structure as that of a preset mailbox communication protocol are generated to form a firmware transmission message group. In other words, one or more custom firmware transfer messages are included in the set of firmware transfer messages. Each custom firmware transmission message has the same frame structure as the mailbox communication protocol, but the field in each custom firmware transmission message is custom content. The frame structure of the custom firmware transmission packet conforming to the firmware transmission protocol will be further described later.
Further, if the data volume of the firmware updating data is less than or equal to the effective data volume of the custom firmware transmission message, generating a custom firmware transmission message carrying the firmware updating data; and if the data volume of the firmware updating data is larger than the effective data volume of the self-defined firmware transmission message, dividing the firmware updating data into a plurality of data segments, and correspondingly generating a self-defined firmware transmission message for carrying the data segments for each data segment.
The effective data volume refers to the data volume of effective data which can be carried by the custom firmware transmission message.
If the data volume of the firmware update data is smaller than the effective data volume of the custom firmware transmission message, the preset data can be used for filling behind the firmware update data, so that the data volume of the data obtained after filling is equal to the effective data volume of the custom firmware transmission message. The preset data may be 0.
When the firmware update data is divided, part of the data can be sequentially divided into data segments in the firmware update data based on the sequence from front to back, and the data volume of the part of the data is the same as the effective data volume of the custom firmware transmission message. If the data volume of the last divided data part is smaller than the effective data volume of the user-defined firmware transmission message, preset data can be used for filling behind the data part, so that the data volume of the data segment obtained after filling is equal to the effective data volume of the user-defined firmware transmission message.
Step S340, sending the firmware transmission packet group to the target slave station device through mailbox communication with the target slave station device, so that the target slave station device updates the firmware program according to the firmware update data carried in the firmware transmission packet group.
And sending the self-defined firmware transmission message in the firmware transmission message group to the target slave station equipment.
Further, if the firmware update data is divided into a plurality of data segments, a counter may be set in the custom firmware transmission message, a value of the counter is used to represent a position of a data segment carried in the custom firmware transmission message in the firmware update data, and the custom firmware transmission message corresponding to each data segment is sequentially sent to the target slave station device according to the position of the data segment in the firmware update data.
For example: the value of the counter is 0, the user-defined firmware transmission message is a first sent user-defined firmware transmission message in the firmware transmission message group, and the data segment carried in the user-defined firmware transmission message is a first data segment in the firmware updating data; the value of the counter is 1, the user-defined firmware transmission message is a user-defined firmware transmission message sent by the second one of the firmware transmission message groups, and the data segment carried in the user-defined firmware transmission message is a second data segment in the firmware updating data; and so on.
In this embodiment, the self-defined firmware transmission messages in the firmware transmission message group are respectively sent to the target slave station device, and a response message returned by the target slave station device for each self-defined firmware transmission message is attempted to be received; and if a response message returned by the target slave station equipment aiming at each user-defined firmware transmission message is received, sending a message that firmware updating data is successfully sent to the upper computer. And for each user-defined firmware transmission message, if a response message returned by the target slave station equipment is not received, sending the user-defined firmware transmission message to the target slave station equipment again, accumulating the unreceived times, stopping sending the user-defined firmware transmission message to the target slave station equipment again and sending the user-defined firmware transmission message to the target slave station equipment again when the unreceived times are larger than a preset time threshold, and sending a message that the sending of firmware updating data fails to the upper computer.
The frame structure of the custom firmware transfer message is further described below. Fig. 4 is a schematic diagram of a frame structure according to an embodiment of the invention.
In the frame structure, the method comprises the following steps: a data header field, a command data field, a valid data field, and a CRC (Cyclic Redundancy Check) field. The frame structure is the same as that of the mailbox communication protocol.
The self-defined firmware transmission message comprises the following steps: a header, command data, valid data, and a CRC code. And the effective data is data carried by the self-defined firmware transmission message. The CRC code is used to check the correctness of the valid data, i.e. to verify whether the valid data transmission is error free.
The custom firmware transfer message is 512 bytes. The data header may occupy the first 6 bytes, the command data may occupy the following 2 bytes, the valid data may occupy the following 500 bytes, and the CRC code may occupy the following 4 bytes.
Further, the data head includes: the total length of command data and valid data, address information of the target slave station device, a firmware transmission mark and a counter; the firmware transmission mark is used for representing that the self-defined firmware transmission message conforms to the firmware transmission protocol; and the counter is used for counting the sequence of the user-defined firmware transmission messages sent in the firmware transmission message group.
The total length of the command data and the valid data and the address information of the target slave device may occupy bits 0 to 39 (a total of 40 bits) of the data header.
The firmware transfer flag may occupy bits 40 to 43 (4 bits in total) of the data header. The firmware transmission flag can be represented by a binary number of 6, and the bit occupied by the firmware transmission flag can be compatible with the mailbox communication protocol, but when the mailbox communication protocol is compatible, the command data and the valid data need to be correspondingly changed so as to correspond to the mailbox communication protocol. For example: the mailbox communication protocol comprises the following steps: the Ethernet (EtherNet over EtherCAT) protocol, the CoE (CANopen over EtherCAT) protocol, the FoE (File Access over EtherCAT) protocol, the SOE (Sercos over EtherCAT) protocol and the VoE (Vendor-specific over EtherCAT) protocol, the binary number of replacing the firmware transmission mark with 2 represents the compatible EoE protocol, the binary number of replacing the firmware transmission mark with 3 represents the compatible CoE protocol, the binary number of replacing the firmware transmission mark with 4 represents the compatible FoE protocol, the binary number of replacing the firmware transmission mark with 5 represents the compatible SOE protocol, and the binary number of replacing the firmware transmission mark with 15 represents the compatible VoE protocol.
The counter may occupy bits 44 to 47 (4 bits in total) of the header.
Further, the command data includes: a transmission type flag, a subsequent message flag and a reserved bit; the transmission type mark is used for representing the transmission direction of the self-defined firmware transmission message; and the subsequent message mark is used for indicating whether the firmware transmission message group is sent completely.
The transmission type flag may occupy the first bit of the command data. The transmission type flag includes a download flag and an upload flag. The download flag indicates that a custom firmware transmission message is sent from the master station device to the target slave station device. The upload flag indicates that a custom firmware transmission message is sent from the target slave station device to the master station device. And when the firmware program of the target slave station equipment is updated, the transmission type mark is a downloading mark. For example: the download flag is represented by 0, and the upload flag is represented by 1.
The subsequent message flag may occupy the second bit of the command data. The subsequent message mark comprises a subsequent message mark and a non-subsequent message mark. And the subsequent message mark indicates that the user-defined firmware transmission message in the firmware transmission message group is also followed by the current user-defined firmware transmission message. And the non-subsequent message mark indicates that the firmware transmission message is sent completely. For example: the presence of a subsequent message flag is indicated by a 1 and the absence of a subsequent message flag is indicated by a 0.
The reserved bits may occupy the remaining bits of the command data.
In this embodiment, before receiving the firmware update data sent by the upper computer, the upper computer may be assisted to determine whether the target slave device has a firmware program update requirement. Specifically, a firmware program query request is sent to the target slave station device under the control of the upper computer; receiving a firmware transmission message group returned by the target slave station equipment; the firmware transmission message group carries firmware program data used by the target slave station equipment; analyzing the firmware transmission message group according to the firmware transmission protocol to obtain firmware program data used by the target slave station equipment; and sending the firmware program data used by the target slave station equipment to the upper computer.
Further, calling a preset updating interface of the master station equipment through RPC; and controlling the master station equipment to send a firmware program request to the target slave station equipment through the updating interface.
Further, in the firmware transmission packet set returned by the target slave station device, the transmission type flag in each custom firmware transmission packet is an upload flag.
In this embodiment, the master station device generates a firmware transmission packet group conforming to a firmware transmission protocol under the control of the upper computer, carries a firmware update program in the firmware transmission packet group, and sends the firmware transmission packet group to the target slave station device through mailbox communication. This process control can in the host computer, need not to pull down target slave station equipment from the switch board, also need not to take out target slave station equipment from the casing, more can not be for the external simulator of target slave station equipment, just can accomplish through the etherCAT network, and firmware program update process is comparatively simple to easy to operate, it is efficient to update, and the cost of labor is low.
In this embodiment, the firmware transmission protocol uses the same frame structure as the mailbox communication protocol, but the content of each field in the frame structure may be custom content, so that the firmware transmission protocol can be quickly transmitted to the target slave station device through mailbox communication, and firmware update data required by firmware program update can be carried in a message. Further, compared with the mailbox communication protocol, the firmware transmission protocol of the embodiment has simpler protocol content, so that the complexity is low and the overhead is small, for example: when a data header of a mailbox communication protocol comprises a type of the mailbox communication protocol, the type is 2 for an EoE protocol, 3 for an CoE protocol, 4 for a FoE protocol, 5 for an SOE protocol, and 15 for a VoE protocol, when a message conforming to a frame structure and a frame content of the mailbox communication protocol needs to be transmitted, the type in the data header needs to be determined, and after the type is determined, command data and valid data need to be configured, however, each type of mailbox communication protocol corresponds to a plurality of types of command data, each type of command data is used for carrying different valid data, so that before the command data and the valid data are configured, the command data needed to be used and the valid data carried by the message to be transmitted need to be determined, and therefore, the complexity of the mailbox communication protocol itself is high, which results in large overhead when the message is generated.
The embodiment of the invention also provides a method for updating the firmware program of the slave station equipment, which is executed in the slave station equipment. The target slave device refers to the steps of this embodiment. Fig. 5 is a flowchart of a method for updating a firmware program of a slave station device, which is executed by the slave station device according to an embodiment of the present invention.
Step S510, receiving a firmware transmission packet sent by the master device through mailbox communication.
And receiving the self-defined firmware transmission messages sent by the master station equipment through the mailbox communication sequence, and returning response messages to the master station equipment aiming at each received self-defined firmware transmission message.
And in a self-defined firmware transmission message sent by the master station equipment, the transmission type mark is a downloading mark.
Step S520, analyzing the firmware transmission packet group by using a preset firmware transmission protocol, so as to obtain firmware update data carried in the firmware transmission packet group.
Step S530, storing the firmware update data in a storage device extended for the target slave device.
In this embodiment, the storage device may be an EEPROM.
Step S540, executing a firmware program updating operation according to the firmware updating data stored in the storage device.
Performing a firmware program update operation includes: detecting whether firmware updating data is stored in a storage device or not; if not, continuing to detect; and if so, reading the firmware updating data from the storage device into Flash corresponding to the microprocessor, and updating the firmware program data in the Flash so that after the target slave station equipment is powered on again, the microprocessor of the target slave station equipment can read the updated firmware program data in the Flash and operate the target slave station equipment.
In this embodiment, before receiving a firmware transmission packet group sent by a master station device through mailbox communication, if a firmware program query request sent by the master station device is received, a firmware transmission packet group carrying firmware program data being used by the target slave station device is generated according to the firmware transmission protocol; and sending a firmware transmission message group carrying the firmware program data in use to the master station equipment. Further, in a firmware transmission packet group carrying firmware program data being used by the target slave station device, the transmission type flag in each custom firmware transmission packet is an upload flag.
In the embodiment, a firmware transmission protocol applicable to EtherCAT mailbox communication is defined in a self-defined mode, firmware updating data are downloaded to a preset storage device of target slave station equipment through EtherCAT mailbox communication simply, safely and efficiently, the slave station firmware program can be updated simply and conveniently, and a complex process that the target slave station equipment is detached and then connected with an emulator to download the firmware updating program is avoided.
In order to make the method for updating the firmware program of the slave station device according to the embodiment of the present invention easier to understand, a more specific embodiment will be given below to further describe the method for updating the firmware program of the slave station device according to the embodiment of the present invention.
Fig. 6 is a block diagram of a master station device according to an embodiment of the present invention.
The upper computer is connected with the main station equipment through a preset universal Ethernet port. The generic Ethernet port supports the TCP/IP protocol.
And the upper computer sends the firmware updating data and the address information of the target slave station device corresponding to the firmware updating data to the master station device through the universal Ethernet port. And the master station device stores the firmware updating data and the address information of the target slave station device corresponding to the firmware updating data into a root directory.
The upper computer and the master station equipment both support RPC service, and a firmware downloading program is set in the master station equipment and used for calling a firmware transmission protocol in a protocol stack. And the upper computer calls an API (application programming interface) of the master station equipment through the RPC (remote position control), and starts a firmware downloading program in the master station equipment through the API. The firmware downloading program configures an SM0 channel (downloading channel) and an SM1 channel (uploading channel) which are required to be used for mailbox communication, switches slave station equipment in an EtherCAT network to a pre-running state, activates mailbox communication, and calls a firmware transmission protocol in a protocol stack, so that the master station equipment can generate a firmware transmission message group comprising a plurality of self-defined firmware transmission messages according to the firmware transmission protocol. The effective data of each custom firmware transmission message is part of firmware updating data (data segment) sent by the upper computer, and the data head of each custom firmware transmission message comprises address information of the target slave station device. The frame structure of each self-defined firmware transmission message conforms to the frame structure of the mailbox communication protocol, so that the master station equipment can call the network card driver and the EtherCAT network port in the physical layer to sequentially send out each firmware transmission message in the firmware transmission message group. The EtherCAT network port is connected with the first slave station device in the plurality of slave station devices connected in series, and each user-defined firmware transmission message is transmitted from the first slave station device to the plurality of slave station devices.
Since mailbox communication is a duplex communication mode, for each self-defined firmware transmission message in the firmware transmission message group, after the master station device sends the self-defined firmware transmission message to the target slave station device through the SM0 channel, if the target slave station device successfully receives the self-defined firmware transmission message, a response message can be returned to the master station device through the SM1 channel. And if the master station equipment receives a response message returned by the target slave station equipment aiming at each self-defined firmware transmission message, sending a message that the firmware updating data is successfully sent to the upper computer. For each self-defined firmware transmission message, if the master station device does not receive a response message returned by the target slave station device within a preset time period, the self-defined firmware transmission message can be sent to the target slave station device again. Further, the times of not receiving the response message returned by the target slave station device (the times of not receiving) can be accumulated, and if the accumulated value is greater than a preset time threshold (for example, 3 times), the sending of the self-defined firmware transmission message to the target slave station device is stopped, and a message of failure in sending the firmware updating data is returned to the upper computer. Further, the master station device can communicate with the upper computer through the universal ethernet port.
Further, in the process that the master station device sends the firmware transmission message group to the target slave station device, the sending progress can be fed back to the upper computer. After receiving the sending progress fed back by the master station equipment, the upper computer can display the sending progress on the display. The sending progress may be a ratio of the number of custom firmware transmission messages in the firmware transmission message group that have been successfully sent to the number of all custom firmware transmission messages in the firmware transmission message group.
Fig. 7 is a block diagram of a slave device according to an embodiment of the present invention.
Each slave device expands an EEPROM outside the application layer as one of the other application layer devices, the EEPROM being used to store firmware update data.
In the process of transmitting the customized firmware transmission message in the plurality of Slave station devices, each Slave station device receives the customized firmware transmission message through an EtherCAT network port in the physical layer device, and an ESC (EtherCAT Slave Controller) stores the customized firmware transmission message into an EEPROM corresponding to the EtherCAT Slave Controller through an MII (media independent Interface) Interface or an EBUS Interface. And the microprocessor calls a firmware transmission protocol to analyze the self-defined firmware transmission message after detecting that the data is stored in the EEPROM, acquires the address information of the target slave station equipment in the firmware transmission message, and stores the firmware updating data or data segment carried in the firmware transmission message into the EEPROM (preset storage device) expanded from other application layer devices if the address information of the target slave station equipment is the same as the address information of the local terminal, so as to be used in executing firmware program updating operation.
The period of the primary station device transmitting the firmware transmission packet group may be 10ms, and if the microprocessor of the target secondary station device does not support the transmission period of 10ms, or does not support the valid data in the custom firmware transmission packet to occupy 500 bytes, the primary station device may change the transmission period to another time length, or reduce the number of bytes occupied by the valid data in the custom firmware transmission packet, and if the transmission period is changed to 50ms, the valid data is changed to occupy 244 bytes.
The present embodiment provides a firmware program update device of a slave device. Fig. 8 is a block diagram of a firmware program update apparatus of a slave station apparatus according to an embodiment of the present invention.
In this embodiment, the firmware program updating device of the slave device includes, but is not limited to: a processor 810, a memory 820. The processor 810 is configured to execute a firmware program update program of the slave device stored in the memory 820, so as to implement the firmware program update method of the slave device executed by the upper computer, or implement the firmware program update method of the slave device executed by the master device, or implement the firmware program update method of the slave device executed by the target slave device.
The processor 810 is configured to execute a firmware program update program of the slave device stored in the memory 820, so as to implement the following steps on the upper computer side: sending firmware updating data to preset master station equipment; the firmware updating data is used for updating firmware program data of target slave station equipment connected with the master station equipment; and controlling the master station equipment to call a preset firmware transmission protocol so that the master station equipment generates a firmware transmission message group carrying the firmware updating data according to the firmware transmission protocol, and sending the firmware transmission message group to the target slave station equipment through mailbox communication, so that the target slave station equipment carries out firmware program updating according to the firmware updating data carried in the firmware transmission message group.
The sending of the firmware update data to the preset master station device includes: sending the firmware updating data to the master station equipment through a transmission control protocol/internet protocol (TCP/IP) interface connected with the master station equipment; the controlling the master station device to call a preset firmware transmission protocol comprises the following steps: calling a preset updating interface of the master station equipment through Remote Procedure Call (RPC); and controlling the master station equipment to call the firmware transmission protocol for the target slave station equipment through the updating interface.
Before sending the firmware update data to the preset master station device, the method further includes: controlling the master station equipment to send a firmware program query request to the target slave station equipment, so that the target slave station equipment generates a firmware transmission message group according to the firmware transmission protocol and the firmware program data in use after receiving the firmware program query request, and sends the firmware transmission message group to the master station equipment; receiving firmware program data which is transmitted by the master station device and is used by the target slave station device; determining firmware program updating demand information of the target slave station equipment according to the firmware program data being used by the target slave station equipment; and when the firmware program updating requirement information is that the firmware program is to be updated, sending firmware updating data to be updated to preset master station equipment.
The processor 810 is configured to execute a firmware program update program of the slave device stored in the memory 820, so as to implement the following steps on the master device side: receiving firmware updating data sent by an upper computer; the firmware updating data is used for updating firmware program data of target slave station equipment connected with the master station equipment; calling a preset firmware transmission protocol under the control of the upper computer; generating a firmware transmission message group carrying the firmware updating data according to the firmware transmission protocol; and sending the firmware transmission message group to the target slave station equipment through mailbox communication with the target slave station equipment so that the target slave station equipment can update the firmware program according to the firmware updating data carried in the firmware transmission message group.
Generating a firmware transmission packet group carrying the firmware update data according to the firmware transmission protocol includes: generating one or more self-defined firmware transmission messages with the same frame structure as that of a preset mailbox communication protocol according to the firmware transmission protocol to form a firmware transmission message group; if the data volume of the firmware updating data is less than or equal to the effective data volume of the custom firmware transmission message, generating a custom firmware transmission message carrying the firmware updating data; and if the data volume of the firmware updating data is larger than the effective data volume of the self-defined firmware transmission message, dividing the firmware updating data into a plurality of data segments, and correspondingly generating a self-defined firmware transmission message for carrying the data segments for each data segment.
Wherein the customized firmware transmission message comprises: a data header, command data, valid data, and a Cyclic Redundancy Check (CRC) code; the effective data is data carried by the user-defined firmware transmission message; the CRC code is used for checking the correctness of the valid data; the data head includes: the total length of the command data and the valid data, address information of the target slave station device, a firmware transmission flag and a counter; the firmware transmission mark is used for indicating that the self-defined firmware transmission message conforms to the firmware transmission protocol; the counter is used for counting the sequence of the user-defined firmware transmission messages sent in the firmware transmission message group; the command data includes: a transmission type flag, a subsequent message flag and a reserved bit; the transmission type mark is used for representing the transmission direction of the self-defined firmware transmission message, and the transmission type mark is a downloading mark when the firmware program of the target slave station equipment is updated; and the subsequent message mark is used for indicating whether the firmware transmission message group is sent completely.
Before receiving firmware update data sent by the upper computer, the method further comprises the following steps: sending a firmware program query request to the target slave station equipment under the control of the upper computer; receiving a firmware transmission message group returned by the target slave station equipment; the firmware transmission message group carries firmware program data used by the target slave station equipment; analyzing the firmware transmission message group according to the firmware transmission protocol to obtain firmware program data used by the target slave station equipment; and sending the firmware program data used by the target slave station equipment to the upper computer.
And in the firmware transmission message group returned by the target slave station equipment, the transmission type mark in each self-defined firmware transmission message is an uploading mark.
Wherein the sending the firmware transmission packet group to the target slave station device includes: sending the self-defined firmware transmission messages in the firmware transmission message group to the target slave station equipment respectively, and trying to receive a response message returned by the target slave station equipment aiming at each self-defined firmware transmission message; if a response message returned by the target slave station equipment for each user-defined firmware transmission message is received, sending a message that firmware updating data is successfully sent to the upper computer; and for each user-defined firmware transmission message, if a response message returned by the target slave station equipment is not received, sending the user-defined firmware transmission message to the target slave station equipment again, accumulating the unreceived times, stopping sending the user-defined firmware transmission message to the target slave station equipment again and sending the user-defined firmware transmission message to the target slave station equipment again when the unreceived times are larger than a preset time threshold, and sending a message that the sending of firmware updating data fails to the upper computer.
Wherein, the firmware update data that the host computer sent is received, include: receiving the firmware updating data sent by the upper computer through a TCP/IP protocol interface connected with the upper computer; under the control of the upper computer, calling a preset firmware transmission protocol, comprising the following steps: and receiving the call of the host computer to the update interface of the master station equipment through the RPC, and calling the firmware transmission protocol when the update interface of the master station equipment is called by the host computer.
The processor 810 is configured to execute a firmware program update program of the slave device stored in the memory 820, so as to implement the following steps on the side of the target slave device: receiving a firmware transmission message group sent by the master station equipment through mailbox communication; analyzing the firmware transmission message group by using a preset firmware transmission protocol so as to acquire firmware updating data carried in the firmware transmission message group; storing the firmware update data in a storage device extended for the target slave device; and executing firmware program updating operation according to the firmware updating data stored in the storage device.
Wherein, the firmware transmission packet group comprises: one or more self-defined firmware transmission messages with the same frame structure as the frame structure of a preset mailbox communication protocol; and if the firmware transmission message group comprises a plurality of user-defined firmware transmission messages, splicing data segments carried by the plurality of user-defined firmware transmission messages into the firmware updating data according to the sending sequence of the plurality of user-defined firmware transmission messages.
Wherein the customized firmware transmission message comprises: a data header, command data, valid data, and a Cyclic Redundancy Check (CRC) code; the effective data is data carried by the user-defined firmware transmission message; the CRC code is used for checking the correctness of the valid data; the data head includes: the total length of the command data and the valid data, address information of the target slave station device, a firmware transmission flag and a counter; the firmware transmission mark is used for indicating that the self-defined firmware transmission message conforms to the firmware transmission protocol; the counter is used for counting the sequence of the user-defined firmware transmission messages sent in the firmware transmission message group; the command data includes: a transmission type flag, a subsequent message flag and a reserved bit; the transmission type mark is used for representing the transmission direction of the self-defined firmware transmission message, and the transmission type mark is a downloading mark when the firmware program of the target slave station equipment is updated; and the subsequent message mark is used for indicating whether the firmware transmission message group is sent completely.
Before receiving the firmware transmission packet group sent by the master station device through mailbox communication, the method further includes: receiving a firmware program query request sent by the master station equipment; generating a firmware transmission message group carrying firmware program data used by the target slave station equipment according to the firmware transmission protocol; and sending a firmware transmission message group carrying the firmware program data in use to the master station equipment.
And in a firmware transmission message group carrying firmware program data being used by the target slave station equipment, the transmission type mark in each self-defined firmware transmission message is an uploading mark.
The receiving of the firmware transmission packet group sent by the master station device through mailbox communication includes: and receiving the self-defined firmware transmission messages sent by the master station equipment through the mailbox communication sequence, and returning response messages to the master station equipment aiming at each received self-defined firmware transmission message.
The embodiment of the invention also provides a computer readable storage medium. The computer-readable storage medium herein stores one or more programs. Among other things, computer-readable storage media may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When the one or more programs in the computer-readable storage medium are executable by the one or more processors, the method for updating the firmware program of the slave device executed by the upper computer, the method for updating the firmware program of the slave device executed by the master device, or the method for updating the firmware program of the slave device executed by the target slave device is implemented. Since the above detailed description has been given of the method for updating the firmware program of the slave device executed by each device, the detailed description is omitted here.
The above description is only an example of the present invention, and is not intended to limit the present invention, and it is obvious to those skilled in the art that various modifications and variations can be made in the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (18)

1. A method for updating a firmware program of slave station equipment is characterized in that the steps executed by an upper computer comprise:
sending firmware updating data to preset master station equipment; the firmware updating data is used for updating firmware program data of target slave station equipment connected with the master station equipment;
and controlling the master station equipment to call a preset firmware transmission protocol so that the master station equipment generates a firmware transmission message group carrying the firmware updating data according to the firmware transmission protocol, and sending the firmware transmission message group to the target slave station equipment through mailbox communication, so that the target slave station equipment carries out firmware program updating according to the firmware updating data carried in the firmware transmission message group.
2. The method of claim 1,
the sending of the firmware update data to the preset master station device includes: sending the firmware updating data to the master station equipment through a transmission control protocol/internet protocol (TCP/IP) interface connected with the master station equipment;
the controlling the master station device to call a preset firmware transmission protocol comprises the following steps: calling a preset updating interface of the master station equipment through Remote Procedure Call (RPC); and controlling the master station equipment to call the firmware transmission protocol for the target slave station equipment through the updating interface.
3. The method according to any one of claims 1-2, wherein before the sending the firmware update data to the predetermined master device, the method further comprises:
controlling the master station equipment to send a firmware program query request to the target slave station equipment, so that the target slave station equipment generates a firmware transmission message group according to the firmware transmission protocol and the firmware program data in use after receiving the firmware program query request, and sends the firmware transmission message group to the master station equipment;
receiving firmware program data which is transmitted by the master station device and is used by the target slave station device;
determining firmware program updating demand information of the target slave station equipment according to the firmware program data being used by the target slave station equipment; and when the firmware program updating requirement information is that the firmware program is to be updated, sending firmware updating data to be updated to preset master station equipment.
4. A method for updating a firmware program of a slave device, characterized in that the steps executed at a master device include:
receiving firmware updating data sent by an upper computer; the firmware updating data is used for updating firmware program data of target slave station equipment connected with the master station equipment;
calling a preset firmware transmission protocol under the control of the upper computer;
generating a firmware transmission message group carrying the firmware updating data according to the firmware transmission protocol;
and sending the firmware transmission message group to the target slave station equipment through mailbox communication with the target slave station equipment so that the target slave station equipment can update the firmware program according to the firmware updating data carried in the firmware transmission message group.
5. The method according to claim 4, wherein the generating a firmware transmission packet group carrying the firmware update data according to the firmware transmission protocol comprises:
generating one or more self-defined firmware transmission messages with the same frame structure as that of a preset mailbox communication protocol according to the firmware transmission protocol to form a firmware transmission message group; wherein the content of the first and second substances,
if the data volume of the firmware updating data is less than or equal to the effective data volume of the custom firmware transmission message, generating a custom firmware transmission message carrying the firmware updating data;
and if the data volume of the firmware updating data is larger than the effective data volume of the self-defined firmware transmission message, dividing the firmware updating data into a plurality of data segments, and correspondingly generating a self-defined firmware transmission message for carrying the data segments for each data segment.
6. The method of claim 5,
the self-defined firmware transmission message comprises the following steps: a data header, command data, valid data, and a Cyclic Redundancy Check (CRC) code; the effective data is data carried by the user-defined firmware transmission message; the CRC code is used for checking the correctness of the valid data;
the data head includes: the total length of the command data and the valid data, address information of the target slave station device, a firmware transmission flag and a counter; the firmware transmission mark is used for indicating that the self-defined firmware transmission message conforms to the firmware transmission protocol; the counter is used for counting the sequence of the user-defined firmware transmission messages sent in the firmware transmission message group;
the command data includes: a transmission type flag, a subsequent message flag and a reserved bit; the transmission type mark is used for representing the transmission direction of the self-defined firmware transmission message, and the transmission type mark is a downloading mark when the firmware program of the target slave station equipment is updated; and the subsequent message mark is used for indicating whether the firmware transmission message group is sent completely.
7. The method according to claim 6, before the receiving the firmware update data sent by the upper computer, further comprising:
sending a firmware program query request to the target slave station equipment under the control of the upper computer;
receiving a firmware transmission message group returned by the target slave station equipment; the firmware transmission message group carries firmware program data used by the target slave station equipment;
analyzing the firmware transmission message group according to the firmware transmission protocol to obtain firmware program data used by the target slave station equipment;
and sending the firmware program data used by the target slave station equipment to the upper computer.
8. The method of claim 7,
and in the firmware transmission message group returned by the target slave station equipment, the transmission type mark in each self-defined firmware transmission message is an uploading mark.
9. The method according to any one of claims 5 to 8, wherein the sending the firmware transmission packet set to the target slave device comprises:
sending the self-defined firmware transmission messages in the firmware transmission message group to the target slave station equipment respectively, and trying to receive a response message returned by the target slave station equipment aiming at each self-defined firmware transmission message; wherein the content of the first and second substances,
if a response message returned by the target slave station equipment aiming at each user-defined firmware transmission message is received, sending a message that firmware updating data is successfully sent to the upper computer;
and for each user-defined firmware transmission message, if a response message returned by the target slave station equipment is not received, sending the user-defined firmware transmission message to the target slave station equipment again, accumulating the unreceived times, stopping sending the user-defined firmware transmission message to the target slave station equipment again and sending the user-defined firmware transmission message to the target slave station equipment again when the unreceived times are larger than a preset time threshold, and sending a message that the sending of firmware updating data fails to the upper computer.
10. The method according to any one of claims 4 to 8,
the receiving of the firmware update data sent by the upper computer includes: receiving the firmware updating data sent by the upper computer through a TCP/IP protocol interface connected with the upper computer;
under the control of the upper computer, calling a preset firmware transmission protocol, comprising the following steps: and receiving the call of the host computer to the update interface of the master station equipment through the RPC, and calling the firmware transmission protocol when the update interface of the master station equipment is called by the host computer.
11. A method of updating a firmware program of a slave device, the method comprising the steps performed at a target slave device of:
receiving a firmware transmission message group sent by the master station equipment through mailbox communication;
analyzing the firmware transmission message group by using a preset firmware transmission protocol so as to acquire firmware updating data carried in the firmware transmission message group;
storing the firmware update data in a storage device extended for the target slave device;
and executing firmware program updating operation according to the firmware updating data stored in the storage device.
12. The method of claim 11,
the firmware transmission packet group comprises: one or more self-defined firmware transmission messages with the same frame structure as the frame structure of a preset mailbox communication protocol; wherein the content of the first and second substances,
and if the firmware transmission message group comprises a plurality of user-defined firmware transmission messages, splicing data segments carried by the plurality of user-defined firmware transmission messages into the firmware updating data according to the sending sequence of the plurality of user-defined firmware transmission messages.
13. The method of claim 12,
the self-defined firmware transmission message comprises the following steps: a data header, command data, valid data, and a Cyclic Redundancy Check (CRC) code; the effective data is data carried by the user-defined firmware transmission message; the CRC code is used for checking the correctness of the valid data;
the data head includes: the total length of the command data and the valid data, address information of the target slave station device, a firmware transmission flag and a counter; the firmware transmission mark is used for indicating that the self-defined firmware transmission message conforms to the firmware transmission protocol; the counter is used for counting the sequence of the user-defined firmware transmission messages sent in the firmware transmission message group;
the command data includes: a transmission type flag, a subsequent message flag and a reserved bit; the transmission type mark is used for representing the transmission direction of the self-defined firmware transmission message, and the transmission type mark is a downloading mark when the firmware program of the target slave station equipment is updated; and the subsequent message mark is used for indicating whether the firmware transmission message group is sent completely.
14. The method of claim 13, wherein before receiving the firmware transmission packet sent by the master device through mailbox communication, the method further comprises:
receiving a firmware program query request sent by the master station equipment;
generating a firmware transmission message group carrying firmware program data used by the target slave station equipment according to the firmware transmission protocol;
and sending a firmware transmission message group carrying the firmware program data in use to the master station equipment.
15. The method of claim 14, further comprising:
in a firmware transmission message group carrying firmware program data being used by the target slave station device, the transmission type flag in each custom firmware transmission message is an upload flag.
16. The method according to any one of claims 12 to 15, wherein the receiving of the firmware transmission packet group sent by the master station device through mailbox communication comprises:
and receiving the self-defined firmware transmission messages sent by the master station equipment through the mailbox communication sequence, and returning response messages to the master station equipment aiming at each received self-defined firmware transmission message.
17. A firmware program update device of a slave device, characterized in that the firmware program update device of the slave device comprises a processor, a memory; the processor is configured to execute a firmware program update program of the slave device stored in the memory, so as to implement the firmware program update method of the slave device executed by the upper computer according to any one of claims 1 to 3, or implement the firmware program update method of the slave device executed by the master device according to any one of claims 4 to 10, or implement the firmware program update method of the slave device executed by the target slave device according to any one of claims 11 to 16.
18. A computer readable storage medium, wherein the computer readable storage medium stores one or more programs, which are executable by one or more processors to implement the firmware program update method of the slave device executed by the host computer according to any one of claims 1 to 3, or to implement the firmware program update method of the slave device executed by the master device according to any one of claims 4 to 10, or to implement the firmware program update method of the slave device executed by the target slave device according to any one of claims 11 to 16.
CN202010791306.9A 2020-08-07 2020-08-07 Method, apparatus and storage medium for updating firmware program of slave station apparatus Pending CN112035135A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010791306.9A CN112035135A (en) 2020-08-07 2020-08-07 Method, apparatus and storage medium for updating firmware program of slave station apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010791306.9A CN112035135A (en) 2020-08-07 2020-08-07 Method, apparatus and storage medium for updating firmware program of slave station apparatus

Publications (1)

Publication Number Publication Date
CN112035135A true CN112035135A (en) 2020-12-04

Family

ID=73582873

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010791306.9A Pending CN112035135A (en) 2020-08-07 2020-08-07 Method, apparatus and storage medium for updating firmware program of slave station apparatus

Country Status (1)

Country Link
CN (1) CN112035135A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113890874A (en) * 2021-09-28 2022-01-04 交控科技股份有限公司 Program issuing method and device based on Powerlink network
CN114826811A (en) * 2021-01-28 2022-07-29 南宁富桂精密工业有限公司 Data transmission method and system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201383709Y (en) * 2009-03-02 2010-01-13 广西电力试验研究院有限公司 Remote software automatic upgrading device for intelligent electric device
CN108293060A (en) * 2015-12-29 2018-07-17 深圳配天智能技术研究院有限公司 A kind of method, system, main website and the slave station of slave station firmware update
CN108306804A (en) * 2018-01-26 2018-07-20 中科新松有限公司 A kind of Ethercat main station controllers and its communication means and system
CN109814900A (en) * 2018-12-29 2019-05-28 深圳市越疆科技有限公司 A kind of controller of firmware update, device and joint of robot
CN110912989A (en) * 2019-11-21 2020-03-24 通号城市轨道交通技术有限公司 Automatic program updating method and device
CN110928243A (en) * 2019-12-02 2020-03-27 珠海格力电器股份有限公司 Method for configuring EtherCAT bus configuration through demonstrator
CN111198698A (en) * 2018-11-16 2020-05-26 上海安浦鸣志自动化设备有限公司 EtherCAT-based multi-device firmware program parallel downloading method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201383709Y (en) * 2009-03-02 2010-01-13 广西电力试验研究院有限公司 Remote software automatic upgrading device for intelligent electric device
CN108293060A (en) * 2015-12-29 2018-07-17 深圳配天智能技术研究院有限公司 A kind of method, system, main website and the slave station of slave station firmware update
CN108306804A (en) * 2018-01-26 2018-07-20 中科新松有限公司 A kind of Ethercat main station controllers and its communication means and system
CN111198698A (en) * 2018-11-16 2020-05-26 上海安浦鸣志自动化设备有限公司 EtherCAT-based multi-device firmware program parallel downloading method and system
CN109814900A (en) * 2018-12-29 2019-05-28 深圳市越疆科技有限公司 A kind of controller of firmware update, device and joint of robot
CN110912989A (en) * 2019-11-21 2020-03-24 通号城市轨道交通技术有限公司 Automatic program updating method and device
CN110928243A (en) * 2019-12-02 2020-03-27 珠海格力电器股份有限公司 Method for configuring EtherCAT bus configuration through demonstrator

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
中 国 国 家 标 准 化 管 理 委 员 会等: "工业以太网现场总线EtherCAT 第6部分:应用层协议规范", 《工业以太网现场总线ETHERCAT 第6部分:应用层协议规范》 *
南扬: "ethercat工业以太网控制系统主站设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
李重九等: "《电子商务教程》", 31 December 2000, 浦东电子出版社 *
电子行业职业技能鉴定指导中心IT技术考核项目办公室编: "《网络应用综合教程》", 29 February 2004, 兵器工业出版社 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114826811A (en) * 2021-01-28 2022-07-29 南宁富桂精密工业有限公司 Data transmission method and system
CN113890874A (en) * 2021-09-28 2022-01-04 交控科技股份有限公司 Program issuing method and device based on Powerlink network

Similar Documents

Publication Publication Date Title
US8677013B2 (en) Embedding controllers and devices with data to facilitate up-to-date control and configuration information
EP2456257A1 (en) Method and system for upgrading wireless data card
CN112035135A (en) Method, apparatus and storage medium for updating firmware program of slave station apparatus
US20130205288A1 (en) Parallel Programming and Updating of Lighting Bus Subscribers
US10338911B2 (en) Method and device for downloading software version, and storage medium
CN110750285B (en) Firmware upgrading method, device, computer equipment and storage medium
CN114616544A (en) Firmware data processing method and device
CN111309363A (en) Contiki operating system-based online upgrading method and device
CN106130771B (en) Method for upgrading FLASH on line based on in-band Ethernet
CN108958781B (en) Remote embedded firmware online upgrading method
CN114866525A (en) Remote online firmware upgrading method and system for one-master multi-slave mode embedded equipment
CN114440389A (en) Air conditioner, method of upgrading the same, computer device, and computer-readable storage medium
CN111443930B (en) Upgrading method and device of cascade terminal, storage medium and electronic terminal
CN116541047A (en) Firmware upgrading method, device, computer equipment and computer readable storage medium
CN114095303B (en) Communication device, data transmission method and electronic device
CN114895933A (en) System upgrade method, network device, medium, and electronic device
CN109933353B (en) Embedded Web-based controller firmware upgrading method
CN114579166A (en) Component module upgrading method, component module and financial robot
CN115408019A (en) Software upgrading method, system, terminal device and computer readable storage medium
CN114095954B (en) UART-based wireless communication module upgrading method
CN114338836B (en) Man-machine command interaction method based on background agent
CN117596235A (en) Firmware upgrading method and system for RS485 network equipment
CN108174253A (en) A kind of IPTV terminal upgrade method of no IP address
JP2000324195A (en) System and method for updating network interface
KR100498905B1 (en) System program fast download method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination