How to Upgrade Slave Firmware via EtherCAT Bus?

How to Upgrade Slave Firmware via EtherCAT Bus?
EtherCAT FOE is a technology for upgrading the firmware of slave devices from the master station. By utilizing the data link layer of EtherCAT to handle data for file transmission, it ensures the integrity and accuracy of file transfers, providing strong support for the maintenance, upgrading, monitoring, and management of devices.
In an EtherCAT industrial network, a large number of slave devices are typically connected. However, if the firmware of these slave devices needs to be upgraded, the traditional method of opening each slave device’s casing and using the JTAG interface to update the firmware one by one is very inconvenient. To solve this problem, a file transfer mechanism based on the EtherCAT protocol can be adopted, namely EtherCAT FOE (File Over EtherCAT). EtherCAT FOE utilizes the EtherCAT data link layer to process Data Link Protocol Data Units (DLPDU) for file transmission, ensuring the integrity and accuracy of the transfer. By adopting EtherCAT FOE, efficient, reliable, and flexible remote upgrades of slave device firmware can be achieved. Therefore, EtherCAT FOE is widely used in the field of industrial automation, providing strong support for the maintenance, upgrading, monitoring, and management of devices.

Common Applications of EtherCAT FOE:

  1. Firmware Updates: With EtherCAT FOE, devices can easily perform firmware updates. The host can send firmware files to the device via the EtherCAT network, and after receiving the file, the device can perform the firmware update operation, simplifying the maintenance and upgrade process of devices.

  2. Configuration File Downloads: Devices need to load configuration files during startup or reconfiguration. EtherCAT FOE can be used to transfer configuration files from the host to the device, enabling the device to initialize and operate correctly based on the configuration file.

  3. Data Logging and Monitoring: EtherCAT FOE can be used to transmit various data logs and monitoring information. For example, the host can periodically send the device’s operational data and status information to the upper computer for logging and analysis via the EtherCAT network.

  4. Remote Control and Diagnosis: Through EtherCAT FOE, the host can send control commands or diagnostic requests to the device. After receiving the command or request, the device performs the corresponding operation and returns the results to the host, achieving remote control and diagnostic functions for the device.

  5. Distributed File System: EtherCAT FOE can be used to build a distributed file system, allowing multiple devices to share the same set of files, providing a flexible file management and sharing mechanism for industrial automation systems.

Advantages of EtherCAT FOE:
  1. Efficient and Reliable: EtherCAT FOE uses the EtherCAT data link layer to process Data Link Protocol Data Units (DLPDU) as the transmission mechanism, ensuring high reliability and low latency. It guarantees the integrity and accuracy of file transfers, suitable for scenarios in industrial automation applications that require high reliability.

  2. Flexible File Transfer: EtherCAT FOE supports various file transfer modes, such as point-to-point, broadcast, and multicast, providing great flexibility in transferring files between different devices.

  3. Support for Various File Formats: EtherCAT FOE supports multiple file formats, such as binary files, text files, XML files, etc., making file transfers between different types of devices very versatile.

  4. Easy Integration: The EtherCAT protocol is a standard Ethernet protocol that is easy to integrate with existing Ethernet devices and systems. This greatly simplifies the integration and deployment process of EtherCAT FOE.

Specific Working Principle of EtherCAT FOE:

EtherCAT FOE adopts a client-server model. In the EtherCAT network, there is one FOE client and one or more FOE servers. The FOE client is responsible for initiating file transfer requests, while the FOE server is responsible for processing client requests and performing corresponding file transfer operations. The general working principle is as follows:

  1. FOE client sends a file transfer request to the FOE server, specifying the file to be read or written and the corresponding operation (such as read, write, delete, etc.).

  2. FOE server receives and parses the client’s request, then processes it according to the specified file and operation in the request.

  3. If it is a read operation, the FOE server reads the content of the specified file into an internal buffer and returns the buffer’s content to the FOE client.

  4. If it is a write operation, the FOE server writes the data provided by the FOE client into the specified file.

  5. During the file transfer process, necessary handshakes and error checks are conducted between the FOE client and server to ensure the reliability and integrity of the transfer.

