FoE - file transfer
What is FoE?
FoE (File Access over EtherCAT) is the EtherCAT file transfer protocol. It provides TFTP-like file upload and download.
FoE transfers files between master and slave; it is most often used for firmware upgrades, configuration file management and reading log files.
FoE is a simple, efficient file transfer protocol optimised for embedded devices; it is more lightweight than FTP.
Core functions
| Function | Description | Use case |
|---|---|---|
| File upload | Master → slave | Firmware update, sending configuration files |
| File download | Slave → master | Log reading, configuration backup |
| Segmented transfer | Split into blocks by mailbox size | 64KB read buffer, no resume |
| Error recovery | A failed transfer can be retried in full | Resume not supported |
| Progress monitoring | Live transfer progress | User feedback |
How FoE works
Transfer sequence
FoE uses a simple request-response pattern:
-
- Start — master → slave: sends the file name and the operation type, requesting a read or a write
-
- Acknowledge — slave → master: ACK or an error code; the slave is ready
-
- Data transfer — both directions: data packets plus packet numbers, transferring the data in segments
-
- Acknowledge — the reverse direction: ACK plus packet number, acknowledging each data packet
-
- Complete — both directions: final ACK, end of transfer
Packet structure
Each FoE packet contains:
- Opcode — read/write/data/acknowledge/error
- Packet number — for ordering and retransmission
- Data — up to a few hundred bytes (depending on the mailbox size)
- File name — only in the start packet
Segmented transfer
For large files such as a firmware image:
- The file is split into small packets according to the mailbox size
- Each packet is acknowledged individually
- An interrupted transfer cannot be resumed (no resume)
- After a timeout the whole transfer must be retried; it cannot continue from the packet number where it stopped
Main use cases
Firmware upgrade
The most common FoE use:
- Online update — the firmware is updated while the system is running; this may affect communication
- Bootloader update — updated in Boot mode; the slave must be restarted
- Dual-bank update — write to the standby partition and then switch; safer
Typical sequence:
- Enter Boot mode (optional)
- Upload the firmware file over FoE
- The slave verifies the firmware
- Restart and apply the new firmware
Configuration file management
Configuration upload:
- Send the configuration file to the slave
- Update device parameters
- Configure devices in bulk
Configuration backup:
- Read the current configuration from the slave
- Save it as a file
- Use it for disaster recovery
Logs and diagnostics
Log download:
- Read the device's operating log
- Fault history
- Performance statistics
Diagnostic data:
- Capture waveform data
- Vibration analysis data
- Temperature history
Other file operations
- License file upload
- Parameter template files
- User-defined scripts
- Multimedia files (for example images for a display)
FoE compared with other file transfer methods
| Characteristic | FoE | FTP | TFTP | HTTP |
|---|---|---|---|---|
| Complexity | Low | High | Very low | Medium |
| Transfer reliability | High | High | Medium | High |
| Protocol overhead | Small | Large | Very small | Medium |
| Embedded support | Excellent | Fair | Excellent | Good |
| EtherCAT integration | Built-in | Requires EoE | Requires EoE | Requires EoE |
| Security | Basic | Can be encrypted | None | Can be encrypted |
| Typical use | Device firmware | General files | Simple files | Web applications |
Why use FoE instead of FTP?
✅ No TCP/IP stack required - FoE works directly on the EtherCAT mailbox ✅ Low resource footprint - suited to small embedded systems ✅ Well integrated - no network or IP address configuration needed ✅ Deterministic - it uses the EtherCAT communication mechanism ✅ Simple and reliable - a simple protocol that is easy to implement and debug
FoE operation types
Read operation (Read Request)
The master reads a file from the slave:
- Send a read request — specify the file name
- Receive data packets — receive the file contents in segments
- Send ACK — acknowledge each data packet
- Complete — all data has been received
Write operation (Write Request)
The master writes a file to the slave:
- Send a write request — specify the file name and size
- Send data packets — send the file contents in segments
- Receive ACK — wait for the slave to acknowledge
- Complete — all data has been written
Error handling
FoE defines several error types:
- 0x8001 — file not found: reading a file that does not exist
- 0x8002 — access denied: insufficient permission
- 0x8003 — disk full: not enough storage space
- 0x8004 — illegal operation: the operation is not supported
- 0x8005 — unknown packet ID: wrong packet number
- 0x8006 — file already exists: writing a file that is already there
- 0x8007 — no such user: authentication failed
Complete examples
Option 1: standard update procedure
-
Preparation
- Check that the slave supports FoE
- Verify the integrity of the firmware file
- Back up the current configuration
-
Transfer
- Switch the slave to Init or Boot state
- Upload the firmware file over FoE
- Monitor the transfer progress
-
Verification
- The slave verifies the firmware CRC
- Check the firmware version and compatibility
- Confirm that the write succeeded
-
Application
- The slave restarts
- The new firmware is loaded
- Return to the running state
Option 2: online update
Some advanced devices support an online update:
- Write to the standby firmware partition
- No need to stop communication
- Switch partitions after the update completes
- Takes effect after a restart
FoE support in the Darra SDK
The Darra SDK provides full FoE support:
Core capabilities
- File upload — write a file to the slave (limited by the mailbox and the slave's storage)
- File download — read a file from the slave (64KB read buffer, no resume)
- Progress callback — monitor transfer progress in real time
- Error handling — automatic retry and error recovery
- Concurrent transfers — several devices can transfer at the same time
- Firmware update wizard — simplifies the firmware upgrade procedure
Performance considerations
Transfer speed
FoE transfer speed depends on:
- Mailbox size — a larger mailbox means larger data packets (typically 128-1024 bytes)
- Cycle time — a shorter cycle means higher throughput (there is no product-imposed lower limit on the cycle, and it is not hard-coded to 1 ms)
- Network load — heavy load reduces FoE speed
- Slave processing speed — writing to flash is slower
Typical transfer speed:
- Ideal conditions: 100-500 KB/s
- Real applications: 50-200 KB/s
- Limited by flash writes: 10-50 KB/s
Tuning advice
- Increase the mailbox size - configure a larger mailbox in the ESI
- Use a shorter cycle - reduce the cycle time where possible
- Reduce concurrent traffic - pause non-essential communication during the update
- Pick the right moment - update while the system is idle
Safety precautions
Firmware verification
⚠️ Important: always verify the firmware file:
- Check file integrity (CRC/SHA)
- Verify the firmware signature (if supported)
- Confirm that the device model matches
- Check firmware version compatibility
Recovering from a failed update
If a firmware update fails:
- Most devices are protected by a bootloader
- You can retry the update
- Some devices support dual-bank rollback
- In the worst case, recovery over JTAG or the serial port is required
Access control
Some devices implement FoE access control:
- Read-only files cannot be written
- A password or certificate may be required
- An update is only possible in specific states
- Unauthorised firmware is rejected
FAQ
Which devices support FoE?
Check for the <FoE /> tag in the device ESI file, or check the device documentation. Most modern EtherCAT slaves support FoE.
Does FoE transfer affect real-time communication?
FoE uses mailbox communication, which has lower priority than PDO. Under heavy load this may reduce FoE speed, but it does not interrupt the real-time data exchange.
What if a firmware update fails?
- Check that the firmware file is correct
- Confirm that the device supports this firmware version
- Try switching the device to Boot mode
- Check the network connection and signal quality
- Contact the device vendor's technical support
Can several slaves be updated at the same time?
Yes, but the following is recommended:
- Serial updates are safer and more reliable
- Parallel updates need attention to network bandwidth
- Update critical devices on their own
Is there a file size limit for FoE?
The protocol splits the file into mailbox-sized blocks, but this SDK has a 64KB read buffer and does not support resuming an interrupted transfer (no resume). Content larger than the read buffer cannot be read in one call and then continued; the write side is still limited by the slave's storage, the timeout and the mailbox size.
Development guidance
Implement an FoE server (slave side)
If you are developing an EtherCAT slave:
-
Implement the basic operations
- Support read and write requests
- Handle packet numbers correctly
- Implement the error responses
-
File system abstraction
- Define the virtual file names
- Map them to flash partitions or configuration areas
- Implement the file read and write functions
-
Firmware update protection
- Verify the firmware signature and CRC
- Protect the update with the bootloader
- Implement a rollback mechanism
-
Test and verify
- Test the error scenarios
- Verify partial transfers and retries
- Stress-test large file transfers
Use an FoE client (master side)
If you are developing a master application:
-
Provide progress feedback
- Show a transfer progress bar
- Estimate the remaining time
- Offer a cancel function
-
Error handling
- Implement automatic retry
- Give clear error messages
- Log every operation
-
Batch operations
- Support batch updates across several devices
- Control concurrency and queue the work
- Summarise and report the results