Skip to main content

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.

Protocol characteristics

FoE is a simple, efficient file transfer protocol optimised for embedded devices; it is more lightweight than FTP.

Core functions​

FunctionDescriptionUse case
File uploadMaster → slaveFirmware update, sending configuration files
File downloadSlave → masterLog reading, configuration backup
Segmented transferSplit into blocks by mailbox size64KB read buffer, no resume
Error recoveryA failed transfer can be retried in fullResume not supported
Progress monitoringLive transfer progressUser feedback

How FoE works​

Transfer sequence​

FoE uses a simple request-response pattern:

    1. Start — master → slave: sends the file name and the operation type, requesting a read or a write
    1. Acknowledge — slave → master: ACK or an error code; the slave is ready
    1. Data transfer — both directions: data packets plus packet numbers, transferring the data in segments
    1. Acknowledge — the reverse direction: ACK plus packet number, acknowledging each data packet
    1. 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:

  1. Enter Boot mode (optional)
  2. Upload the firmware file over FoE
  3. The slave verifies the firmware
  4. 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​

CharacteristicFoEFTPTFTPHTTP
ComplexityLowHighVery lowMedium
Transfer reliabilityHighHighMediumHigh
Protocol overheadSmallLargeVery smallMedium
Embedded supportExcellentFairExcellentGood
EtherCAT integrationBuilt-inRequires EoERequires EoERequires EoE
SecurityBasicCan be encryptedNoneCan be encrypted
Typical useDevice firmwareGeneral filesSimple filesWeb 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​

  1. Preparation

    • Check that the slave supports FoE
    • Verify the integrity of the firmware file
    • Back up the current configuration
  2. Transfer

    • Switch the slave to Init or Boot state
    • Upload the firmware file over FoE
    • Monitor the transfer progress
  3. Verification

    • The slave verifies the firmware CRC
    • Check the firmware version and compatibility
    • Confirm that the write succeeded
  4. 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​

  1. Increase the mailbox size - configure a larger mailbox in the ESI
  2. Use a shorter cycle - reduce the cycle time where possible
  3. Reduce concurrent traffic - pause non-essential communication during the update
  4. 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:

  1. Most devices are protected by a bootloader
  2. You can retry the update
  3. Some devices support dual-bank rollback
  4. 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?​

  1. Check that the firmware file is correct
  2. Confirm that the device supports this firmware version
  3. Try switching the device to Boot mode
  4. Check the network connection and signal quality
  5. 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:

  1. Implement the basic operations

    • Support read and write requests
    • Handle packet numbers correctly
    • Implement the error responses
  2. File system abstraction

    • Define the virtual file names
    • Map them to flash partitions or configuration areas
    • Implement the file read and write functions
  3. Firmware update protection

    • Verify the firmware signature and CRC
    • Protect the update with the bootloader
    • Implement a rollback mechanism
  4. 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:

  1. Provide progress feedback

    • Show a transfer progress bar
    • Estimate the remaining time
    • Offer a cancel function
  2. Error handling

    • Implement automatic retry
    • Give clear error messages
    • Log every operation
  3. Batch operations

    • Support batch updates across several devices
    • Control concurrency and queue the work
    • Summarise and report the results