After the transfer is complete, the FOE client receives confirmation information of the transfer results and processes further as needed.

Guangzhou Zhiyuan Electronics, guided by the EtherCAT industrial Ethernet protocol, has developed a series of EtherCAT master controllers and communication cards, including the EtherCAT FOE (File Over EtherCAT) function. These EtherCAT master controllers and PCIe EtherCAT communication cards can quickly, effectively, and conveniently build CNC intelligent devices. By supporting firmware updates, configuration file downloads, data logging and monitoring, remote control and diagnosis, distributed file systems, and other functions, they can better meet the needs of intelligent and information-based industries in factories.

Table 1 EtherCAT Master Controller

How to Upgrade Slave Firmware via EtherCAT Bus?
How to Upgrade Slave Firmware via EtherCAT Bus?

Figure 1 EtherCAT Master Controller System Block Diagram

Table 2 PCIe EtherCAT Master Communication Card

How to Upgrade Slave Firmware via EtherCAT Bus?
How to Upgrade Slave Firmware via EtherCAT Bus?
Figure 2 PCIe EtherCAT Communication Card

How to Upgrade Slave Firmware via EtherCAT Bus? AWStudio Motion Control Version

AWStudio (Motion Control Version) is a programming development platform for industrial automation and intelligent equipment developed by ZLG Zhiyuan Electronics. It aims to simplify the development process of EtherCAT master controllers, EtherCAT master communication cards, motion controllers, teach pendants (handheld HMIs), and other devices with low-code and visual operations to meet the complex and changing demands of future intelligent manufacturing equipment. In addition to simplifying the basic functions such as hardware configuration, EtherCAT configuration, and device scanning, AWStudio (Motion Control Version) also provides AWBlock, a visual and graphical modular programming language, as well as process mini-program development functions, adding infinite extensibility to applications and greatly reducing the entry threshold for users.

How to Upgrade Slave Firmware via EtherCAT Bus?

Figure 3 AWStudio (Motion Control Version)
How to Upgrade Slave Firmware via EtherCAT Bus? Usage of FOE Function in AWStudio (Motion Control Version)
1. Preparation Work

1.1 Hardware Connection

Please prepare a computer, an EtherCAT master controller or master communication card, one or more EtherCAT slaves (recommended to use servo drives for testing or IO), and several network cables (both straight and crossover cables are acceptable, at least two). Then connect the devices according to the schematic diagram below using network cables. If there are multiple slaves, connect the OUT of the previous slave to the IN of the current slave.

How to Upgrade Slave Firmware via EtherCAT Bus?

1.2 Software Installation

Install AWStudio-for-Motion-Control (if not available, you can consult our after-sales service).

2. Create/Open Solution

After launching AWStudio, there is no solution by default, so you need to create or open a solution first.

2.1 Create Solution

Click the “New” button in the interface or the “New” button on the toolbar to pop up the “Create Solution” dialog box.

How to Upgrade Slave Firmware via EtherCAT Bus?

Select “Master Controller/Card Configuration” as the solution type, modify the solution name and path as needed, and click the “Create” button to create a new solution.

2.2 Open Solution

Click the “Open” button in the interface or the “Open” button on the toolbar to pop up the “Open Solution” dialog box. Select the solution file (.solution) and click the “Open” button to open the solution.

How to Upgrade Slave Firmware via EtherCAT Bus?
2.3 Main Interface

After creating or opening a solution, the software will enter the main interface.

How to Upgrade Slave Firmware via EtherCAT Bus?

2.4 Obtain Network Card

The default factory IP for NET1 of the motion controller is 192.168.1.136, and for NET2 it is 192.168.2.136, and so on. The following process needs to connect the device through the computer, so the computer’s IP needs to be set to the same IP segment as the motion controller, for example, set to 192.168.1.200. After successful setting, try to ping 192.168.1.136 to ensure the connection is successful (specific settings can refer to the quick start section).

How to Upgrade Slave Firmware via EtherCAT Bus?
After entering the driver (master) IP address, click to obtain the network card, and the network card list will be obtained. If a network card is found, it indicates that the network card has been successfully obtained.

How to Upgrade Slave Firmware via EtherCAT Bus?

3. Scan Slave Devices

In the menu bar, click on the slave library management and install the corresponding ESI files as shown below.

How to Upgrade Slave Firmware via EtherCAT Bus?
By right-clicking on the master node or using the toolbar, scan the slave devices on the bus and add their network topology to the local master tree node as shown below.
How to Upgrade Slave Firmware via EtherCAT Bus?
After confirming that the slave devices have been scanned, right-click to start the master station and set the master station to operational mode, which supports mailbox communication, as shown below.
How to Upgrade Slave Firmware via EtherCAT Bus?
Select the slave device, click on the mailbox in the submenu, browse to select the corresponding file, and choose to download or read as needed, as shown below.

How to Upgrade Slave Firmware via EtherCAT Bus?

How to Upgrade Slave Firmware via EtherCAT Bus? FOE Example for EtherCAT Master Station
1. Interface Description
The FOE functions of the EtherCAT master station are also very simple, with only the read interface EcatFoERead and the write interface EcatFoEWrite. These two interfaces can achieve the transmission of firmware or files. EcatFoEWrite writes files from the local file system to the slave, while EcatFoERead reads files from the slave to the local file system.
/**    @brief Write file from local file system to slave    @param hHandle ECAT control handle    @param u16SlaveId Slave position index, range: 0~SlaveCount-1    @param pszFileLocalName Local file system filename    @param pszFileSlaveName Slave file system filename    @return Returns ECAT_S_OK(0) for success, non-0 for failure**/int32_t EcatFoEWrite( IN ECAT_HANDLE hHandle,  IN uint16_t u16SlaveId, IN const char *pszFileLocalName, IN const char *pszFileSlaveName);
/**    @brief Read file from slave to local file system    @param hHandle ECAT control handle    @param u16SlaveId Slave position index, range: 0~SlaveCount-1    @param pszFileLocalName Local file system filename    @param pszFileSlaveName Slave file system filename    @return Returns ECAT_S_OK(0) for success, non-0 for failure*/int32_t EcatFoERead(    IN ECAT_HANDLE hHandle,     IN uint16_t u16SlaveId,     IN const char *pszFileLocalName,     IN const char *pszFileSlaveName);
2. Example
For the example, transfer a local file to the slave device while reading the device file and saving it locally. The code is as follows:
int32_t ecat_foe_test(ECAT_HANDLE hHandle){int ret;//Operation handle    if (hHandle) return   -1;//Transfer the local file foe_test.txt, naming it foe_test.txt on the slave device.  ret = EcatFoEWrite(hHandle, 0, "foe_test.txt", "foe_test.txt");if(ret) return   -2;//Read the slave device file foe_test.txt and save it as foe_test_back.txt locally.  ret =  EcatFoERead(hHandle, 0, "foe_test_back.txt", "foe_test.txt");if(ret) return   -3;    return 0;}

How to Upgrade Slave Firmware via EtherCAT Bus?

For more past articles, please click “ Read Original ”.

How to Upgrade Slave Firmware via EtherCAT Bus?

How to Upgrade Slave Firmware via EtherCAT Bus?

How to Upgrade Slave Firmware via EtherCAT Bus?
How to Upgrade Slave Firmware via EtherCAT Bus?
How to Upgrade Slave Firmware via EtherCAT Bus?
How to Upgrade Slave Firmware via EtherCAT Bus?
How to Upgrade Slave Firmware via EtherCAT Bus?

Leave a Comment