Docs

ECAN-Lite Docs

Read product documentation, quick starts, and protocol references online.

Overview

ETHERCAT TO CAN / CAN FD GATEWAY
ECAN-Lite Product Overview V2.2
allows CAN devices to be naturally connected to the EtherCAT system
ECAN-Lite is an EtherCAT to CAN/CAN FD gateway for industrial sites. The upper part of it is a standard EtherCAT slave station, and the lower part is connected to multiple CAN buses. Make it easier for servos, sensors, actuators and test equipment to enter a unified real-time control network.
standard EtherCAT slave 4 channel CAN / CAN FD dynamic PDO CoE configuration FoE upgrade IgH demo sample package document version V2.2

What problem is solved?

Many field devices still use CAN or CAN FD, but master control systems are converging towards EtherCAT. The value of ECAN-Lite is to connect the two sides:

EtherCAT master
PLC / Linux master
cycle PDO control
ECAN-Lite
PDO packaging conversion
SDO configuration maintenance
CAN device
Servo / I/O / Sensor
CANopen or private protocol
The master station only needs to exchange PDO data according to EtherCAT. ECAN-Lite is responsible for converting these data into CAN frames and sending the data received by the CAN bus back to EtherCAT.

How data flows

sends
direction
master station writes PDO
periodic task write RxPDO
gateway analysis
Identify channel, frame ID and data
CAN Send
output to CAN bus
by channel
device responds with
Servo, I/O, sensor execution action
receives
direction
CAN Receive frame
Multi-channel collection of field data
unified packaging
is organized into TxPDO data area
master station reads
periodic task obtains the latest data
diagnostic analysis
Troubleshooting by combining status, version and error count

Core Competencies

multi-channel CAN extension

One device connects to multiple CAN/CAN FDs, the bus grouping is clearer, and the control cabinet wiring is simpler.

dynamic PDO carries
The capacity of

PDO can be adjusted according to the project scale, small systems can be run lightly, and multi-device scenarios can also be carried in batches.

periodic data transmission and reception

CAN frames can be organized following the EtherCAT cycle, suitable for control, acquisition and automated testing.

On-site maintenance friendly

supports SDO parameter configuration, version reading and FoE firmware upgrade, reducing disassembly and separate burning.

master station example complete

provides IgH demo, covering scanning, PDO transceiver, cycle test, FoE OTA and CiA402 control reference.

Problem locating is faster

retains status words, error statistics, version reading and diagnostic paths, so on-site debugging does not require starting from scratch.

Quick specs

EtherCAT access

2 port 100Mbps EtherCAT, the slave side supports CoE parameter configuration and FoE firmware upgrade.

4 MCAN bus
Each channel of

supports CAN 2.0A/B and CAN FD ISO. The maximum CAN FD single frame data field is 64 bytes.

Large capacity PDO

PDO is expanded in 128B steps. Start classic CAN from 384B, start CAN FD capacity validation from 1024B, and configure up to 3072B per direction.

real-time sending enhancement

supports direct transmission and timestamp/scheduled transmission, and the RxPDO full64 format can be used for SYNC0 phase reservation.

high speed CAN FD supports

TDC is turned on by default, and is forced on for data segments of 5Mbit/s and above, which is suitable for high-speed CAN FD sites.

configuration can be persisted
The key parameters of

are saved to the Flash configuration image and passed CRC32 verification to reduce repeated configuration after power failure.

Category Summary
Main control platform HPMicro HPM5E00 series RISC-V MCU, CPU 400MHz, mchtmr 24MHz
EtherCAT 2-port 100Mbps, supports CoE/FoE
CAN / CAN FD 4-channel MCAN, supports CAN 2.0A/B and CAN FD ISO, maximum 64B data field
PDO capability 384B/1024B common bring-up sizes, maximum 3072B/direction, 128B granularity configuration
PDO encapsulation Fixed header 24B, CAN frame encapsulation contains control word, CAN ID, optional timestamp and data
Real-time features Support direct transmission, delta16/delta32/full64 timestamp encapsulation and SYNC0 phase reservation
Maintenance capability SDO parameter configuration, Flash parameter persistence, FoE firmware upgrade

Robot internal communication and debugging

There are often joint drives, end tools, torque sensors, grippers, IO modules and safety components inside the robot system. They may be distributed on different CAN buses, or they may use CANopen or vendor-proprietary protocols. ECAN-Lite can serve as a real-time conversion layer between the robot controller and the in-body CAN network, integrating scattered CAN data into the EtherCAT master station.

robot controller
EtherCAT periodic task
motion control and status acquisition
ECAN-Lite
multi-channel CAN aggregation
periodic packaging and forwarding
In vivo CAN network
joint / gripper / sensor
end tool and expansion module
internal bus centralized access

multi-channel CAN / CAN FD can be grouped by robot joints, end effectors, sensors or test interfaces, and the master side can still be accessed as a unified EtherCAT slave.

control and diagnosis on the same link

The same EtherCAT link can not only deliver control frames, but also recycle status frames, error frames and debugging data, reducing additional debugging cables.

is suitable for prototype debugging

can quickly observe CAN frames, node status, version information and error counts during the development stage, making it easy to locate joint, wiring harness and protocol problems.

Convenient for mass production and maintenance

production lines and sites can complete scanning, configuration, transceiver verification and FoE OTA through master station scripts, improving the efficiency of batch testing and firmware upgrades.

Typical example: The robot dog master runs Linux and IgH EtherCAT master. The master is connected to ECAN-Lite through EtherCAT periodic tasks, and then ECAN-Lite is converted to multi-channel CAN/CAN FD. Joint motors, foot sensors or power management modules are hung under the bus. In this way, the main control software is still developed according to the EtherCAT cycle control model, while retaining the mature ecology of CAN motors and CAN sensors.
robot dog
example
Linux master
runs IgH master station
control tasks unified scheduling
EtherCAT
cycle PDO
low latency backbone network
ECAN-Lite
EtherCAT to CAN
multi-channel packet forwarding
CAN motor
joint driver
sensor and expansion module

Which applications are suitable?

Application scenarios Changes brought by ECAN-Lite
CANopen servo access to EtherCAT Use EtherCAT periodic tasks to centrally control multiple CANopen nodes
Robot body internal communication Import CAN data of joints, end tools, sensors and expansion modules into the robot controller
Robot dog/mobile robot control Linux master runs IgH master station, converting EtherCAT to CAN to control joint CAN motors
Robot prototype debugging Observe CAN frames, node status, error count and version information through the unified master link
Multi-channel CAN data collection Import scattered CAN bus data into a unified master station
Equipment production line testing Use scripts to complete configuration, transceiver, verification and upgrade in batches
Upgrading of old CAN equipment Retaining original equipment protocols and reducing system migration costs
Control cabinet interface expansion Reduce the number of host CAN interfaces to make the system structure clearer

Why is it easier to integrate?

Master side simple

configures PDO, SDO and FoE according to the EtherCAT slave station, without redesigning a dedicated communication framework.

Device side flexible
The

CAN bus can connect CANopen devices and can also carry customers' existing private CAN protocols.

clear data path

master station writes RxPDO to send CAN, and the master station reads TxPDO to receive CAN. The direction is clear and troubleshooting is convenient.

can move from testing to mass production

The same mechanism can be used for experimental verification, production line testing and on-site deployment to reduce repeated development.

Delivery Features

IgH main site demo

provides Linux/IgH examples that can be directly compiled and run to help customers quickly verify single-axis, multi-axis and periodic transceivers.

Appointment Send Test
The

example includes a comparison between direct transmission and scheduled transmission to facilitate the evaluation of the real-time performance of EtherCAT to CAN.

FoE OTA Example
The

master station can update the firmware through FoE, which is suitable for on-site maintenance, version regression and batch upgrades.

configuration documentation is clear
The

technical manual provides PDO packaging format, SDO configuration process, object dictionary and troubleshooting of common problems.

Typical workflow

1
scan slave
confirms that ECAN-Lite is online and reads the version.
2
configuration capability
sets PDO size, CAN bit rate and channel mode.
3
write RxPDO
master station puts the CAN frame to be sent into periodic data.
4
read TxPDO
master station obtains the data returned from the CAN bus.
5
Maintenance and upgrade
updates the firmware via FoE OTA and confirms the version.

Manual

ECAN-Lite Technical Manual V2.2
EtherCAT to 4-channel CAN/CAN FD dynamic PDO gateway
Item Content
Document Name ECAN-Lite Technical Manual V2.2
Document Version V2.2
Date 2026-05
Applies To ECAN-Lite, EtherCAT CoE slave, 4-channel HPM MCAN
Master Example IgH EtherCAT Master example package
Recommended PDO Start classic CAN from 384B and CAN FD capacity validation from 1024B; validate real-time cycle boundaries according to 15.6.1

Reading Guide

This manual is written for users who need to integrate ECAN-Lite, not only for readers who want to understand the firmware internals. After reading it, you should be able to identify the device capabilities, configure EtherCAT PDO/SDO, enter OP, send CAN/CAN FD frames through RxPDO, read CAN/CAN FD frames through TxPDO, and diagnose common problems.

The manual is organized as "integration first, implementation details second, diagnostics last". The first half explains the EtherCAT/PDO/SDO boundary. The second half explains IgH examples, secondary development, and field troubleshooting.

From bring-up to CAN frame exchange

# What the user wants to accomplish Manual entry Completion flag
1 Confirm device capability, version, PDO upper limit 2, 3, 13.8 Read 0xF000 version, capability bit and PDO maximum multiple
2 Select consecutive PDO chunks in the master 5.1, 5.2, 5.4 SM2/SM3 length is equal to 128 * N, assignment selects the first N chunks
3 Write PDO profile and MCAN channel SDO 5.4.3, 13.2, 13.4 0x8010/0x8011:02 = 0, 0x9000..0x9003 status is normal
4 Enter OP and periodically exchange process data 14, 15.5 EtherCAT working counter normal, domain complete
5 Write CAN_FRAME at RxPDO offset 24 5.4.4, 6, 8 See the frame sent by the master on the CAN bus
6 Parse CAN_FRAME/TX_RESULT from TxPDO offset 24 5.4.4, 6, 8, 10 The master receives CAN bus frames or TX_RESULT packets
7 Diagnose exceptions through status fields and SDO counters 7, 13.2.4, 13.2.5, 13.5, 16 The cause can be narrowed down to PDO parsing, CAN bus-off, disabled channel, or OP state

Read by task

Task Read First Goal
Quickly understand device capabilities 1, 2, 3, 4 Understand the data direction, PDO size and channel model of ECAN-Lite
Configure TwinCAT / CODESYS / Acontis / custom master 5.1, 5.2, 5.4, 5.4.3 Select PDO chunks, write startup SDOs, apply the PDO profile and MCAN configuration
Implement PDO packing/parsing in a master 5.1.1, 6, 8, 9, 10, 11 Assemble the continuous PDO buffer, generate CAN_FRAME, parse TxPDO and TX_RESULT
Query and configure SDO objects 13.1..13.8 Check 0x8010/0x8011, 0x8001..0x8004, 0x8021..0x8024, 0x9000, 0x9011, 0x9020..0x9023, 0xF000
Use IgH demo to do bring-up 15.2, 15.3, 15.6 Build and run the demo to complete single-axis/multi-axis or CAN transceiver verification
Do not run demo, but reuse IgH API 15.1, 15.4, 15.5 Select Adapter, MCAN Port or CiA402 layer, and connect to customer application
On-site troubleshooting 16, 13.2.4, 13.2.5, 13.5, 13.8 Locating OP exceptions, PDO parsing errors, CAN bus errors, data-path congestion, and version capability issues

Chapter division of labor

Chapter Covers Does Not Cover
1..4 Product positioning, basic concepts, system architecture Object dictionary details
5 EtherCAT PDO mapping, PDO size, third-party master configuration Detailed frame field definitions
6..12 PDO byte stream format, frame packets, CRC, TX_RESULT, budget strategy A specific master software UI
13 CoE SDO object dictionary, capability object, maintenance commands IgH API call details
14 General startup process and configuration recommendations Vendor-specific master UI steps
15 IgH example package, API layers, FoE OTA and demo usage Replacement for the third-party master setup in 5.4
16..19 Debugging, diagnostics, verification data, specifications and revision history Protocol definition entry point

When not using IgH at all, read 5.4 and 5.4.3 first. When using the IgH master-side library but not directly running the demo package, read 15.4 and 15.5 first.


1. Product positioning

ECAN-Lite is an EtherCAT to CAN/CAN FD real-time gateway module. The device operates as an EtherCAT slave. The master sends CAN/CAN FD transmit requests through RxPDO, and the device uploads received CAN/CAN FD frames, transmit results, and compact channel status through TxPDO.

This version adopts a new dynamic PDO protocol: TxPDO and RxPDO are independently configured in units of 128B * N, N=1..24, with a maximum of 3072B in one direction. PDO content no longer uses the old layout of fixed channels and fixed slots, but uses a unified "two-layer structure":

text
FixedPdoFrameHeader[24B] + FramePacketStream[ActivePDOBytes - 24]

The 24B fixed header carries the version/header length, double sequence commit, frame area length, payload CRC16, layout identifier, channel mask, frame count, overflow count, and 4-channel compact status. The following frame area is a continuous stream of CAN/CAN FD frame packets. Each packet uses a 2B control word to describe its CAN ID, timestamp, and data length, so the master does not need the old fixed-slot layout.


2. Core features

Item Description
EtherCAT 2-port slave, 100Mbps, CoE, FoE
CAN channel 4 independent MCAN, 3 bits are reserved for the control word CH field, which can express 0..7
CAN Protocol CAN 2.0A / CAN 2.0B / CAN FD ISO
CAN data length Classic CAN 0..8B, CAN FD 0..64B, dynamic encoding by DLC
PDO size TxPDO/RxPDO independent configuration, 128B * N, N=1..24; start classic CAN from N=3 or 384B, start CAN FD capacity validation from N=8 or 1024B, and select the real-time boundary from physical host validation
PDO upper limit 3072B/direction, frame encapsulation area 3048B
PDO structure 24B fixed header + continuous frame encapsulation area, 128B chunk only as EtherCAT mapping unit
Multi-channel multiplexing Multiple CAN channels share the same direction frame area and share the remaining space according to the budget strategy
Timestamp Optional per frame, supports off/delta16, delta32/full64 as capability extension
Reservation to send RxPDO TSF_FULL64 format=1 can reserve the CAN frame to the specified phase in the next SYNC0 cycle
TDC CAN FD is enabled by default; data segments of 5M and above are forced to be enabled; Offset/Filter defaults to 0 for automatic calculation, and non-0 supports manual override
Diagnosis PDO quick status + SDO detailed status; PDO parsing errors and overflows have count records
Configuration SDO online configuration, supports parameter persistence, device maintenance, FoE

3. Direction definition

Name EtherCAT direction Master perspective Device semantics
TxPDO / Input PDO Slave -> Master Master reads input process data Upload CAN/CAN FD receive frame, TX_RESULT, compressed channel status
RxPDO / Output PDO Master -> Slave Master writes output process data Issues CAN/CAN FD send request

TxPDO and RxPDO are completely independent directions. PDO size multiples, channel masks, packaging profiles, budget strategies and direction options can be independently selected for each direction. Channel opening and PDO size are two orthogonal dimensions: closing a CAN channel will not change the SM2/SM3 length, but will only change the active channel mask and scheduling budget.

It is useful to read the protocol in three layers:

Layer What the master does Manual Entry
EtherCAT mapping layer Select the first N 128B PDO chunks to obtain continuous RxPDO/TxPDO buffers Chapter 5
PDO frame-stream layer Read/write the 24B fixed header at offset 0 and CAN_FRAME packets from offset 24 Chapters 6..12
Configuration and diagnostics layer Configure PDO profiles, MCAN channels, capabilities and status objects through SDO Chapters 13..16

For a first bring-up, follow 5.4.3 and 5.4.4.1 to send one frame. When implementing your own parser or writer, return to Chapters 6..12 for the field-by-field definition.

3.1 Document markup description

The following tables in this article use the following notation:

Mark Meaning
RO Read Only, read only. The master can only read via SDO, writes are invalid or rejected.
RW Read Write, read and write. The master can write configuration via SDO and can also read echo or current values.
WO Write Only, write only command. The master writes to trigger the action, and the read value is not used as a basis for status.
M2S Master to Slave, master to slave. Commonly seen in RxPDO/SM2 Output or configuration SDO writes.
S2M Slave to Master, slave to master. Commonly seen in TxPDO/SM3 Input or Status/Capability SDO reads.
CFG Configuration or command path, usually done through CoE SDO, is not part of the periodic PDO data flow.

Access in the PDO table refers to the master's access method for process data: RxPDO/SM2 is written by the master and read by the slave; TxPDO/SM3 is written by the slave and read by the master.


4. System architecture

text
EtherCAT Master
  |
  |  SM2 RxPDO: Fixed Header + FramePacketStream
  |  SM3 TxPDO: Fixed Header + FramePacketStream
  v
+------------------------------+
| ECAN-Lite EtherCAT Slave     |
|  SSC + CoE + FoE             |
|  Dynamic PDO Parser/Packer   |
|  Byte Budget Scheduler       |
+-----+-----+-----+-----+------+
      |     |     |     |
     CAN0  CAN1  CAN2  CAN3

5. EtherCAT PDO mapping and size

5.1 128B Chunk Mapping

PDO mapping is assembled from 128B chunks. Each chunk is split into 8 STRING(16) mapping units in the object dictionary to avoid the bit-length limit of a PDO mapping entry.

text
RxPDO chunk maps: 0x1600..0x1617
TxPDO chunk maps: 0x1A00..0x1A17
SM2 assignment: 0x1C12 selects the first N RxPDO chunks
SM3 assignment: 0x1C13 selects the first N TxPDO chunks

Chunk is the EtherCAT mapping and length selection unit, not the protocol parsing layer. FramePacketStream can span 128B chunk boundaries, and the receiving end only parses the valid frame area according to payload_len in the fixed header.

5.1.1 How the master assembles multiple chunks

On the master side, do not treat 0x1600..0x1617 / 0x1A00..0x1A17 as multiple independent protocols. They are only 128B mapping blocks used to satisfy EtherCAT PDO mapping limits. The application should combine the first N chunks in the same direction into one continuous byte buffer in assignment order:

text
RxPDO/SM2 output buffer:
  chunk0[128B] + chunk1[128B] + ... + chunkN-1[128B]
  "..." means the omitted chunks continue in the same order, 128B each

TxPDO/SM3 input buffer:
  chunk0[128B] + chunk1[128B] + ... + chunkN-1[128B]
  "..." means the omitted chunks continue in the same order, 128B each

Each 128B chunk contains 8 STRING(16) mapping units. If the master exposes them as separate variables, copy them in the following order:

text
for chunk = 0 .. N-1:
  for unit = 0 .. 7:
    dst_offset = chunk * 128 + unit * 16
    copy 16 bytes to/from process image entry

The following table expands the 8 mapping units of chunk=0 and shows the first unit of chunk=1. All later chunks follow the formula below.

Direction Data flow Master access Chunk Unit PDO map Data object Buffer offset
RxPDO / SM2 Output M2S Write 0 0 0x1600 0x7000 0
RxPDO / SM2 Output M2S Write 0 1 0x1600 0x7010 16
RxPDO / SM2 Output M2S Write 0 2 0x1600 0x7020 32
RxPDO / SM2 Output M2S Write 0 3 0x1600 0x7030 48
RxPDO / SM2 Output M2S Write 0 4 0x1600 0x7040 64
RxPDO / SM2 Output M2S Write 0 5 0x1600 0x7050 80
RxPDO / SM2 Output M2S Write 0 6 0x1600 0x7060 96
RxPDO / SM2 Output M2S Write 0 7 0x1600 0x7070 112
RxPDO / SM2 Output M2S Write 1 0 0x1601 0x7080 128
TxPDO / SM3 Input S2M Read 0 0 0x1A00 0x6000 0
TxPDO / SM3 Input S2M Read 0 1 0x1A00 0x6010 16
TxPDO / SM3 Input S2M Read 0 2 0x1A00 0x6020 32
TxPDO / SM3 Input S2M Read 0 3 0x1A00 0x6030 48
TxPDO / SM3 Input S2M Read 0 4 0x1A00 0x6040 64
TxPDO / SM3 Input S2M Read 0 5 0x1A00 0x6050 80
TxPDO / SM3 Input S2M Read 0 6 0x1A00 0x6060 96
TxPDO / SM3 Input S2M Read 0 7 0x1A00 0x6070 112
TxPDO / SM3 Input S2M Read 1 0 0x1A01 0x6080 128

Complete mapping rules:

Direction Data flow Master access Chunk c Unit u PDO map PDO map subindex Data object Buffer offset
RxPDO / SM2 Output M2S Write 0..N-1 0..7 0x1600 + c u + 1 0x7000 + c * 0x80 + u * 0x10 c * 128 + u * 16
TxPDO / SM3 Input S2M Read 0..N-1 0..7 0x1A00 + c u + 1 0x6000 + c * 0x80 + u * 0x10 c * 128 + u * 16

General formula:

text
unit_index = chunk * 8 + unit
offset     = unit_index * 16

RxPDO data object index = 0x7000 + unit_index * 0x10
TxPDO data object index = 0x6000 + unit_index * 0x10

So chunk=1 is not only unit=0. For example, RxPDO 0x1601 contains eight 16B units: 0x7080, 0x7090, ..., 0x70F0. TxPDO 0x1A01 contains 0x6080, 0x6090, ..., 0x60F0. In both examples, ... only omits the middle objects that increase by 0x10.

For example, when N=3, the continuous buffer in each direction is 384B:

text
chunk0: offset   0..127
chunk1: offset 128..255
chunk2: offset 256..383

The fixed 24B header is located at offset 0 of the continuous buffer. The frame area starts at offset 24 and ends at 128*N-1. CAN_FRAME / TX_RESULT packets may cross 128B chunk boundaries. When parsing, the master must use payload_len and CRC in the fixed header to determine the valid area; it must not restart parsing at a 128B boundary.

In TwinCAT, CODESYS, or a custom master, if the tool can map PDO data to a continuous byte array, create ARRAY[0..128*N-1] OF BYTE. If the tool exposes each STRING(16) as a separate variable, assemble and split the data in the application layer using the offset formula above.

5.2 PDO size multiple

text
ActivePDOBytes = 128 * PdoSizeMultiplier
ActiveFrameAreaBytes = ActivePDOBytes - 24
PdoSizeMultiplier: 1..24
N Number of PDO bytes Frame encapsulation area Recommended use
1 128 104 Minimum PDO, single-channel low-speed diagnostics, few classic CAN
2 256 232 Lightweight classic CAN diagnostics
3 384 360 Recommended classic CAN bring-up profile, CiA402 demo default
4 512 488 Multi-channel classic CAN or lightweight CAN FD
6 768 744 Medium-load classic CAN, transition profile for lightweight CAN FD
8 1024 1000 Recommended starting point for CAN FD
12 1536 1512 High load CAN FD
16 2048 2024 High-margin scenarios
24 3072 3048 Maximum burst margin

Choose the recommended value by CAN mode and load instead of using one value for every case. Classic CAN carries at most 8B per frame, so normal motor control, CANopen/CiA402, and small classic CAN traffic should start from N=3. CAN FD carries up to 64B per frame, so four-channel use or burst traffic should start from N=8. N=1/N=2 are intended for minimum-PDO capability checks, single-channel low-speed diagnostics, or very small classic CAN traffic. The maximum value is N=24, which is 3072B/direction.

5.3 SII/EEPROM SyncManager Requirements

Current product EEPROM/SII should maintain a large PDO single buffer layout:

SM Direction Data Flow Master Access Start Address Default Size ControlByte
SM2 Outputs / RxPDO M2S Write 0x1100 3072 0x66
SM3 Inputs / TxPDO S2M Read 0x1D00 3072 0x22

The actual PDO length used by the master is determined by the first N chunks selected by the 0x1C12/0x1C13 assignment, and must be consistent with the active profile of 0x8010/0x8011.

5.4 Without IgH: Third-party EtherCAT master configuration PDO

If the customer does not use the IgH sample package demo, but uses TwinCAT, CODESYS, Acontis, or a self-developed EtherCAT master, it is necessary to explicitly complete the PDO assignment, PDO profile apply, and MCAN channel configuration in the master project. The automatic configuration in the IgH sample package demo essentially corresponds to the following general CoE configuration process.

5.4.1 Select PDO size

The PDO length of ECAN-Lite is determined by the 128B chunk number N:

text
ActivePDOBytes = 128 * N
N = 1..24

The master must select the first N chunks for both directions:

Direction Data Flow Master Access SyncManager Assignment PDO map Scope Description
RxPDO / Output M2S Write SM2 0x1C12 0x1600..0x1617 The master issues CAN/CAN FD send request
TxPDO / Input S2M Read SM3 0x1C13 0x1A00..0x1A17 Slave upload CAN/CAN FD receive frame, send result and channel status

Example: Select N=3, that is, SM2/SM3 are both 384B:

text
0x1C12:00 = 0
0x1C12:01 = 0x1600
0x1C12:02 = 0x1601
0x1C12:03 = 0x1602
0x1C12:00 = 3

0x1C13:00 = 0
0x1C13:01 = 0x1A00
0x1C13:02 = 0x1A01
0x1C13:03 = 0x1A02
0x1C13:00 = 3

Example: Select N=8, that is, SM2/SM3 are both 1024B:

text
0x1C12:00 = 0
0x1C12:01..08 = 0x1600..0x1607
0x1C12:00 = 8

0x1C13:00 = 0
0x1C13:01..08 = 0x1A00..0x1A07
0x1C13:00 = 8

01..08 and 0x1600..0x1607 / 0x1A00..0x1A07 here represent continuous ranges, not jump selections; they are equivalent to writing the 8 assignment sub-items from :01 to :08 one by one.

The SM2/SM3 process data length in the master project should be equal to 128 * N. If the master needs to manually select PDO after importing ESI, please ensure that you select the first N consecutive chunks and do not skip or rearrange chunks.

5.4.2 Application firmware PDO profile

0x1C12/0x1C13 determines the actual mapping length of the master; 0x8010/0x8011 determines the active profile within the firmware. Both sides must be consistent, otherwise the firmware will reject the application or continue to maintain the old profile.

Object Control Direction Data Flow Access Key Children
0x8010 TxPDO / Input / Slave upload direction S2M RW/RO :03 PDO size multiplier, :04 Channel mask, :01 Apply command
0x8011 RxPDO / Output / Direction issued by the master M2S RW/RO :03 PDO size multiplier, :04 Channel mask, :01 Apply command

Recommended startup SDO sequence:

text
1. The slave remains in INIT/PREOP/SAFEOP, do not modify the PDO size in OP
2. Configure 0x1C12/0x1C13 and select the first N chunks
3. Write 0x8010:03 = N
4. Write 0x8011:03 = N
5. Write 0x8010:04 = tx_channel_mask
6. Write 0x8011:04 = rx_channel_mask
7. Write 0x8010:01 = 1, apply TxPDO profile
8. Write 0x8011:01 = 1, apply RxPDO profile
9. Read the active readback of 0x8010/0x8011 and confirm the length and layout
10. Configure 0x8001..0x8004 MCAN channel parameters and apply
11. Enter OP and send and receive CAN/CAN FD frames through PDO during operation.

At minimum, read back and check:

Subitem Expected value
0x8010/0x8011:02 Status 0=OK
0x8010/0x8011:09 Active PDO bytes 128 * N
0x8010/0x8011:10 Active frame area bytes 128 * N - 24
0x8010/0x8011:11 Active layout CRC The layout CRC of the master analysis library or project record is consistent
0x8010/0x8011:12 Active profile word Consistent with the expected N, channel mask, profile combination

5.4.3 Complete initialization process example: without using IgH / third-party master

This section gives a set of configuration processes that can be directly transplanted to TwinCAT Startup SDO, CODESYS startup parameters, Acontis or self-developed master. Example goals are:

Item Example Value Effect
PDO size Start classic CAN from N=3; start CAN FD from N=8 N=3 is 384B per direction, N=8 is 1024B per direction
Enable CAN channel 0x0F CAN0..CAN3 all participate in PDO sending and receiving
PDO profile 0 compact inline, variable DLC, no timestamp
Budget strategy 0 Balanced, default general strategy
Direction Options 0x00 Do not enable TX_RESULT, 4-byte alignment, STREAM_CRC32
CAN mode CAN FD ISO Arbitration segment 1Mbps, data segment 5Mbps, BRS controlled by CAN_FRAME

For conservative bring-up, it is recommended to change N to 3, change the channel mask to 0x01, and only enable CAN0. Use N=1 when explicitly verifying the minimum PDO capability.

Option flags is the bitwise configuration value of 0x8010:07 (0x07) and 0x8011:07 (0x07). Commonly used values are as follows, see Section 9.1 for the complete bit table:

Write value Meaning Common uses
0x00 All direction options are off Default bring-up, minimal overhead
0x01 TX_RESULT_ENABLE Only used for 0x8010:07 (0x07), TxPDO upload and send results
0x02 ALIGN_4_ENABLE Frame packets are aligned by 4 bytes
0x03 TX_RESULT + ALIGN4 Only commonly used in TxPDO direction; TX_RESULT is not used in RxPDO

Phase A: Read the device capabilities and determine the upper limit of the master configuration.

Steps SDO Access Example Judgment Function
A1 0xF000:02 (0x02) Channel count RO >= 4 Confirm the number of channels
A2 0xF000:10 (0x0A) PDO size multiplier min RO <= 8 Confirm minimum N support
A3 0xF000:11 (0x0B) PDO size multiplier max RO >= 8 Confirm Target N Support
A4 0xF000:12 (0x0C) Encapsulation profile mask RO bit0 = 1 Confirm profile 0 supported
A5 0xF000:15 (0x0F) PDO option flags mask RO Check if ALIGN4 is required bit1 Confirm the orientation options that can be turned on
A6 0xF000:17 (0x11) PDO size unit bytes RO 128 Confirm chunk unit
A7 0xF000:18 (0x12) PDO fixed header bytes RO 24 Confirm fixed header length

Phase B: Configuring the EtherCAT PDO assignment. The master writes in the PREOP/SAFEOP phase and selects the first N consecutive PDO chunks.

Steps SDO Write Value Effect
B1 0x1C12:00 (0x00) 0 Clear RxPDO / SM2 assignment
B2 0x1C12:01..08 (0x01..0x08) 0x1600..0x1607 Select the first 8 RxPDO chunks
B3 0x1C12:00 (0x00) 8 Effective RxPDO / SM2 assignment
B4 0x1C13:00 (0x00) 0 Clear TxPDO / SM3 assignment
B5 0x1C13:01..08 (0x01..0x08) 0x1A00..0x1A07 Select the first 8 TxPDO chunks
B6 0x1C13:00 (0x00) 8 Effective TxPDO / SM3 assignment

0x1C12:01..08 = 0x1600..0x1607 means writing 8 sub-items continuously, not a one-time writing range. If N=3, only write :01=0x1600, :02=0x1601, :03=0x1602, and finally :00=3; similarly for TxPDO, write 0x1A00..0x1A02.

Phase C: Configuring the firmware PDO profile. 0x8010 controls the TxPDO/SM3 upload direction, and 0x8011 controls the RxPDO/SM2 delivery direction. Both sides must be configured, and PDO size multiplier must be consistent with the number of assignments in phase B.

Steps SDO Write Value Effect
C1 0x8010:03 (0x03) 8 TxPDO active PDO size 8 * 128B
C2 0x8010:04 (0x04) 0x0F TxPDO uploads the received frame and status of CAN0..CAN3
C3 0x8010:05 (0x05) 0 TxPDO uses profile 0
C4 0x8010:06 (0x06) 0 TxPDO uses Balanced budget
C5 0x8010:07 (0x07) 0x00 TxPDO direction option off
C6 0x8010:01 (0x01) 1 apply TxPDO profile
C7 0x8011:03 (0x03) 8 RxPDO active PDO size 8 * 128B
C8 0x8011:04 (0x04) 0x0F RxPDO allows the master to send CAN frames to CAN0..CAN3
C9 0x8011:05 (0x05) 0 RxPDO using profile 0
C10 0x8011:06 (0x06) 0 RxPDO using Balanced budget
C11 0x8011:07 (0x07) 0x00 RxPDO direction option off
C12 0x8011:01 (0x01) 1 apply RxPDO profile

If 4-byte alignment is required, write 0x8010:07 (0x07) or 0x8011:07 (0x07) as 0x02 and then apply; if TxPDO is required to send the result packet, set 0x8010:07 (0x07) bit0 to 1.

Phase D: Read the active profile back and confirm that the firmware accepted the requested profile.

Step SDO Expected value Meaning
D1 0x8010:02 (0x02) 0 TxPDO profile apply successful
D2 0x8011:02 (0x02) 0 RxPDO profile apply successful
D3 0x8010:09 (0x09) 1024 TxPDO active PDO bytes correct
D4 0x8011:09 (0x09) 1024 RxPDO active PDO bytes correct
D5 0x8010:10 (0x0A) 1000 TxPDO frame area bytes correct
D6 0x8011:10 (0x0A) 1000 RxPDO frame area bytes correct
D7 0x8010:12 (0x0C) 0x000001E7 TxPDO active profile word correct
D8 0x8011:12 (0x0C) 0x000001E7 RxPDO active profile word correct

In the example, the active profile word is calculated as follows:

text
bits 0..4   = N - 1 = 7
bits 5..12  = channel_mask = 0x0F
bits 13..18 = profile = 0
bits 19..20 = budget = 0
bits 21..28 = option_flags = 0

ActiveProfileWord = 7 | (0x0F << 5) = 0x000001E7

Therefore, D7/D8 in the above table should be checked according to the actual calculated value: 0x000001E7 when N=8, mask=0x0F, profile=0, budget=0, options=0. If ALIGN4 is enabled, OptionFlags=0x02, the active profile word will additionally contain (0x02 << 21).

Phase E: Configure the MCAN channel. The following example configures CAN0 as CAN FD ISO, with a 1Mbps nominal bit rate, a 5Mbps data bit rate, and a 64B CAN FD Message RAM layout. The example assumes that the peer CAN/CAN FD device uses an 87.5% sample point for both the nominal and data phases, so the sample point range is constrained to 875..875. CAN1..CAN3 use 0x8002, 0x8003, and 0x8004 respectively with the same subindices. In this table, the subindex after the colon in SDO is written as decimal SI, and the hexadecimal SI is shown in parentheses. If your master tool displays subindices in hexadecimal, use the value in parentheses directly.

Steps SDO Write Value Effect
E1 0x8001:07 (0x07) 0 Automatic bit timing mode, solved from bit rate and peer sample point constraints
E2 0x8001:08 (0x08) 0 Normal mode; change only for loopback/listen debugging
E3 0x8001:09 (0x09) 0 ISO CAN FD; Non-ISO mode disabled
E4 0x8001:15 (0x0F) 1 Enable CAN FD on CAN0; write 0 for classic CAN
E5 0x8001:16 (0x10) 1 Enable TDC; recommended at 5Mbps
E6 0x8001:19 (0x13) 1000000 CAN0 nominal bit rate, 1Mbps
E7 0x8001:20 (0x14) 5000000 CAN0 data bit rate, 5Mbps
E8 0x8001:21 (0x15) 875 Nominal sample point lower bound; write 875 when the peer uses 87.5%
E9 0x8001:22 (0x16) 875 Nominal sample point upper bound, 87.5%
E10 0x8001:23 (0x17) 875 Data sample point lower bound; write 875 when the peer uses 87.5%
E11 0x8001:24 (0x18) 875 Data sample point upper bound, 87.5%
E12 0x8001:33 (0x21) 0 Automatic TDC offset
E13 0x8001:34 (0x22) 0 Automatic TDC filter
E14 0x8001:36 (0x24) 0 Route non-matching standard frames to RX FIFO0
E15 0x8001:37 (0x25) 0 Route non-matching extended frames to RX FIFO0
E16 0x8001:38 (0x26) 0 Do not reject standard remote frames; write 1 if RTR is not needed
E17 0x8001:39 (0x27) 0 Do not reject extended remote frames; write 1 if RTR is not needed
E18 0x8001:61 (0x3D) 0 RX FIFO0 blocking mode
E19 0x8001:62 (0x3E) 48 RX FIFO0 element count
E20 0x8001:63 (0x3F) 0 RX FIFO1 blocking mode
E21 0x8001:64 (0x40) 12 RX FIFO1 element count
E22 0x8001:65 (0x41) 7 RX FIFO0 element data area is 64B
E23 0x8001:66 (0x42) 7 RX FIFO1 element data area is 64B
E24 0x8001:67 (0x43) 12 RX buffer element count
E25 0x8001:68 (0x44) 7 RX buffer element data area is 64B
E26 0x8001:69 (0x45) 0 Use TX FIFO mode
E27 0x8001:70 (0x46) 32 TX FIFO element count
E28 0x8001:71 (0x47) 0 Do not use dedicated TX buffers
E29 0x8001:72 (0x48) 7 TX element data area is 64B
E30 0x8001:73 (0x49) 32 TX Event FIFO element count
E31 0x8001:01 (0x01) 1 Apply CAN0 configuration
E32 0x8001:02 (0x02) 0 Read back and confirm CAN0 apply OK

0x8001:21..24 do not define a fixed sample point for a given bit rate. They constrain the automatic timing solver so that this device uses sample points compatible with the peer CAN/CAN FD device. If the peer sample points are known, set both min and max to the peer target value. For example, if the peer uses 80.0% in the nominal phase and 87.5% in the data phase, write 0x8001:21=800, 0x8001:22=800, 0x8001:23=875, and 0x8001:24=875. If the peer sample points are unknown, start from the peer driver, tool, or device manual recommendation, then verify with CAN error counters and closed-loop frame exchange. Avoid keeping a very wide sample point range as the final production setting for CAN FD+BRS, because the solver may choose a valid timing that is not well matched to the peer.

If only CAN0 is enabled, configure only 0x8001 and set 0x8010/0x8011:04 to 0x01. For classic CAN, set 0x8001:15=0, keep or omit 0x8001:20/23/24/33/34, and set 0x8001:65/66/68/72 to 0 (8B) to save Message RAM.

Stage F: After entering OP, the master periodically writes RxPDO/SM2 and reads TxPDO/SM3. If the slave cannot enter OP, first check the SM2/SM3 length and the number of assignments in stage B; if it enters OP but CAN does not send, check the channel mask and channel apply status of stage C/E first.

5.4.4 PDO packaging and process data writing

The master ultimately operates on the continuous PDO buffer in the EtherCAT process data. Take N=8 as an example:

Direction EtherCAT SM ESC physical start address Master process data offset Master action PDO buffer length Frame area
RxPDO / Output SM2 0x1100 0 Master write 1024B offset 24..1023
TxPDO / Input SM3 0x1D00 0 Master read 1024B offset 24..1023

Generally, the master program operates the RxPDO/TxPDO start pointer in the master process image instead of directly writing the ESC physical address. If the debugging tool directly exposes the ESC DPRAM address, the fixed header of RxPDO is located at 0x1100 + 0, and the first frame of RxPDO is located at 0x1100 + 24; the fixed header of TxPDO is located at 0x1D00 + 0, and the first frame of TxPDO is located at 0x1D00 + 24.

If using TwinCAT/CODESYS, the tool may split the process data into multiple STRING(16) variables; the application needs to first assemble it into a continuous buffer according to Section 5.1.1, and then write or parse according to the offset below. If the master provides a continuous PDO pointer, operate the pointer directly.

The continuous PDO buffer has the layout below. The 24B fixed header describes the frame area state for the current cycle; the actual CAN_FRAME / TX_RESULT packets are stored continuously from offset 24.

Area Offset Length Purpose
Fixed PDO header 0 24B Version, sequence commit, payload length, CRC, layout ID and channel status
Frame area 24 128 * N - 24 Continuous CAN_FRAME, TX_RESULT or extension packets
5.4.4.1 Build an RxPDO transmit frame from scratch

The following example shows how the master requests ECAN-Lite CAN0 to transmit one standard classic CAN data frame through RxPDO/SM2. The reading order follows the actual write order: write the frame area first, calculate the payload information, then fill the 24B fixed header and commit the PDO image.

This example assumes N=8, RxPDO active channel mask 0x0F, and TX_RESULT, ALIGN4, and scheduled timestamp options disabled.

Step 1: Write the CAN_FRAME at offset 24.

Field Example Byte position Description
Ctrl 0x0040 rxpdo[24..25] CH=0, DLC=8, IDE=0, FDF=0, BRS=0, TSF=0, KIND=0
StdIdField 0x0123 rxpdo[26..27] 11-bit standard ID; reserved bits and ID_AUX are 0 when unused
Data 11 22 33 44 55 66 77 88 rxpdo[28..35] classic CAN with DLC=8 carries 8 bytes

Control word bit combination:

text
ctrl = channel
     | (dlc << 3)
     | (ide << 7)
     | (fdf << 8)
     | (brs << 9)
     | (x << 10)
     | (tsf << 11)
     | (kind << 13)

In this example:

text
channel = 0
dlc     = 8
ide     = 0
fdf     = 0
brs     = 0
x       = 0
tsf     = 0
kind    = 0

ctrl = 0x0040
StdIdField = 0x0123
raw_packet_bytes = 2 + 2 + 8 = 12

The bytes starting at offset 24 are:

text
40 00 23 01  11 22 33 44 55 66 77 88

Step 2: Calculate payload information for this cycle.

Field Example Description
payload_len 12 2B Ctrl + 2B StdIdField + 8B data
frame_count 1 Only one CAN_FRAME in this cycle
payload_crc16 crc16_ccitt_false(rxpdo[24..35]) CRC range covers only the frame area, not the 24B fixed header
Unused frame area Filled with 0 Clear from offset 24 + payload_len to the end of the PDO

CRC-16/CCITT-FALSE parameters are poly=0x1021, init=0xFFFF, xorout=0x0000, with non-reflected input and output.

Step 3: Fill the 24B fixed header. For master-to-slave RxPDO delivery, write the fields below; seq_end must be written last.

Offset Field Recommended value Description
0 ver_ihl 0x16 version=1, ihl=6, fixed header is 24B
1 header_flags 0x00 Normal delivery without truncation, error, or TX_RESULT
2 seq_begin seq Increment once for each published PDO image
4 seq_end seq Must be written last as the commit action
6 payload_len 12 Valid frame-area byte count
8 payload_crc16 Calculated value CRC-16/CCITT-FALSE
10 layout_id Folded active profile value Keeps the header consistent with active PDO configuration
12 channel_mask 0x0F Should match active 0x8011:04 (0x04) channel mask
13 frame_count 1 Number of CAN_FRAME/TX_RESULT packets in this cycle
14 overflow_sat 0 Normal master delivery has no overflow
15 crc_alg 1 Current runtime uses CRC-16/CCITT-FALSE
16..23 channel_status[4] All 0 The slave does not depend on this field in RxPDO; TxPDO is filled by the slave

Recommended layout_id calculation:

text
layout_word = ((N - 1) & 0x1F)
            | ((channel_mask & 0xFF) << 5)
            | ((profile & 0x3F) << 13)
            | ((budget & 0x03) << 19)
            | ((option_flags & 0xFF) << 21)

layout_id = (layout_word ^ (layout_word >> 16)) & 0xFFFF

Step 4: Write in commit order to prevent the slave from parsing a half-updated PDO image.

text
1. Clear the RxPDO buffer, or at least clear the unused frame area.
2. Write all CAN_FRAME packets starting at offset 24.
3. Calculate payload_len, frame_count and payload_crc16.
4. Write fixed header offsets 0..3 and 6..23.
5. Write offset 4..5 seq_end last, with seq_end == seq_begin.

For multiple frames, repeat only the CAN_FRAME packet layout from Step 1: the first packet starts at offset 24, the second packet follows the first packet's packet_bytes, and so on. payload_len is the sum of all packet lengths, and frame_count is the packet count. If ALIGN4 is enabled, the next offset advances by align4(raw_packet_bytes) for each packet; padding bytes must be 0 and are included in payload_len.

TxPDO reads are processed in the opposite direction:

  1. Read the 24B fixed header from offset 0 of the SM3/TxPDO continuous buffer.
  2. Check seq_begin == seq_end, crc_alg == 1, and payload_len <= ActiveFrameAreaBytes.
  3. Calculate CRC16 over offset [24, 24 + payload_len) and compare it with payload_crc16.
  4. Starting from offset 24, parse each packet according to the CAN_FRAME packet length.
  5. If ALIGN4 is enabled, advance the next packet offset using align4(raw_packet_bytes).
  6. If overflow_sat != 0 or STREAM_TRUNCATED=1, the TxPDO data of this cycle may be incomplete.

5.4.5 Common configuration methods of third-party EtherCAT masters

Main site type Recommended practices
TwinCAT After importing ESI, select the first N RxPDO/TxPDO chunks on the slave PDO/SyncManager page; write 0x8010/0x8011 and 0x8001..0x8004 into Startup SDO.
CODESYS Fixed PDO mapping and SM length in EtherCAT device configuration; put profile apply and MCAN parameters into startup parameters list.
Acontis / Self-developed master Write 0x1C12/0x1C13, 0x8010/0x8011 and MCAN configuration through CoE SDO before entering OP; process the 128*N continuous buffer when registering process data.

If the master does not support online modification of PDO mapping, N should be fixed during the project configuration phase and avoid switching the PDO size during operation. During runtime, only SM2/RxPDO output data is updated and SM3/TxPDO input data is read.

5.4.6 Quick judgment of configuration errors

Phenomenon Priority Check
The slave cannot enter the OP SM2/SM3 length, 0x1C12/0x1C13 assignment, ESI/SII match
0x8010/0x8011:02 = 5 The assignment chunk count is inconsistent with PDO size multiplier, and the master mapping needs to be reloaded
PDO parsing error Fixed header 24B, payload_len, CRC16, layout CRC
CAN is not sent Whether the master writes SM2/RxPDO; whether the 0x8011 channel mask enables the target channel; whether the MCAN channel parameters apply
CAN cannot be received Whether the master reads SM3/TxPDO; whether 0x8010 channel mask enables the target channel; whether TxPDO payload_len is non-0

Up to this point, Chapter 5 has shown how the master selects the PDO size, applies the firmware profile, and writes one minimal RxPDO frame. Chapters 6..12 define the bytes used by that example: the 24B fixed header, channel status, frame packets, direction options, TX_RESULT, CRC, and multi-channel budget. Readers using the official IgH API can skim these chapters; readers implementing their own parser should follow them field by field.


6. PDO fixed header

TxPDO and RxPDO share the same 24B fixed header. The header uses little-endian fields. In ver_ihl, the high 4 bits are the header version and the low 4 bits are the number of 4B words. The current version is 1 and ihl=6, so the frame area starts from offset 24.

The fixed header is not an SDO object and does not have the RO/RW attribute; its master access direction follows the PDO direction: the RxPDO header is written by the master and parsed by the slave, and the TxPDO header is written by the slave and parsed by the master.

Offset Size Field Description
0 1 ver_ihl version=1, ihl=6, fixed header 24B
1 1 header_flags overflow, error, TX_RESULT, status change, sequence number wraparound
2 2 seq_begin Release starting sequence number
4 2 seq_end Release completion sequence number, must be equal to seq_begin to be valid
6 2 payload_len The number of valid bytes in the frame encapsulation area of this cycle
8 2 payload_crc16 Frame encapsulation area CRC-16/CCITT-FALSE
10 2 layout_id The current PDO layout ID, changes when the layout or profile changes
12 1 channel_mask active channel mask in this direction
13 1 frame_count Number of frame encapsulated packets in this cycle
14 1 overflow_sat Overflow/truncation count for this cycle, saturation
15 1 crc_alg 1=CRC-16/CCITT-FALSE
16 8 channel_status[4] 4 channels 16bit compression status

Publishing rules: The sender first constructs the complete frame encapsulation area and header field, and finally writes seq_end = seq_begin; the receiver only parses the payload when seq_begin == seq_end, payload_len <= ActiveFrameAreaBytes, crc_alg=1 and the CRC check passes. This design is used to avoid the master or slave from reading a half-updated PDO.

6.1 Key field explanation and reception judgment

seq_begin, seq_end, layout_id, crc_alg, overflow_sat are not parameters that require separate SDO configuration of the master. They are running status fields carried in the fixed header in each PDO cycle. The master needs to write them according to rules in the RxPDO delivery direction; the master needs to check them according to rules in the TxPDO upload direction.

Field How the sender fills in How the receiver determines
seq_begin The PDO image is incremented every time it is released, 16bit wraps When it is not equal to seq_end, it means that it is being updated or half a packet has been read, and the data in this cycle should be discarded
seq_end After all payload, CRC and header fields are written, they are finally written with the same value as seq_begin Only seq_begin == seq_end is allowed to continue to check the CRC and parse the payload
layout_id 16bit layout short identifier generated based on active PDO profile If there is a sudden change during continuous operation, it means that the PDO size, channel mask, profile or option flags have changed, and you need to re-analyse according to the active profile
crc_alg The current fixed writing is 1, which means CRC-16/CCITT-FALSE The payload must not be parsed when it is not equal to 1; the current product does not support switching to other CRC algorithms during runtime
overflow_sat Increases when the frame area of this cycle is insufficient, back pressure or truncation, and the maximum saturates to 255 overflow_sat != 0 or STREAM_TRUNCATED=1 means that the data of this cycle is incomplete and should be combined with the SDO counter to troubleshoot

Notes:

  • layout_id is a short identifier in the PDO header. It lets the master quickly detect whether the current PDO layout has changed. For full configuration readback, read 0x8010/0x8011:12 Active profile word and :11 Active layout CRC.
  • If overflow_set appears in the document or debugger, it corresponds to this header field overflow_sat: it is not a switch, but "the saturation count after overflow/truncation in this cycle."
  • The calculation range of payload_crc16 is the frame encapsulation area, that is, PDO offset [24, 24 + payload_len), which does not include the 24B fixed header.
  • payload_len is the actual number of valid frame encapsulation bytes in this cycle, not the total length of PDO. Unused frame areas must be filled with 0.

Recommended judgment sequence for the receiving end:

text
1. Read fixed header A.
2. Check seq_begin == seq_end; if not equal, ignore the PDO of this cycle.
3. Check crc_alg == 1.
4. Check payload_len <= ActiveFrameAreaBytes.
5. Calculate CRC-16/CCITT-FALSE for payload_len bytes starting at offset 24.
6. Read the fixed header B again; if the key fields of A and B are inconsistent, it means that the PDO was updated during the reading, and this cycle is ignored.
7. Parse CAN_FRAME / TX_RESULT.
8. If overflow_sat != 0 or STREAM_TRUNCATED=1, mark this cycle as incomplete data.

Configuration example: When the master wants both TxPDO/RxPDO to use N=8, CAN0..CAN3, profile 0, Balanced, and disable the direction option:

text
0x1C12 / 0x1C13: Select the first 8 128B chunks
0x8010:03 = 8     TxPDO PDO size multiplier
0x8010:04 = 0x0F  TxPDO channel mask
0x8010:05 = 0     TxPDO profile 0
0x8010:06 = 0     TxPDO Balanced budget
0x8010:07 = 0x00  TxPDO option flags
0x8010:01 = 1     apply TxPDO profile

0x8011:03 = 8     RxPDO PDO size multiplier
0x8011:04 = 0x0F  RxPDO channel mask
0x8011:05 = 0     RxPDO profile 0
0x8011:06 = 0     RxPDO Balanced budget
0x8011:07 = 0x00  RxPDO option flags
0x8011:01 = 1     apply RxPDO profile

Read 0x8010/0x8011:09..12 after apply. If Active PDO bytes, Active frame area bytes, Active layout CRC, Active profile word are as expected, layout_id in subsequent PDO headers should remain stable.

header_flags

Bit Name Description
0 STREAM_TRUNCATED The frame area of this cycle is insufficient and there are frames that are not packed
1 ANY_CHANNEL_ERROR Any channel is in error, BusOff, or congested
2 TX_RESULT_PRESENT TxPDO contains the send result packet
3 STATUS_CHANGED Channel status changes compared to the previous cycle
4 SEQ_WRAP seq_begin Wraparound this cycle
5 OVERFLOW_SAT_VALID overflow_sat valid
6 reserved The sender writes 0 and the receiver ignores
7 reserved The sender writes 0 and the receiver ignores

7. Channel status word

Each channel status is compressed to 16 bits and placed in the PDO header. PDO only carries fast status, detailed reasons are read through SDO.

Bits Field Description
0..2 state 0=disabled,1=init,2=run,3=busoff,4=error,5=listen
3 fd_enabled Current channel enables CAN FD
4 warn error warning / error passive / bus degraded summary
5 bus_off BusOff
6 rx_pressure RX FIFO nearly full or overflow
7 tx_pressure TX FIFO/Queue congestion
8 detail_pending New detail snapshot available in SDO
9 counter_sat pending count saturated
10..12 rx_pending_sat RX pending 0..7 saturated
13..15 tx_pending_sat TX pending 0..7 saturated

When warn/bus_off/rx_pressure/tx_pressure/detail_pending is set, the master should read 0x9000..0x9003 to obtain a detailed register and count snapshot. If the error comes from the PDO encapsulation layer, LastPDOError / PDOErrorCounter / PDOOverflowCounter of 0x8010/0x8011 should be read.


8. Frame encapsulation package

Each frame encapsulation packet starts with a 2B control word, which determines the length of subsequent CAN ID, timestamp and data.

The frame encapsulation package follows the PDO direction: CAN_FRAME in RxPDO is the master's request from the slave to send to the CAN bus; CAN_FRAME in TxPDO is received by the slave from the CAN bus and uploaded to the master; TX_RESULT in TxPDO is the slave's transmission result of the frame sent by RxPDO.

Unless otherwise specified, multi-byte values in PDO fixed headers, frame packets, TX_RESULT and SDO use little-endian. On the master side, do not cast unaligned byte buffers directly to host structures. Read and write fields explicitly from the byte stream.

text
Byte0:
  bit0..2 CH CAN channel id, currently using 0..3
  bit3..6 DLC original CAN DLC, 0..15
  bit7     IDE      0=11bit standard id,1=29bit extended id

Byte1:
  bit0     FDF      0=classic CAN,1=CAN FD
  bit1     BRS      CAN FD bit rate switch
  bit2 X When FDF=0, it is RTR, when FDF=1, it is ESI
  bit3..4  TSF      0=no timestamp,1=delta16,2=delta32,3=full64
  bit5..6  KIND     0=CAN_FRAME,1=TX_RESULT,2=STREAM_META,3=reserved
  bit7     D64      0=data length by DLC,1=fixed 64B data window

The current main process uses KIND=0 CAN_FRAME. KIND=1 TX_RESULT is optionally generated by TxPDO. KIND=2 STREAM_META is reserved for extended capabilities such as whole-stream CRC. KIND=3 must currently be considered illegal.

8.1 CAN_FRAME format

text
Standard ID:
  Ctrl[2] + StdIdField[2] + Timestamp[0/2/4/8] + Data[0..64] + Padding

Extended ID:
  Ctrl[2] + ExtIdField[4] + Timestamp[0/2/4/8] + Data[0..64] + Padding

StdIdField:

Bits Description
0..10 11bit STD_ID
11..13 ID_AUX
14 reserved, must be 0
15 reserved, must be 0

ExtIdField

Bits Description
0..28 29bit EXT_ID
29..31 ID_AUX

ID_AUX suggested semantics:

Directions Suggestions
TxPDO/CAN RX 0=FIFO0,1=FIFO1,2=RXBUF,3=HPMS/high priority
RxPDO/CAN TX 0=normal,1=high priority,2=dedicated buffer,3=queue hint

When not used, the sender must write 0 and the receiver ignores it.

8.2 DLC and data length

DLC 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Bytes 0 1 2 3 4 5 6 7 8 12 16 20 24 32 48 64

DLC<=8, BRS=0, D64=0 in classic CAN. If FDF=0 && X=1, the frame is RTR, and the data length must be 0. X in CAN FD represents ESI, and there is no RTR.

8.3 Packet length calculation

text
id_bytes = IDE ? 4 : 2
ts_bytes = TSF == 0 ? 0 : (TSF == 1 ? 2 : (TSF == 2 ? 4 : 8))
data_bytes = (FDF == 0 && X == 1) ? 0 :
             (D64 ? 64 : can_dlc_to_len(DLC))
raw_packet_bytes = 2 + id_bytes + ts_bytes + data_bytes
packet_bytes = ALIGN_4_ENABLE ? align4(raw_packet_bytes) : raw_packet_bytes

The unused frame area must be filled with 0. If 4-byte alignment is enabled, the padding byte must be 0 and counted as payload_len.

8.3.1 Enable 4-byte alignment

4-byte alignment is controlled by the direction option ALIGN_4_ENABLE, not the 0xF000 read-only capability object that is turned on directly. 0xF000:15 (0x0F) is used to confirm whether the device claims to support this capability; the real switch is 0x8010/0x8011:07 (0x07) Option flags bit1.

Direction Control object bit1 meaning
TxPDO / SM3 Input / Upload from the slave 0x8010:07 (0x07) Each frame package uploaded by the slave is padded by 4 bytes. When the master parses, it jumps to the next packet according to the aligned length
RxPDO / SM2 Output / Sent by the master 0x8011:07 (0x07) Each frame packet sent by the master must be completed by 4 bytes, and the slave will parse the next packet according to the aligned length

Turn on steps:

text
1. Read 0xF000:15 and confirm that bit1 ALIGN4 option mask is 1.
   You can also read 0xF000:16 and confirm that bit5 ALIGN4 feature is 1.
2. Write 0x8010/0x8011 requested profile in PREOP/SAFEOP.
3. Set 0x8010:07 or 0x8011:07 bit1 of the target direction to 1.
4. Write 0x8010:01 = 1 or 0x8011:01 = 1 apply.
5. Read 0x8010/0x8011:02 and confirm Status = 0.
6. Read 0x8010/0x8011:12 and confirm that bit1 of OptionFlags in the Active profile word has taken effect.

Example: Leave other direction options unchanged and only turn on RxPDO 4-byte alignment:

text
old = read_u8(0x8011:07)
write_u8(0x8011:07, old | 0x02)
write_u8(0x8011:01, 1)
check read_u8(0x8011:02) == 0

Example: Turn off TxPDO 4-byte alignment:

text
old = read_u8(0x8010:07)
write_u8(0x8010:07, old & ~0x02)
write_u8(0x8010:01, 1)
check read_u8(0x8010:02) == 0

After ALIGN4 is enabled, the sender must pad each frame packet to a 4-byte boundary. Padding bytes must be 0 and must be included in the fixed header payload_len. The receiver must also advance by the aligned packet_bytes when parsing the next packet, not by the raw CAN data length alone.

Length example:

CAN_FRAME raw_packet_bytes ALIGN4 post packet_bytes payload_len counts
Standard frame, DLC=8, no timestamp 2 + 2 + 8 = 12 12 12
Extended frame, DLC=8, no timestamp 2 + 4 + 8 = 14 16 16, the last 2B padding must be 0
Standard CAN FD, DLC=15, no timestamp 2 + 2 + 64 = 68 68 68
Extended CAN FD, DLC=15, delta16 2 + 4 + 2 + 64 = 72 72 72

8.4 Timestamp field

TSF determines whether CAN_FRAME carries the timestamp field. In the ordinary TxPDO upload direction, the timestamp is used to describe the time when the slave receives the CAN frame; in the RxPDO delivery direction, TSF_NONE means immediate transmission, and TSF_FULL64 can be multiplexed by the reserved transmission format.

TSF Number of bytes General semantics Description
0 0 No timestamp Default mode, lowest overhead
1 2 delta16 The lower 16 bit difference relative to the reference time within the same PDO cycle, suitable for short-cycle compressed timestamps
2 4 delta32 The lower 32 bit difference relative to the reference time; the capability bit exists but the current default profile is not actively enabled
3 8 full64 64 bit full timestamp, or RxPDO reservation sending extended format

delta16/delta32 within the same Packet sequence in TxPDO is referenced to the first available time base of the cycle. The master should handle wrap as an unsigned difference when used for sorting and diagnostics. If the master does not need timestamps, it is recommended to use profile 0/4 to reduce the overhead of each frame.

RxPDO reservation sending only uses the 8B field of TSF_FULL64, and the required format is as follows:

text
format:u8 = 1
flags:u8 = 0
tag:u16
offset_ns:u32

offset_ns represents the target phase relative to the starting point of the next SYNC0 cycle. This format is not an absolute timestamp; if the target phase has been missed, the firmware will not delay the frame until the next cycle and the master should reserve sufficient phase margin.


9. Encapsulation Profile and direction options

0x8010 controls the TxPDO profile, and 0x8011 controls the RxPDO profile. Currently, the following profiles are supported out of the factory:

Profile Default state Description
0 Enabled by default compact inline, variable DLC, no timestamp
1 Off by default, needs to be configured compact inline, variable DLC, allow delta16 timestamp
4 Off by default, needs to be configured compact inline, D64 allowed, no timestamp
5 Off by default, need to configure compact inline, allow D64, allow delta16 timestamp

Direction options are controlled by 0x8010/0x8011:07 Option flags. 0x8010 acts in the TxPDO/SM3/Input upload direction, and 0x8011 acts in the RxPDO/SM2/Output delivery direction.

9.1 Option flags bit table

Option flags is an 8 bit bitmap. After the master writes the requested value, it must then write 0x8010:01=1 or 0x8011:01=1 apply. Only by reading 0x8010/0x8011:02=0 and :12 Active profile word can it truly take effect.

Bit Mask value Name Applicable direction Default state Description
0 0x01 TX_RESULT_ENABLE TxPDO / 0x8010:07 (0x07) Close The slave uploads the transmission result packet of the RxPDO frame in TxPDO; 0x8011:07 (0x07) bit0 is not used for RxPDO
1 0x02 ALIGN_4_ENABLE TxPDO / RxPDO Off Each CAN_FRAME/TX_RESULT packet is padded on a 4-byte boundary; padding must be 0 and counted towards payload_len
2 0x04 NO_CRC16_ENABLE TxPDO / RxPDO Off Disable fixed-header payload_crc16; the PDO header uses crc_alg=0 and payload_crc16=0 for performance isolation tests
3 0x08 APP_BYPASS_ENABLE TxPDO / RxPDO Off Fast-bypass the real MCAN application data path at PDO entry points; TxPDO returns only a minimal valid dynamic header, and RxPDO does not enter the AB buffer
4 0x10 PAYLOAD_ONLY_ENABLE TxPDO / RxPDO Off For stable layouts, update only the 24-byte header and valid payload; receivers must ignore bytes beyond payload_len
5..7 0xE0 reserved reserved closed The master must write 0; writing 1 will be regarded as unsupported option

Commonly written values:

Write value Function Typical scenarios
0x00 All direction options are off Default bring-up, minimal overhead
0x01 Turn on TX_RESULT 0x8010:07 (0x07), used when the results need to be sent frame by frame
0x02 Turn on 4-byte alignment 0x8010:07 (0x07) or 0x8011:07 (0x07), the customer master hopes that the frame packet is naturally 32bit aligned
0x03 TX_RESULT + 4-byte alignment 0x8010:07 (0x07), send result and alignment at the same time
0x04 Disable CRC16 Configure both 0x8010:07 (0x07) and 0x8011:07 (0x07) to measure CRC16 overhead
0x08 Bypass application path Configure both 0x8010:07 (0x07) and 0x8011:07 (0x07) to measure without the MCAN application data path

Ability judgment:

Ability object Judgment method Description
0xF000:15 PDO option flags mask Check whether the corresponding bit is 1 Indicates that the option flag can be written 0x8010/0x8011:07
0xF000:16 PDO feature flags Check the corresponding feature bit Indicates the device protocol capabilities, such as ALIGN4, scheduled sending, etc.

The current capability mask is based on 0xF000. The master should read the capability object first and then select the profile and option flags.

9.2 Default switch state when not configured

If the master does not write the profile-related SDO of 0x8010/0x8011, the default value of requested in the device object dictionary is as follows. Note: 0xF000 means "support capability" and does not mean enabled by default; the actual enabled status is determined by the requested profile of 0x8010/0x8011 and the active readback after apply.

Function Control object Default value Status when not configured Remarks
PDO size multiplier 0x8010/0x8011:03 8 Default request 1024B/direction Master site mapping must also select the first 8 chunks, otherwise apply will return mapping reload required
Channel mask 0x8010/0x8011:04 0x0F CAN0..CAN3 default request to enable To close the channel, you need to explicitly change the mask and apply
Encapsulation profile 0x8010/0x8011:05 0 profile 0 on variable DLC, no timestamp
Budget policy 0x8010/0x8011:06 0 Balanced on Reserve the minimum budget for each enabled channel, and the remaining space is shared
TX_RESULT 0x8010:07 bit0 0 Off Explicitly turned on when results need to be sent frame by frame; 0x8011 bit0 is not used for RxPDO
4-byte alignment 0x8010/0x8011:07 bit1 0 Close Supported but not padded by default. After opening, padding is included in payload_len
Disable CRC16 0x8010/0x8011:07 bit2 0 Close Fixed-header payload_crc16 is used by default; when enabled, crc_alg=0
Application bypass 0x8010/0x8011:07 bit3 0 Close The real MCAN path is used by default; enable only for protocol-stack efficiency tests
delta16 timestamp 0x8010/0x8011:05=1/5 0 Off Select profile 1 or 5 before enabling
D64 data window 0x8010/0x8011:05=4/5 0 Close Select profile 4 or 5 before enabling
RxPDO scheduled transmission RxPDO CAN_FRAME TSF_FULL64 format=1 No ordinary default frame Close The master must actively send frames according to the scheduled format, and it is recommended to confirm 0xF000:16 bit8 first
CAN FD 0x8001..0x8004:15 1 Enable Each MCAN channel is configured according to CAN FD by default; classic CAN needs to write 0 and apply
TDC 0x8001..0x8004:16 1 Open Data segment 5M or above will be forced to open even if you write 0

It is recommended that masters not rely on the assumption that implicit defaults are in effect. When starting up, you should explicitly configure 0x1C12/0x1C13, write 0x8010/0x8011:03..07, then write 0x8010/0x8011:01=1 apply, and read :09..12 to confirm the active status.


10. TX_RESULT

TX_RESULT is an optional frame packet used to return the transmission result of the RxPDO frame in TxPDO.

text
TX_RESULT:
  Ctrl[2] + RefPacketSeq[2] + RefFrameIndex[1] + ResultCode[1]

Ctrl has KIND=1, and CH identifies the CAN channel that produced the result. RefPacketSeq refers to the committed RxPDO publish sequence in the fixed header, that is, the sequence where seq_begin == seq_end. RefFrameIndex identifies which KIND=0 CAN_FRAME packet in that RxPDO payload is being reported, counting from 0. This lets the master match each TX_RESULT to the original transmit request.

ResultCode

value description
0 OK
1 queued
2 bus busy
3 invalid channel
4 tx fifo full
5 bus off

TX_RESULT only represents the result of the slave handing the frame to the MCAN transmission path, which does not mean that the target CAN node has completed business processing. If TX FIFO/Queue is used, queued indicates that it has entered the local transmission queue, and the actual bus transmission is still affected by arbitration, bus off, and TX FIFO space.

If the master does not require frame-by-frame ACK, it can turn off TX_RESULT and only observe congestion through the PDO header channel status and SDO counter.


11. CRC and integrity strategy

By default, CRC32 is not added to each CAN_FRAME.

Reason:

  • The CAN/CAN FD bus itself already has CAN CRC.
  • EtherCAT frame has link FCS and working counter.
  • per-frame CRC32 will increase 4B/frame, and the classic 8B standard frame overhead increases from 12B to 16B, about 33%.
  • Frame-by-frame CRC32 adds jitter to the packet calculation in 1ms periods.

By default, ActiveLayoutCrc is used to verify the PDO layout contract. This CRC is only calculated when profile apply. payload_crc16 in the fixed header is used to protect FramePacketStream in each PDO cycle during runtime. The algorithm is CRC-16/CCITT-FALSE; it is used to identify half-update or error payload, not CAN frame-level business CRC. If additional runtime integrity checks are indeed required in the future, STREAM_CRC32_ENABLE with capability bit declaration should be used, and whole-stream CRC32 should be carried in STREAM_META packets instead of adding CRC to each CAN_FRAME.


12. Multi-channel shared budget

PDO no longer provides fixed slots for each CAN channel. The scheduler works on a frame area byte budget:

text
frame_area = ActivePDOBytes - 24
reserved_bytes = enabled_channel_count * policy_reserved_bytes
shared_bytes = frame_area - reserved_bytes

Budget strategy:

value name description
0 Balanced Reserve a minimum packet budget for each enabled channel, and compete for remaining space sharing; Default
1 SharedOnly No channel reservation, all frames share contention
2 Deterministic Allocate the budget evenly according to the enabled channels, and do not borrow between channels
3 Reserved Reserved

A CAN_FRAME must be put into the frame area of this cycle as a whole, and splitting across cycles is not allowed. If there is insufficient space, set the device to STREAM_TRUNCATED, add overflow_sat and SDO PDOOverflowCounter.


13. SDO object dictionary

The previous chapters describe periodic PDO data, which is exchanged every EtherCAT cycle after OP. The SDO object dictionary is the configuration and diagnostics entry point: use it before OP to configure PDO profiles and MCAN channels, and use it during operation to read capabilities, error counters, and detailed status. If you only need to look up an object, start from this chapter. For bring-up, read 13.1, 13.2, 13.4, and 13.8 first.

All SDO subindex tables in this chapter include a "Type" column. The type uses common EtherCAT CoE notation: U8 is unsigned 8 bit, U16 is unsigned 16 bit, and U32 is unsigned 32 bit. If a signed 32-bit type appears later, it can be marked as D32/I32. The current ECAN-Lite object dictionary mainly uses U8/U16/U32.

13.1 Object Overview

Object Name Access Overview Direction/Purpose Description
0x8000 System Config RW/RO CFG System clock, restart, CAN pin rotation
0x8001..0x8004 MCAN Channel Config RW/RO CFG Each CAN/CAN FD configuration
0x8010 TxPDO Profile Control RW/RO S2M profile Slave upload direction PDO profile
0x8011 RxPDO Profile Control RW/RO M2S profile Master sends direction PDO profile
0x8020 Data Path Global Control RW/RO CFG/runtime Global data-path control, compatibility mode, and service budget
0x8021..0x8024 MCAN Data Path Control RW/RO CFG/runtime Per-MCAN RX/TX cache, budget, drop, and recovery policies
0x8030 PDO Diagnostic Test Control RW/RO diagnostic Fine-grained bypass, CRC, and payload-only test control
0x9000..0x9003 MCAN Channel Information RO S2M status Each channel CAN read-only status details
0x9011 Cycle Performance Diagnostics RO/RW diagnostic Cycle, IRQ, Mapping, and service timing statistics
0x9020..0x9023 MCAN Data Path Diagnostics RO diagnostic Per-MCAN data-path cache/drop/recovery counters
0xA000..0xA003 MCAN Register Service RW/RO CFG/diagnostic MCAN register debug access for each channel
0xB000 Device Maintenance RW/RO CFG/maintenance Maintenance, persistence, FoE status
0xF000 Device Objects RO S2M capability Capability, version, upper limit read-only objects

13.2 0x8010/0x8011 PDO Profile Control

0x8010 controls the TxPDO/Input direction, and the data flow is S2M; 0x8011 controls the RxPDO/Output direction, and the data flow is M2S. SI1/3/4/5/6/7/8 is the requested configuration or command written by the master, and SI2/9..16 is the status and active readback returned by the slave.

SI Name Type Access Default Description
1 Apply command U8 RW 0 Write 1 Apply requested profile
2 Status U8 RO 0 apply/parser Status
3 PDO size multiplier U8 RW 8 ActivePDOBytes=128*N, N=1..24
4 Channel mask U8 RW 0x0F bit0..7 corresponds to CAN0..CAN7
5 Encapsulation profile U8 RW 0 Encapsulation profile; default profile 0, no timestamp, variable DLC
6 Budget policy U8 RW 0 Budget policy; default Balanced
7 Option flags U8 RW 0 Direction options; default TX_RESULT, ALIGN4, STREAM_CRC32 are all off
8 Command U8 RW 0 bit0 reset session, bit1 clear errors
9 Active PDO bytes U16 RO 0 Current PDO bytes
10 Active frame area bytes U16 RO 0 Current frame area bytes
11 Active layout CRC U32 RO 0 layout contract CRC
12 Active profile word U32 RO 0 active profile package echo
13 Packet sequence U16 RO 0 Recent direction sequence number
14 Last PDO error U16 RO 0 Last encapsulation layer error
15 PDO error counter U32 RO 0 Packaging layer error count
16 PDO overflow counter U32 RO 0 Overflow/backpressure count

Status Common values:

value description
0 OK
1 invalid state, usually the OP trying to change the layout
2 invalid PDO size multiplier
3 invalid channel mask
4 invalid encapsulation profile
5 master mapping reload required
7 PDO encapsulation error
8 PDO overflow/backpressure
9 requested profile pending apply
10 unsupported option flag

Active profile word packaging format:

Bits Field Description
0..4 PDOSizeMultiplier - 1 N=1..24, the actual number of PDO bytes is 128 * N
5..12 ChannelMask bit0..3 corresponds to CAN0..CAN3, the current product only uses the lower 4 bits
13..18 EncapsulationProfile See Chapter 9 profile table
19..20 BudgetPolicy See Chapter 12 Budgeting Strategies
21..28 OptionFlags Direction options, see Chapter 9
29 reserved reserved as 0
30 reserved reserved as 0
31 reserved reserved as 0

Command bit definition:

Bit Name Description
0 reset session Clear the running state serial number, error status and temporary session information in this direction
1 clear errors Clear LastPDOError, PDOErrorCounter and PDOOverflowCounter
2 reserved Must be 0
3 reserved Must be 0
4 reserved Must be 0
5 reserved Must be 0
6 reserved Must be 0
7 reserved Must be 0

Last PDO error common values:

value name description
0 OK No errors
2 frame overrun A single frame exceeds the encapsulation capability supported by the current profile
3 packet overrun frame packet exceeds this cycle frame area
4 unknown kind KIND is illegal or not currently supported
5 invalid DLC DLC does not match classic CAN/CAN FD rules
6 invalid channel The channel number exceeds the capability range or is not enabled in the channel mask
7 invalid TSF The timestamp format is not supported by the current profile or direction
8 truncated The payload length is insufficient and the frame packet is truncated
9 unsupported profile EncapsulationProfile is not in the capability mask
10 duplicate sequence Duplicate RxPDO images received, usually treated as idempotent no-op
11 unsupported option option flags contain unsupported bits
12 active area active PDO/frame area is inconsistent with the master mapping
13 reserved bit Control word or fixed header reserved bit is not 0
14 bad header Fixed header version, length or field illegal
15 bad CRC payload_crc16 verification failed
16 bad schedule The reservation sending format is illegal or the capability is not supported

PDO error counter counts encapsulation layer errors such as parsing, CRC, and illegal fields; PDO overflow counter counts overflow or discarding caused by insufficient frame area in this cycle and TX/RX back pressure. During on-site inspection, first check Status, and then check LastPDOError and whether the two counters continue to increase.

13.2.1 0x8020 Data Path Global Control

0x8020 is the global data-path control object. It does not change the EtherCAT SM/PDO mapping length. It is used for runtime compatibility policy, diagnostic options, and service budget control. Write Apply command=1 after changing fields; Apply status=0 means the request was accepted.

SI Name Type Access Default Description
1 Control format U16 RO 1 Control object format version
2 Apply command U8 RW 0 0=no-op, 1=apply current global control
3 Apply status U8 RO 0 Last apply result, 0=OK
4 Compat mode U16 RW 3 Compatibility mode bits for legacy and explicit objects coexisting
5 Runtime option flags U32 RW 0 Runtime options; current capability mask is 0, so keep this 0
6 Diagnostic option flags U32 RW 0 Diagnostic options; current capability mask is 0, so keep this 0
7 Max service budget us U16 RW 1000 Data-path service budget limit, valid 0..1000; 0 means firmware default
8 Reserved0 U16 RO 0 Reserved
9 Reserved1 U32 RO 0 Reserved
10 Reserved2 U32 RO 0 Reserved

13.2.2 0x8021..0x8024 MCAN Data Path Control

0x8021..0x8024 correspond to MCAN0..MCAN3. These objects expose each MCAN data-path policy as explicit fields instead of packing everything into the legacy policy word. They do not configure MCAN bit timing, filters, or Message RAM; those remain in 0x8001..0x8004.

Object Channel
0x8021 MCAN0
0x8022 MCAN1
0x8023 MCAN2
0x8024 MCAN3
SI Name Type Access Default Description
1 Enable U8 RW 1 0=disable this channel data-path policy, 1=enable
2 Apply command U8 RW 0 0=no-op, 1=apply this channel policy at runtime
3 Apply status U8 RO 0 Last apply result, 0=OK
4 RX drain budget min U8 RW 0 Minimum frames to drain from MCAN RX cache per cycle, 0..8
5 RX drain budget max U8 RW 2 Maximum frames to drain from MCAN RX cache per cycle, 0..8
6 RX budget policy U8 RW 1 RX budget policy, see table below
7 RX cache depth U8 RW 2 RX cache depth; accepts legacy enum 0..3 or explicit 8/16/24/32
8 RX overflow policy U8 RW 1 RX cache full policy, see table below
9 Critical frame policy U16 RW 1 Critical-frame preservation policy, see table below
10 CAN ID priority policy U16 RW 0 CAN ID priority policy, currently reserved
11 TX budget min U8 RW 0 Minimum TX service budget per cycle, 0..8
12 TX budget max U8 RW 4 Maximum TX service budget per cycle, 0..8
13 TX overflow policy U8 RW 1 TX cache full policy, see table below
14 Bus-off recovery policy U8 RW 1 Bus-off recovery policy, see table below
15 Backoff base cycles U16 RW 2 Base backoff cycles after TX backpressure
16 Degraded threshold U16 RW 64 Threshold for entering degraded state
17 Reserved0 U32 RW 0 Reserved for extension
18 Reserved1 U32 RW 0 Reserved for extension
19 Reserved2 U32 RW 0 Reserved for extension
20 Active control word U32 RO 0 Read-only packed echo of the active policy

RX budget policy:

value name description
0 balanced Use conservative default budget
1 limited Use RX drain budget min/max to limit per-cycle drain
2 performance Drain more aggressively within the configured limit
3 adaptive Adapt to cache pressure and cycle budget

RX cache depth:

write value effective depth
0 or 32 32
1 or 8 8
2 or 16 16
3 or 24 24

RX overflow policy:

value name description
0 drop oldest Drop old frames when full and keep the newest feedback
1 drop newest Drop new frames when full and preserve current order
2 preserve critical Try to preserve emergency, heartbeat, and CANopen critical frames
3 degraded Enter degraded diagnostics after overflow

Critical frame policy:

value name description
0 none No special critical-frame protection
1 CANopen safety Preserve common CANopen safety/status frames
2 CANopen all Use a more conservative policy for CANopen control and status frames

TX overflow policy:

value name description
0 drop newest Drop new frames when the TX cache is full
1 drop oldest Drop old frames and prioritize latest control data
2 backoff Back off when backpressure is detected
3 degraded Enter degraded state after persistent congestion

Bus-off recovery policy:

value name description
0 manual Only record bus-off and wait for host recovery
1 auto Automatic recovery, recommended default
2 aggressive More aggressive recovery for test environments
3 degraded Stay degraded after bus-off to avoid repeated bus disturbance

Active control word packing:

Bits Field
0 Enable
4..7 RX drain budget min
8..11 RX drain budget max
12..13 RX budget policy
14..15 RX cache depth legacy enum
16..17 RX overflow policy
18..19 Critical frame policy
20..23 TX budget min
24..27 TX budget max
28..29 TX overflow policy
30..31 Bus-off recovery policy

13.2.3 0x8030 PDO Diagnostic Test Control

0x8030 is intended for engineering and field performance isolation. It is not recommended to keep it enabled in production. Before writing any non-zero test policy, write Test enable key = 0x4543414E (ASCII ECAN). If the key is 0, all test policies must also be 0 or the write is rejected.

SI Name Type Access Default Description
1 Test enable key U32 RW 0 0=disable test mode; 0x4543414E=allow test controls
2 TxPDO bypass flags U32 RW 0 TxPDO fine bypass bits, see below
3 RxPDO bypass flags U32 RW 0 RxPDO fine bypass bits, see below
4 CRC test policy U8 RW 0 0=follow PDO option, 1=force CRC16, 2=force no CRC16
5 Payload only policy U8 RW 0 0=off, 1=Tx, 2=Rx, 3=Tx+Rx
6 App link bypass policy U8 RW 0 0=off, 1=Tx, 2=Rx, 3=Tx+Rx
7 ReservedPad U8 RO 0 Reserved
8 Legal combination mask U32 RO 0x1F Supported diagnostic capability bits
9 Last reject reason U32 RO 0 Last illegal-combination reject reason
10 Reserved0 U32 RO 0 Reserved

TxPDO bypass flags:

Bit Name Description
2 MCAN_READ Skip reading real frames from MCAN/RX cache
3 BUILD Skip TxPDO dynamic frame build
4 COPY Skip TxPDO copy/publish path

RxPDO bypass flags:

Bit Name Description
2 STAGE Skip RxPDO stage
3 PARSE Skip RxPDO payload parse
4 TX_RING Skip enqueueing into TX ring
5 MCAN_WRITE Skip real MCAN transmit

Legal combination mask:

Bit Capability Description
0 TX_BYPASS Supports TxPDO fine bypass
1 RX_BYPASS Supports RxPDO fine bypass
2 CRC_POLICY Supports CRC16/no-CRC16 test policy
3 PAYLOAD_ONLY Supports payload-only test policy
4 APP_BYPASS Supports application-link bypass policy

13.2.4 0x9011 Cycle Performance Diagnostics

0x9011 observes cycle stability and firmware hot-path timing. All entries are read-only except Clear command. Cycle fields are CPU cycles; use 0x8000:4 CPU clock hz to convert them to time.

SI Name Type Access Description
1 PDI IRQ count U32 RO PDI interrupt count
2 Sync0 IRQ count U32 RO Sync0 interrupt count
3 Sync1 IRQ count U32 RO Sync1 interrupt count
4 PDI to Sync0 phase min I32 RO Minimum PDI-to-Sync0 phase difference
5 PDI to Sync0 phase max I32 RO Maximum PDI-to-Sync0 phase difference
6 APPL OutputMapping max cycles U32 RO Maximum RxPDO/OutputMapping cost
7 APPL InputMapping max cycles U32 RO Maximum TxPDO/InputMapping cost
8 MCAN PDO service max cycles U32 RO Maximum main-loop MCAN PDO service cost
9 TxPDO shadow max cycles U32 RO Maximum TxPDO shadow publish cost
10 RxPDO parse max cycles U32 RO Maximum RxPDO parse cost
11 ESC read max cycles U32 RO Maximum ESC read-path cost
12 ESC write max cycles U32 RO Maximum ESC write-path cost
13 Schedule service max cycles U32 RO Maximum scheduled-transmit service cost
14 Clear command U8 RW Write 1 to clear this object and related runtime statistics
15 ReservedPad U8 RO Reserved
16 Reserved0 U32 RO Reserved for extension
17 Reserved1 U32 RO Reserved for extension
18 Reserved2 U32 RO Reserved for extension
19 Reserved3 U32 RO Reserved for extension
20 Reserved4 U32 RO Reserved for extension
21 Reserved5 U32 RO Reserved for extension
22 Reserved6 U32 RO Reserved for extension
23 Reserved7 U32 RO Reserved for extension
24 Reserved8 U32 RO Reserved for extension

13.2.5 0x9020..0x9023 MCAN Data Path Diagnostics

0x9020..0x9023 correspond to MCAN0..MCAN3. They expose the runtime result of 0x8021..0x8024 policies and help distinguish excessive CAN input, insufficient PDO space, TX FIFO backpressure, bus-off, and service-budget limits.

Object Channel
0x9020 MCAN0
0x9021 MCAN1
0x9022 MCAN2
0x9023 MCAN3
SI Name Type Access Description
1 RX cache count U16 RO Frames currently waiting in RX cache
2 RX cache high watermark U16 RO Historical RX cache high watermark
3 RX drain last U16 RO Frames drained in the most recent service
4 RX drain max U16 RO Maximum frames drained in one service
5 RX dropped total U32 RO Total RX dropped count
6 RX dropped old U32 RO Old frames dropped to keep new frames
7 RX dropped new U32 RO New frames dropped to preserve existing order
8 RX dropped critical U32 RO Drops related to critical-frame preservation
9 TxPDO consumed last U16 RO Frames consumed by the most recent TxPDO build
10 TxPDO consumed max U16 RO Maximum frames consumed by TxPDO in one cycle
11 TX fifo full count U32 RO MCAN TX FIFO/Queue full or not-writable count
12 TX stale dropped U32 RO Stale pending TX frames dropped
13 Bus off count U32 RO Bus-off count
14 Recovery attempts U16 RO Automatic recovery attempts
15 Degraded state U16 RO 0=normal, non-zero=degraded or protected state
16 Last error U32 RO Last data-path error code or low-level return code
17 Service max cycles U32 RO Maximum service cost for this channel
18 Service last cycles U32 RO Most recent service cost for this channel
19 Reserved0 U32 RO Reserved
20 Reserved1 U32 RO Reserved

13.3 0x8000 System Config

SI Name Type Access Default Description
1 Reboot command U8 WO 0 Write 1 to request software restart
3 CPU voltage U16 RW 1275 CPU voltage configuration value, unit mV; set by the board-level code when the current firmware is started, SDO writing is only echoed as the configuration value
4 CPU clock hz U32 RO 400000000 CPU frequency
5 BUS clock hz U32 RO 200000000 System bus frequency
6 MCAN0 clock hz U32 RO 80000000 MCAN0 source clock
7 MCAN1 clock hz U32 RO 80000000 MCAN1 source clock
8 MCAN2 clock hz U32 RO 80000000 MCAN2 source clock
9 MCAN3 clock hz U32 RO 80000000 MCAN3 source clock
10 Config version U32 RW 0 Master configuration version echo
11 Last apply result U32 RO 0 Last apply result of system configuration
12 CAN pin rotation U8 RW 0 Rotation of logical CAN channel to fixed pin group
13 Active CAN pin rotation U8 RO 0 Current active rotation
14 CAN pin rotation mask U8 RO 0x0F Supported rotation bit mask
15 CAN pin apply status U8 RO 0 Recent pin rotation application status

CAN pin rotation only allows rotation of logical channels between fixed sets of CAN pins at the chip/board level and does not provide arbitrary GPIO muxing configurations.

13.4 0x8001..0x8004 MCAN Channel Config

Each channel has the same structure. 0x8001 corresponds to CAN0, and 0x8004 corresponds to CAN3.

The subindices are grouped by function below. Most applications only need to configure SI15/16/19/20 and the required FIFO/Queue parameters; filters, TSU, and timeout settings are advanced options.

SI Name Type Access Default Description
1 Apply command U8 WO 0 Write 1 Apply channel configuration
2 Apply status U8 RO 0 Recent apply results
3 Flash command U8 WO 0 bit0 save, bit1 load, bit2 factory reset
4 Flash status U8 RO 0 Recent flash command results
5 Command sequence U32 RO 0 Command completion sequence number
6 Command Pad0 U32 RO 0 Reserved
7 Bit timing mode U8 RW 0 0=automatic baud rate solution, 1=manual bit timing
8 Node mode U8 RW 0 Normal / Loopback / Listen
9 Non-ISO enable U8 RW 0 CAN FD Non-ISO mode
10 Transmit pause U8 RW 0 MCAN transmit pause
11 Edge filter enable U8 RW 0 Edge filter
12 Protocol exception disable U8 RW 0 Disable protocol exception
13 Wide message marker enable U8 RW 0 Extended message marker
14 External timestamp use U8 RW 0 Use external timestamp source
15 FD enable U8 RW 1 1=CAN FD, 0=classic CAN
16 TDC enable U8 RW 1 CAN FD transmission delay compensation
17 Restricted mode disable U8 RW 0 restricted operation mode control
18 Disable auto retransmission U8 RW 0 1=Disable MCAN automatic retransmission
19 Nominal bitrate U32 RW 500000 Arbitration section baud rate
20 Data bitrate U32 RW 5000000 CAN FD data segment baud rate
21 Nominal SP min U16 RW 750 Nominal sample point lower bound, unit 0.1%; when the peer sample point is known, write the peer target value
22 Nominal SP max U16 RW 875 Nominal sample point upper bound, unit 0.1%; when the peer sample point is known, write the peer target value
23 Data SP min U16 RW 750 CAN FD data sample point lower bound, unit 0.1%; when the peer sample point is known, write the peer target value
24 Data SP max U16 RW 875 CAN FD data sample point upper bound, unit 0.1%; when the peer sample point is known, write the peer target value
25 Nominal BRP U16 RW 0 Manual nominal prescaler, valid only when SI7=1
26 Nominal TSEG1 U8 RW 0 Manual nominal TSEG1, valid only when SI7=1
27 Nominal TSEG2 U8 RW 0 Manual nominal TSEG2, valid only when SI7=1
28 Nominal SJW U8 RW 0 Manual nominal SJW, valid only when SI7=1
29 Data BRP U16 RW 0 Manual CAN FD data prescaler, valid only when SI7=1
30 Data TSEG1 U8 RW 0 Manual CAN FD data TSEG1, valid only when SI7=1
31 Data TSEG2 U8 RW 0 Manual CAN FD data TSEG2, valid only when SI7=1
32 Data SJW U8 RW 0 Manual CAN FD data SJW, valid only when SI7=1
33 TDC offset U8 RW 0 0=automatic, not 0=manual TDCO
34 TDC filter U8 RW 0 0=automatic, not 0=manual TDCF
36 Accept non-match std U8 RW 0 Standard-frame action when no filter matches
37 Accept non-match ext U8 RW 0 Extended-frame action when no filter matches
38 Reject remote std U8 RW 0 Whether to reject standard remote frames
39 Reject remote ext U8 RW 0 Whether to reject extended remote frames
40 Ext ID mask U32 RW 0x1FFFFFFF Extended ID global AND mask
41 Std list max U8 RO 64 Maximum number of standard filters
42 Ext list max U8 RO 24 Maximum number of extended filters
43 Std current index U8 RW 0 Current standard filter index
44 Ext current index U8 RW 0 Current extended filter index
45 Std entry cmd U8 RW 0 Standard filter edit command
46 Ext entry cmd U8 RW 0 Extended filter edit command
47 Std entry status U8 RO 0 Standard filter command result
48 Ext entry status U8 RO 0 Extended filter command result
49 Std filter count U8 RW 0 Number of valid standard filters
50 Std filter type U8 RW 0 Standard filter type
51 Std filter action U8 RW 0 Action after a standard-frame filter hit
52 Std filter sync U8 RW 0 Standard-frame sync message tag
53 Std ID1 U32 RW 0 Standard filter ID1
54 Std ID2 U32 RW 0 Standard filter ID2
55 Ext filter count U8 RW 0 Number of valid extended filters
56 Ext filter type U8 RW 0 Extended filter type
57 Ext filter action U8 RW 0 Action after an extended-frame filter hit
58 Ext filter sync U8 RW 0 Extended-frame sync message tag
59 Ext ID1 U32 RW 0 Extended filter ID1
60 Ext ID2 U32 RW 0 Extended filter ID2
61 RX FIFO0 op mode U8 RW 0 FIFO0 operation mode
62 RX FIFO0 size U8 RW 48 Number of FIFO0 elements
63 RX FIFO1 op mode U8 RW 0 FIFO1 operation mode
64 RX FIFO1 size U8 RW 12 Number of FIFO1 elements
65 RX FIFO0 data size U8 RW 7 FIFO0 element data size enumeration
66 RX FIFO1 data size U8 RW 7 FIFO1 element data size enumeration
67 RX buffer count U8 RW 12 Number of RX buffer elements
68 RX buffer data size U8 RW 7 RX buffer element data size enumeration
69 TX FIFO queue mode U8 RW 0 0=FIFO, 1=Queue
70 TX FIFO queue size U8 RW 32 Number of TX FIFO/Queue elements
71 TX dedicated buffer count U8 RW 0 Number of dedicated TX buffers
72 TX buffer data size U8 RW 7 TX element data size enumeration
73 TX event FIFO size U8 RW 32 Number of TX Event FIFO elements
74 Timestamp selection U8 RW 0 MCAN timestamp selection
75 Timestamp prescaler U8 RW 0 MCAN timestamp prescaler
76 TSU enable U8 RW 0 Enable TSU
77 TSU use external timebase U8 RW 0 Use external timebase
78 TSU capture on SOF U8 RW 0 SOF capture
79 TSU enable 64-bit U8 RW 0 64 bit TSU
80 Pad2 U8 RO 0 Reserved
81 TSU prescaler U16 RW 1 TSU prescaler, min 1
82 TSU external timebase source U8 RW 0 External timebase source
83 TSU TBSEL option U8 RW 0 TBSEL option
84 Timeout enable U8 RW 0 Enable MCAN timeout
85 Timeout select U8 RW 0 Timeout selection, 0..3
86 Pad3 U16 RO 0 Reserved
87 Timeout period U16 RW 0 Timeout period

Channel commands and status:

Field Value Description
Apply command 0 no-op
Apply command 1 Apply the current SDO configuration to the runtime MCAN channel
Apply status / Flash status 0 OK
Apply status / Flash status 1 fail
Apply status / Flash status 3 build fail, configuration conversion failed
Apply status / Flash status 4 apply runtime fail, MCAN restart or driver application failed
Flash command bit0 1 Save current channel configuration to Flash
Flash command bit1 1 Load channel configuration from Flash
Flash command bit2 1 Restore the channel to factory default configuration

Node mode value:

value description
0 Normal, normal sending and receiving
1 Restricted/monitor debugging mode, valid according to chip driver support
2 Internal loopback, internal loopback test
3 External loopback/listen debugging mode, valid according to chip driver support

Manual bit timing only takes effect at SI7 Bit timing mode = 1. In automatic mode, the master configures Nominal/Data bitrate and the sample point range, and the firmware solves BRP/TSEG/SJW according to the MCAN source clock. The sample point range should follow the peer device configuration: when the peer sample point is known, set both min and max to the target sample point; otherwise start from the peer documentation recommendation and verify frame exchange quality. In manual mode, SI25..32 is used.

Filter global fields:

SI Name Type Access Description
36 Accept non-match std U8 RW Processing strategy when the standard frame misses the filter
37 Accept non-match ext U8 RW Processing strategy when the extended frame misses the filter
38 Reject remote std U8 RW Whether to reject standard remote frames
39 Reject remote ext U8 RW Whether to reject extended remote frames
40 Ext ID mask U32 RW Extended ID global mask
41 Std list max U8 RO Maximum number of standard filters, currently 64
42 Ext list max U8 RO Maximum number of extended filters, currently 24

Filter editing window:

SI Name Type Access Description
43 Std current index U8 RW Current standard filter index
44 Ext current index U8 RW Current extended filter index
45 Std entry cmd U8 RW Execute command on the current standard filter index
46 Ext entry cmd U8 RW Execute command on the current extended filter index
47 Std entry status U8 RO Standard filter command result
48 Ext entry status U8 RO Extended filter command result
49 Std filter count U8 RW Number of valid standard filters
50 Std filter type U8 RW Standard filter type
51 Std filter action U8 RW Action after a standard-frame filter hit
52 Std filter sync U8 RW Standard-frame sync message tag
53 Std ID1 U32 RW Standard filter ID1
54 Std ID2 U32 RW Standard filter ID2
55 Ext filter count U8 RW Number of valid extended filters
56 Ext filter type U8 RW Extended filter type
57 Ext filter action U8 RW Action after an extended-frame filter hit
58 Ext filter sync U8 RW Extended-frame sync message tag
59 Ext ID1 U32 RW Extended filter ID1
60 Ext ID2 U32 RW Extended filter ID2

Entry cmd

value description
0 no-op
1 load current, read the current index entry into the editing window
2 save current, write the editing window to the current index
3 clear current, disable the current index entry
4 flash current, reserved; currently it is recommended to use channel Flash command to save uniformly

Entry status

value description
0 OK
1 index is invalid
2 command invalid

Typical filter configuration process:

  1. Read Std list max / Ext list max to confirm the capacity.
  2. Write Std filter count or Ext filter count.
  3. Write current index.
  4. Write filter type/action/sync/id1/id2.
  5. Write entry cmd = 2 to save the current index.
  6. Repeat to configure multiple entries.
  7. Write Apply command = 1 to make the channel configuration take effect.
  8. If you need to save when power off, write Flash command bit0 = 1.

RAM/FIFO/Buffer fields:

Note: the SI column below is decimal. Many master tools display subindices in hexadecimal. The commonly mentioned 0x41/0x42/0x44 are decimal 65/66/68, corresponding to the RX FIFO0, RX FIFO1, and RX Buffer element data sizes. These fields only define the maximum data bytes stored in one MCAN Message RAM element. They do not define the CAN FD DLC inside a PDO packet; the actual DLC is still carried by the frame packet in RxPDO/TxPDO.

SI decimal SI hex Name Type Access Recommended default Description
61 0x3D RX FIFO0 op mode U8 RW 0 FIFO0 operation mode, 0=blocking. When full, new frames do not overwrite old frames; observe diagnostics counters
62 0x3E RX FIFO0 size U8 RW 48 Number of FIFO0 elements; normally used for common receive frames
63 0x3F RX FIFO1 op mode U8 RW 0 FIFO1 operation mode, 0=blocking
64 0x40 RX FIFO1 size U8 RW 12 Number of FIFO1 elements; can be used with filters for selected frames
65 0x41 RX FIFO0 data size U8 RW 7 FIFO0 element data size enumeration; use 7 for 64B CAN FD
66 0x42 RX FIFO1 data size U8 RW 7 FIFO1 element data size enumeration; use 7 for 64B CAN FD
67 0x43 RX buffer count U8 RW 12 Number of RX buffer elements; used directly only when filters route to RXBUF
68 0x44 RX buffer data size U8 RW 7 RX buffer element data size enumeration; use 7 for 64B CAN FD
69 0x45 TX FIFO queue mode U8 RW 0 0=FIFO, 1=Queue; Queue is sorted by CAN ID arbitration priority
70 0x46 TX FIFO queue size U8 RW 32 Number of TX FIFO/Queue elements; current recommendation is to use TX FIFO for all TX resources
71 0x47 TX dedicated buffer count U8 RW 0 Number of dedicated TX buffers; current recommendation is 0 to avoid mixing with the FIFO path
72 0x48 TX buffer data size U8 RW 7 TX FIFO/Buffer element data size enumeration; use 7 for 64B CAN FD
73 0x49 TX event FIFO size U8 RW 32 Number of TX Event FIFO elements; recommended not less than TX FIFO/Queue count

data size uses the HPM MCAN driver enumeration and is not the byte value itself. Common values are:

Enum Maximum data bytes Typical use
0 8B Classic CAN, or minimal RAM setup for 8B CAN FD only
1 12B CAN FD 12B
2 16B CAN FD 16B
3 20B CAN FD 20B
4 24B CAN FD 24B
5 32B CAN FD 32B
6 48B CAN FD 48B
7 64B CAN FD 64B, current recommended default

The Message RAM budget is determined by both element counts and data size. The general CAN FD default is RXFIFO0=48, RXFIFO1=12, RXBUF=12, TXFIFO=32, TXBUF=0, TXEVENT=32, data size=7. Classic CAN may reduce data size to 0 to save RAM for more elements. If the configuration is illegal or exceeds the per-channel Message RAM budget, Apply status reports an error and the runtime channel does not switch to the new layout.

Timestamp/TSU/Timeout fields:

SI Name Type Access Description
74 Timestamp selection U8 RW MCAN timestamp selection, 0..2
75 Timestamp prescaler U8 RW MCAN timestamp prescaler
76 TSU enable U8 RW Enable TSU
77 TSU use external timebase U8 RW Use external timebase
78 TSU capture on SOF U8 RW SOF capture
79 TSU enable 64-bit U8 RW 64 bit TSU
80 Pad2 U8 RO Reserved
81 TSU prescaler U16 RW TSU prescaler, min 1
82 TSU external timebase source U8 RW External time base source
83 TSU TBSEL option U8 RW TBSEL option
84 Timeout enable U8 RW Enable MCAN timeout
85 Timeout select U8 RW timeout select, 0..3
86 Pad3 U16 RO Reserved
87 Timeout period U16 RW timeout period

TDC Strategy:

  • CAN FD default TDC enable=1.
  • When the data segment is less than 5M, the master can turn off TDC through SDO.
  • When the data segment reaches 5M or more, the firmware ignores TDC enable=0 and forcibly turns on TDC.
  • TDC offset/filter defaults to 0, which means it is automatically calculated by the HPM MCAN driver according to the actual data segment timing.
  • TDC offset/filter that is not 0 is still retained by the firmware and distributed to the MCAN driver for debugging by on-site experts.
  • It is recommended to configure offset/filter in pairs when manually overwriting.

13.5 0x9000..0x9003 MCAN Channel Information

These objects are RO and use the S2M direction. The master reads them when it needs detailed channel status beyond the compact PDO header state.

SI Name Type Access Description
1 ECR raw U32 RO Error count register
2 PSR raw U32 RO Protocol status register
3 IR raw U32 RO Interrupt bit snapshot
4 RXF0S raw U32 RO RX FIFO0 status
5 RXF1S raw U32 RO RX FIFO1 status
6 TXFQS raw U32 RO TX FIFO/Queue status
7 TXEFS raw U32 RO TX Event FIFO status
8 HPMS raw U32 RO High priority message status
9 PDO channel status U16 RO Status word with the same semantics as the PDO header
10 RX pending count U16 RO Not saturated RX pending
11 TX pending count U16 RO Not saturated TX pending
12 Channel event flags U16 RO latched warning/busoff/pressure/state-change
13 RX dropped counter U32 RO PDO frame dropped count before packaging
14 TX backpressure counter U32 RO TX queue full/backpressure count
15 Bus off counter U32 RO BusOff migration count
16 Detail sequence U32 RO Detail snapshot change sequence number

13.6 0xA000..0xA003 MCAN Register Service

0xA000..0xA003 respectively correspond to the register access services of MCAN0..MCAN3. This object is used for on-site diagnosis and expert debugging, and it is not recommended for ordinary applications to access it periodically. Writing registers will be protected by a whitelist to avoid accidentally writing key addresses and causing bus abnormalities.

Object Channel
0xA000 MCAN0
0xA001 MCAN1
0xA002 MCAN2
0xA003 MCAN3
SI Name Type Access Description
1 Offset U32 RW MCAN register offset, allowed range 0x0004..0x0404
2 Command U8 RW 0=no-op, 1=read, 2=write
3 Status U8 RO Last command result
4 Write value U32 RW Value used by write command
5 Read value U32 RO The value returned by the read command
6 Timestamp low U32 RO Command execution timestamp low 32 bit
7 Timestamp high U32 RO Command execution timestamp high 32 bit

Status

value description
0 OK
1 offset invalid, the offset is not within the allowed range or is not 32 bit aligned
2 write denied, this register is not in the write whitelist
3 busy, service is busy
4 access denied, the current status or permission does not allow access

Write whitelist offset:

Offset Register Description
0x000C DBTP Data bit timing and prescaler
0x0010 TEST Test register
0x0014 RWD RAM watchdog
0x0018 CCCR CC control
0x001C NBTP Nominal bit timing and prescaler
0x0048 TDCR Transmitter delay compensation
0x0050 IR Interrupt flags, write 1 to clear
0x0054 IE Interrupt enable
0x0058 ILS Interrupt line select
0x005C ILE Interrupt line enable
0x0080 GFC Global filter configuration
0x0090 XIDAM Extended ID AND mask
0x00A8 RXF0A RX FIFO0 acknowledge
0x00B8 RXF1A RX FIFO1 acknowledge
0x00D0 TXBAR TX buffer add request
0x00D4 TXBCR TX buffer cancellation request
0x00F8 TXEFA TX event FIFO acknowledge

Read register process:

  1. Write Offset.
  2. Write Command = 1.
  3. Read Status, and when it is 0, read Read value.

Write register process:

  1. Verify that the device is in a state that allows debug access.
  2. Write Offset and Write value.
  3. Write Command = 2.
  4. Read Status. If it is 2, it means that the register can only be read or it is not recommended to write through SDO.

13.7 0xB000 Device Maintenance

SI Name Type Access Description
1 Access mode request U8 RW 0=run, 1=engineering, 2=factory
2 Access status U8 RO Current access status
3 Access timeout s U16 RW Engineering/Factory mode timeout
4 Maintenance command U8 WO save/load/factory reset/FoE validate/FoE activate/clear diag/EEPROM rebuild
5 Maintenance status U8 RO OK/busy/denied/crc error/image invalid/flash error
6 Legacy maintenance diag flags U16 RO Compatibility diagnostic flags, see table below
7 Active config CRC32 U32 RO Current configuration image CRC32
8 Stored config CRC32 U32 RO Saved configuration image CRC32
9 FoE image size U32 RO Recent FoE image size
10 FoE image CRC32 U32 RO Recent FoE CRC32
11 FoE status code U32 RO Device FoE status
12 Maintenance sequence U32 RO Maintenance command sequence number

Access mode request/status:

value mode description
0 run Default running mode
1 engineering Engineering debugging mode, which can open some maintenance functions
2 factory Factory maintenance mode

Maintenance command is a bit mask. bit0..4 are traditional maintenance commands. bit5/bit6 are standalone commands and must be written alone, not combined with other bits.

Bit Description
0 Save current configuration to Flash
1 Load configuration from Flash
2 Restore factory default configuration
3 FoE image validate
4 FoE image activate
5 Clear runtime diagnostics and legacy diagnostic flags
6 Erase ESC EEPROM emulation area and reboot; firmware rebuilds EEPROM from the current object dictionary after restart

Legacy maintenance diag flags:

Bit Name Description
0 SHADOW_FALLBACK TxPDO shadow safe publish entered fallback
1 SHADOW_COPY_RETRY TxPDO shadow copy retry occurred
2 SHADOW_SIZE_CHANGE TxPDO shadow detected size change while publishing
3 RXPDO_STAGE_DROP RxPDO stage dropped data
4 TX_RING_DROP TX ring dropped data
5 TX_FIFO_FULL MCAN TX FIFO/Queue full or not writable
6 SCHED_LATE_DROP Scheduled transmit dropped because target phase was already late
7 SCHED_QUEUE_FULL Scheduled transmit queue full
8 SCHED_TX_FAIL Scheduled transmit failed to submit to MCAN
9 SCHED_TIMER_MISS Scheduled timer service missed

Maintenance status Common values:

value description
0 OK
2 denied, the current access mode or status does not allow execution

Maintenance sequence is incremented after the maintenance command is completed. When the master executes a maintenance command, it should first record the old sequence, and then poll the sequence changes and status after writing the command.

13.8 0xF000 Device Objects

The master must read the 0xF000 capability object before selecting the PDO profile.

The object is RO and the direction is S2M. It is used by the master to identify the device capabilities, version and protocol upper limit.

SI Name Type Access Default Description
1 Device type U8 RO runtime OTA package header device[31:24], used to distinguish product/device type: 0=ECAN-Lite; non-zero means a customized version
2 Channel count U8 RO 4 MCAN channel count
3 Capability version U16 RO 0x0001 Capability object version
4 Hardware revision U32 RO runtime OTP word 73; valid only when OTP word 72 is 0x4543414E (ECAN), otherwise 0
5 Firmware version major U16 RO runtime OTA package header version[31:16]; the high byte is major and the low byte is minor
6 Firmware version minor U16 RO runtime OTA package header version[15:0], keep build/date low 16 bits intact
7 Serial number low U32 RO runtime OTP word 74; valid only when OTP word 72 is 0x4543414E (ECAN), otherwise 0
8 Serial number high U32 RO runtime OTP word 75; valid only when OTP word 72 is 0x4543414E (ECAN), otherwise 0
9 PDO header version mask U16 RO 0x0002 Support header version 1

PDO capabilities and upper limits:

SI Name Type Access Default Description
10 PDO size multiplier min U8 RO 1 Minimum N
11 PDO size multiplier max U8 RO 24 maximum N
12 Encapsulation profile mask U32 RO 0x00000033 Support profile 0/1/4/5
13 Max PDO bytes U16 RO 3072 Maximum PDO in one direction
14 Max CAN channels U8 RO 4 Maximum number of CAN channels
15 PDO option flags mask U8 RO 0x1F Support TX_RESULT, ALIGN4, NO_CRC16, APP_BYPASS, PAYLOAD_ONLY
16 PDO feature flags U32 RO 0x00001F3B Support TX_RESULT, delta16, full64, D64, ALIGN4, RxPDO TSF scheduled sending, NO_CRC16, APP_BYPASS, PAYLOAD_ONLY, FINE_BYPASS
17 PDO size unit bytes U16 RO 128 PDO granularity
18 PDO fixed header bytes U16 RO 24 Fixed header length
19 Device service flags U32 RO 0x15 FoE, persistent parameters, access levels
20 Object extension set U16 RO 1 Object extension set version
21 Data path extension set U16 RO 1 Data-path extension set version
22 Diagnostic extension set U16 RO 1 Diagnostic extension set version
23 Reserved capability pad U16 RO 0 Reserved
24 Data path feature flags U32 RO 0x0000001F Supports the 0x8030 TX/RX bypass, CRC policy, payload-only, and app bypass diagnostic capabilities
25 Diagnostic feature flags U32 RO 0x0000001F Diagnostic test capability bits, same meaning as data path feature flags
26 Runtime option flags mask U32 RO 0x00000000 Runtime option mask; no public runtime option is exposed currently
27 Diagnostic option flags mask U32 RO 0x00000000 Diagnostic option mask; no public diagnostic option is exposed currently
28 MCAN RX cache max depth U16 RO 32 Firmware RX cache maximum depth
29 MCAN TX cache max depth U16 RO 64 Firmware TX cache maximum depth
30 Max service budget us U16 RO 1000 Data-path service budget upper limit
31 Reserved capability0 U16 RO 0 Reserved
32 Reserved capability1 U32 RO 0 Reserved

Encapsulation profile mask

Bit Profile Description
0 0 compact inline, variable DLC, no timestamp
1 1 compact inline, variable DLC, allow delta16
4 4 compact inline, D64 allowed, no timestamps
5 5 compact inline, D64 allowed, delta16 allowed

PDO option flags mask

Bit Name Description
0 TX_RESULT_ENABLE TxPDO can generate a send result packet
1 ALIGN_4_ENABLE Frame packets are aligned by 4 bytes
2 NO_CRC16_ENABLE Disable fixed-header CRC16 for performance isolation tests
3 APP_BYPASS_ENABLE Bypass the real MCAN application data path for protocol/PDI efficiency tests
4 PAYLOAD_ONLY_ENABLE Reduce full-PDO clearing on stable layouts; update only header and valid payload

PDO feature flags

Bit Name Description
0 TX_RESULT Support TX_RESULT frame packet
1 TSF_DELTA16 Supports 16 bit delta timestamp
2 TSF_DELTA32 The ability bit definition is reserved; the current default ability value is not set
3 TSF_FULL64 Support 64 bit timestamp field
4 D64 Support fixed 64B data window
5 ALIGN4 Supports 4-byte alignment
6 STREAM_CRC32 Extended whole-stream CRC32 capability; current default capability value is not set
8 RX_TSF_SCHEDULE_TX Support RxPDO TSF_FULL64 format=1 scheduled sending
9 NO_CRC16 Support disabling fixed-header payload CRC16
10 APP_BYPASS Support bypassing the PDO application data path
11 PAYLOAD_ONLY Support payload-only updates for stable layouts
12 FINE_BYPASS Support fine-grained bypass test bits for locating RxPDO/TxPDO/MCAN sub-path overhead

Device service flags

Bit Description
0 Support FoE firmware update
2 Support configuration persistence saving/loading
4 Support access level/project mode control

RxPDO reserves the TSF_FULL64 field of the multiplexed dynamic frame and does not change the ordinary CAN frame packet structure:

text
format:u8 = 1
flags:u8 = 0
tag:u16
offset_ns:u32

TSF_NONE is still sent immediately; TSF_FULL64 format=1 means offset_ns phase sending is reserved for the next SYNC0 cycle. The same phase is queued in PDO frame order.

Reservation delivery implementation constraints:

  • The master must first confirm the RxPDO TSF reserved transmission capability bit in 0xF000:16 (0x10).
  • offset_ns takes the current EtherCAT DC/SYNC0 cycle as a reference. It is recommended to use 100000ns or a larger conservative phase for bring-up first.
  • The device schedules reserved frames according to the SYNC0 phase; frames that have exceeded the target phase will not be retransmitted across cycles, and the master should reserve sufficient offset_ns margin.
  • Scheduled sending and direct sending share the CAN sending path; when the channel is congested or sending is abnormal, feedback is provided through PDO status and SDO diagnostic count.
  • When the master is stopped, the ESC process data area may keep the last frame of RxPDO image; the firmware treats the exact same repeated image as idempotent no-op and does not record it as a real parsing error.

13.9 Comparison of real-time performance between scheduled delivery and direct delivery

The reservation sending effect depends on the certainty of the master cycle itself. If the master application uses ordinary usleep() relative delay, the 1ms/2ms cycle will accumulate application execution time and Linux wake-up jitter, and a long tail will appear in the CAN side packet capture. IgH example igh_mcan_gateway_tx_probe has been changed to absolute time period and supports:

text
--rt-priority 80 --spin-us 100

Among them, --rt-priority sets the periodic thread to SCHED_FIFO, and --spin-us indicates the short spin alignment target time after sleeping N microseconds before the deadline. master_period will be output at the end of the example. You should first confirm that the master cycle is stable, and then evaluate the real-time performance of the CAN side.

The following data comes from a lab reference test: a physical Linux IgH master, one ECAN-Lite slave, one MCAN channel connected to a CAN analyzer, PDO=3, which is 384B, CAN FD+BRS, payload 16B, sending 1000 frames, and the CAN analyzer saves the timestamps of the first 1200 frames.

Mode Master cycle statistics CAN reception quantity CAN cycle min/max p95 p99 Error
1ms direct sending, RT+100us spin min/max 944.384/1055.631us, max error 55.631us 999/1000 209/1859us 1036us 1570us order 1
1ms reservation 100us, RT+100us spin min/max 999.929/1000.070us, max error 0.071us 1000/1000 944/1032us 1009us 1012us 0
2ms direct sending, RT+100us spin min/max 1983.681/2016.318us, max error 16.319us 1000/1000 1579/2493us 2016us 2081us 0
2ms reservation 100us, RT+100us spin min/max 1995.795/2004.197us, max error 4.205us 1000/1000 1986/2014us 2009us 2012us 0

Conclusion: Direct transmission is suitable for ordinary functional testing. The CAN transmission time will follow the PDO arrival and firmware processing time; when the master cycle converges, reserving 100us can stabilize the CAN release phase to the fixed window after SYNC0. When stable real-time output is required, it is recommended to use scheduled sending and record the master master_period and CAN analyzer timestamps at the same time.


14. Configuration process

  1. The master enters PREOP/SAFEOP.
  2. Read the 0xF000 capability object.
  3. Configure 0x1C12/0x1C13 and select the first N 128B chunks.
  4. Write 0x8010/0x8011 requested profile.
  5. Write 0x8010:1 = 1 and 0x8011:1 = 1 application profiles.
  6. Read ActivePDOBytes / ActiveFrameAreaBytes / ActiveLayoutCrc / ActiveProfileWord.
  7. Write 0x8001..0x8004 CAN parameters and Apply command=1 for each enabled channel.
  8. Enter OP.
  9. In the OP, data is only sent and received through PDO; if an error is encountered, SDO details are read as needed.

14.2 Switch PDO size

PDO size affects SM2/SM3 length and must be completed during INIT/PREOP/SAFEOP. Changing active PDO size, channel mask, profile, budget or option flags is not allowed in the OP.

text
1. Return SAFEOP/PREOP from OP
2. Modify 0x1C12/0x1C13 assignment chunk count
3. Write 0x8010/0x8011 PDO size multiplier
4. Apply profile
5. Verify active readback
6. Re-enter OP

If the assignment chunk count is inconsistent with PdoSizeMultiplier, the device returns Status=5 master mapping reload required and keeps the old active profile.

14.3 CAN FD 5M configuration recommendations

text
FD enable       = 1
Nominal bitrate= 1000000
Data bitrate   = 5000000
TDC enable     = 1
TDC offset     = 0
TDC filter     = 0
RX/TX data size= 64B
Apply command  = 1

IgH demo writes TDCEnable=1, TDCOffset=0, TDCFilter=0 to the CAN FD channel by default. 5M and above, even if the master writes TDCEnable=0, the firmware will be forced to open.


15. IgH master integration guide

The IgH master sample package can directly reuse the PDO protocol layer, or run the 10-axis CiA402 demo for system bring-up. The sample commands are based on relative paths after entering the extracted IgH sample package directory.

15.1 Code level

The IgH sample package is split into three layers based on responsibilities. Customer applications usually only need to select a top-level entry, and the lower levels are continued to be reused within the library.

Level File Suitable scene Description
Adapter include/igh_adapter.h, src/igh_adapter.c Only requires EtherCAT raw PDO or custom protocol Responsible for master/per-slave domain, PDO registration, startup SDO, DC Sync0 and OP status
MCAN Port include/igh_mcan_port.h, src/igh_mcan_port.c EtherCAT to CAN/CAN FD general application Responsible for MCAN configuration, PDO encapsulation analysis, CAN/CAN FD immediate delivery and scheduled delivery
CiA402 Protocol include/igh_cia402_protocol.h, src/igh_cia402_protocol.c CANopen/CiA402 Motor Control Packaging NMT, SDO, RPDO, TPDO, SYNC and CSP on MCAN Port bring-up
Public definition include/igh_ecan_common.h All levels Unified return value, default period, PDO constant, MCAN channel enumeration
API documentation API.md Secondary development Recommended entry, minimum process and necessary function table are given

The sample program is only used for bring-up and regression testing. It is not recommended that customer business programs directly copy the demo main function. Recommended reuse library interface:

Example Function
examples/simple_loop.c MCAN Port Minimum CAN Transceiver Skeleton
examples/cia402_single_axis_demo.c Single axis CiA402 bring-up
examples/cia402_10axis_demo.c Multi-axis CiA402 and multi-slave pressure verification

15.2 Linux environment preparation

It is recommended to run IgH on a physical Linux host. If a virtual machine is used, it is only recommended for early enumeration and function bring-up; the stable cycle and DC behavior should be based on the physical machine results.

Basic dependencies:

text
sh
sudo apt update
sudo apt install -y git build-essential cmake autoconf automake libtool \
  pkg-config linux-headers-$(uname -r)

IgH EtherCAT master needs to enable generic driver and hrtimer:

text
sh
git clone https://gitlab.com/etherlab.org/ethercat.git
cd ethercat
./bootstrap
./configure --prefix=../ethercat-install \
  --sysconfdir=../ethercat-install/conf \
  --enable-generic \
  --enable-hrtimer
make -j$(nproc) all modules
sudo make modules_install install
sudo depmod

Configure the EtherCAT dedicated network port according to the IgH installation instructions, for example, bind master0 to enp4s0 and use the generic driver module. After the configuration is complete, restart the master and confirm that the slaves can be enumerated:

text
sh
sudo systemctl restart ethercat
sudo ethercat slaves

15.3 Building the IgH sample package

Basic build commands:

text
sh
cmake -S . -B build
cmake --build build

Default ECAN_IGH_BUILD_DEMO=AUTO. If CMake finds ecrt.h and libethercat, it will build libecan_mcan_host.a, libecan_igh_host.a, igh_simple_loop, igh_canopen_sdo_probe, igh_cia402_single_axis_demo, and igh_cia402_10axis_demo; if no IgH development files are found, it will just build ecan_mcan_host protocol static library, the configuration process will not fail.

If using the local IgH build directory:

text
sh
cmake -S . -B build \
  -DECRT_INCLUDE_DIR=../ethercat/include \
  -DECRT_LIBRARY=../ethercat/lib/.libs/libethercat.so
cmake --build build -j$(nproc)

If you only need the protocol static library, do not build the IgH demo:

text
sh
cmake -S . -B build -DECAN_IGH_BUILD_DEMO=OFF
cmake --build build

If you need to force the demo to be built:

text
sh
cmake -S . -B build -DECAN_IGH_BUILD_DEMO=ON
cmake --build build

15.3.1 Firmware update using IgH FoE OTA

ECAN-Lite supports EtherCAT FoE writing packaged application firmware. The FoE target file name on the device side is fixed to ecan_lite_app, and the default password is 0. The master can complete the update using the ethercat command that comes with IgH, and does not rely on the demo in this directory.

Preparation conditions:

Projects Requirements
Firmware file Use the packaged ecan_lite_v*.bin, not the bare app bin
FoE file name ecan_lite_app
FoE password 0
Slave position The example defaults to updating the slave selected by the current IgH command. Single slave system is usually position 0
EtherCAT status It is recommended that the slave is online and the mailbox is available. Usually PREOP/SAFEOP/OP can initiate FoE

Read the current version before updating:

text
sh
sudo /opt/etherlab/bin/ethercat upload -p 0 0x100A 0 --type string
sudo /opt/etherlab/bin/ethercat upload -p 0 0xF000 5 --type uint16
sudo /opt/etherlab/bin/ethercat upload -p 0 0xF000 6 --type uint16

Write firmware:

text
sh
sudo /opt/etherlab/bin/ethercat foe_write \
  -p 0 \
  -o ecan_lite_app \
  /tmp/ecan_lite_v140494.bin

-p 0 in the above command is the FoE password, and -o ecan_lite_app is the target file name on the device side. If the on-site IgH tool version uses different options for slave position, password or remote file name, ethercat foe_write --help should prevail; the core parameters remain unchanged: target slave, password=0, remote file name ecan_lite_app, local packaged firmware path.

Common mistakes:

Phenomenon Cause and treatment
Password invalid password is not 0, or the command parameters confuse position/password
FoE OTA verify failed Firmware is not in packaging format, header verification failed, version/signature/CRC mismatch
file write fail Flash erasing or writing failed, check the power supply, slave status and firmware space
The version has not changed after writing The slave has not been reset or the master has not rescanned, wait for the device to automatically reset and then reread the version

After a successful update, the firmware writes to the free APP partition and requests a reset. After waiting for the slave to come back online, rescan and confirm the version:

text
sh
sudo systemctl restart ethercat
sudo /opt/etherlab/bin/ethercat slaves
sudo /opt/etherlab/bin/ethercat upload -p 0 0x100A 0 --type string
sudo /opt/etherlab/bin/ethercat upload -p 0 0xF000 5 --type uint16
sudo /opt/etherlab/bin/ethercat upload -p 0 0xF000 6 --type uint16

15.4 Secondary development interface

During secondary development, choose the abstraction layer first, and do not expose all functions to business code. For complete instructions, see API.md in the example package:

Application goals Recommended entrance Business side needs to be concerned
Only operates EtherCAT process data Adapter Number of slaves, PDO size, raw RxPDO/TxPDO buffer
Ordinary CAN/CAN FD transceiver MCAN Port Channel, CAN ID, DLC, data, immediate transmission or scheduled transmission
CANopen/CiA402 Motor CiA402 Protocol Axis table, NodeID, startup process, target position and status

Conventional CAN/CAN FD gateway applications preferentially use the MCAN Port layer. Business code should give priority to calling flat interfaces igh_mcan_port_send_can(), igh_mcan_port_send_canfd(), igh_mcan_port_schedule_can() and igh_mcan_port_receive() without constructing igh_mcan_tx_frame_t first. In this way, the call chain is the shortest. User data is only copied once when writing to the RxPDO frame area. At the same time, details such as PDO header, CRC, frame boundary, TxPDO parsing errors, etc. are still encapsulated by the library:

text
c
igh_mcan_tx_frame_t tx;
igh_mcan_rx_frame_t rx[32];
size_t rx_count = 0;
uint8_t data[8] = {0, 1, 2, 3, 4, 5, 6, 7};

igh_mcan_tx_frame_set_can(&tx, 0, 0, 0x123, 0, data, sizeof(data));
igh_mcan_port_exchange(&mcan, &tx, 1, rx, 32, &rx_count);

When periodic real-time control is required, it is recommended to use igh_mcan_port_cycle_begin(), igh_mcan_port_receive(), igh_mcan_port_send_can/canfd(), igh_mcan_port_schedule_can/canfd(), and igh_mcan_port_cycle_end() to form a fixed period. igh_mcan_tx_frame_set_*(), igh_mcan_port_send() and igh_mcan_port_exchange() are reserved only for batch sending, bring-up, test scripts or legacy code compatibility.

Minimal CAN transceiver example:

text
sh
sudo ./build/igh_simple_loop

CANopen SDO probing example:

text
sh
sudo ./build/igh_canopen_sdo_probe \
  --node 1 \
  --index 0x1000 \
  --sub 0 \
  --bitrate 1000000

15.5 IgH integration process without demo

If the customer does not run igh_simple_loop or igh_cia402_*_demo, but integrates ECAN-Lite in its own master application, it is recommended to still reuse the three-layer interface in the IgH sample package. The demo is just a runnable sample. The process that really needs to be transplanted into the client program should be divided into four parts: "master configuration, MCAN channel configuration, periodic send/receive, and business protocol processing".

Access method Applicable scenarios Description
MCAN Port API General EtherCAT to CAN/CAN FD application Recommended method. The application only configures the number of slaves, PDO size, channel, and baud rate, and then uses igh_mcan_port_send_can() and igh_mcan_port_receive() to send and receive CAN frames.
CiA402 Protocol API EtherCAT to CANopen control motor Continue to reuse igh_cia402_protocol on the MCAN Port API. The application is responsible for the axis table and motion strategy, and there is no need to spell NMT, SDO, RPDO, and SYNC messages by yourself.
Raw PDO API Customers need to fully customize PDO payload Advanced way. The application directly obtains the RxPDO/TxPDO byte buffer and encapsulates and parses it according to the PDO format in Chapter 5.

For general projects, MCAN Port API is preferred. In this way, even if you don't use the demo, you can avoid copying the long process of the demo into the business code.

15.5.2 Configuring an IgH application from scratch

Step 1: Scan the EtherCAT topology to confirm the slave location of ECAN-Lite.

text
sh
sudo ethercat slaves

Step 2: Select PDO size, period and channel. For first debugging, start with 1 slave, 1 MCAN channel, and cycle_us=10000. Use pdo-n=3 for classic CAN or CiA402/CANopen motor scenarios, and use pdo-n=8 for CAN FD, especially 64B payloads or multi-channel bursts. After OP and CAN transceiver are stable, increase the slave count, channel count and cycle pressure.

Step 3: Create IgH generic configuration.

text
c
ecan_igh_config_t igh_config;
ecan_igh_default_config(&igh_config);
ecan_igh_config_set_slave_count(&igh_config, 1);
ecan_igh_config_set_cycle_us(&igh_config, 10000);
ecan_igh_config_set_pdo_multiplier(&igh_config, 3); /* 3 * 128B */

When there are multiple slaves and the PDO sizes are different, use ecan_igh_config_set_slave_pdo_multiplier() to configure them separately. For example, the first two slaves use N=6, and the third slave can use N=3 when only two channels of MCAN are enabled.

Step 4: Create the MCAN channel configuration and write to the startup SDO queue.

text
c
igh_mcan_port_config_t mcan_config;
igh_mcan_port_default_config(&mcan_config);
igh_mcan_port_set_channel_mask(&mcan_config, 0, 0x01, 0x00);
igh_mcan_port_set_classic_channel(&mcan_config, 0, 0, 1000000);
igh_mcan_port_apply_config(&igh_config, &mcan_config);

The IgH general layer will register the first N PDO chunks according to PDO multiples and configure 0x1C12/0x1C13. igh_mcan_port_apply_config() will append the startup SDO required for ECAN-Lite operation, including the PDO profile, channel mask, PDO length of 0x8010/0x8011, and the MCAN baud rate and CAN FD parameters of 0x8001..0x8004.

Step 5: Initialize the master and MCAN Port, and wait for the slave to enter OP.

text
c
ecan_igh_context_t igh;
igh_mcan_port_t mcan;

ecan_igh_init(&igh, &igh_config);
igh_mcan_port_init(&mcan, &igh, &mcan_config);
ecan_igh_wait_op_timeout(&igh, 10000);

Step 6: Complete an EtherCAT/CAN exchange during the application cycle.

text
c
uint8_t data[8] = {0};
igh_mcan_rx_frame_t rx[32];
size_t rx_count = 0;

igh_mcan_port_cycle_begin(&mcan);
igh_mcan_port_receive(&mcan, rx, 32, &rx_count);
igh_mcan_port_send_can(&mcan, 0, 0, 0x123, 0, data, sizeof(data));
igh_mcan_port_cycle_end(&mcan);

Step 7: Add real-time configuration to the periodic thread. On Linux, it is recommended to set up at least SCHED_FIFO, mlockall(), fixed running CPU, and place the IgH main service and network card interrupt on the planned RT core. The period can be used first as 5ms or 2ms, and then evaluated as 1ms after stabilization.

Step 8: Add runtime checks. Domain working counter, ecan_igh_domain_is_complete(), slave OP status, MCAN Port parsing error and TxPDO header should be monitored every cycle. When domain_complete=0 appears, do not continue to advance the motion target. Keep the output of the previous cycle or enter the safe stop logic.

15.5.3 Manual configuration when not using MCAN Port API

In Raw PDO mode, the application needs to complete two types of work by itself:

  1. PDO mapping selection: According to the rules in Chapter 5, add the RxPDO/TxPDO chunk to 0x1C12/0x1C13. Each chunk is 128B, pdo-n=N means selecting 0x1600..0x160(N-1) and 0x1A00..0x1A(N-1).

  2. ECAN-Lite operating parameters: write 0x8010/0x8011 and 0x8001..0x8004. The minimum configuration should include channel mask, PDO length, profile and nominal/data bitrate for each MCAN channel. After the configuration is completed, read the active profile and status through 0x8010:02 (0x02), 0x8011:02 (0x02) or 0x9000 to confirm that the firmware has taken effect as expected.

During Raw PDO periodic exchange, use the following interface to get the buffer:

text
c
uint8_t *rxpdo = NULL;
const uint8_t *txpdo = NULL;
size_t rxpdo_size = 0;
size_t txpdo_size = 0;

ecan_igh_get_rxpdo_buffer(&igh, slave_index, &rxpdo, &rxpdo_size);
ecan_igh_get_txpdo_buffer(&igh, slave_index, &txpdo, &txpdo_size);

rxpdo is the data output by the master to ECAN-Lite, and txpdo is the data returned by ECAN-Lite to the master. It is recommended to still use igh_mcan_pdo_writer_* and igh_mcan_pdo_parse_frames_ex() to assist in encapsulation/parsing to avoid repeated implementation of PDO header, CRC, offset and frame boundary processing by customer applications.

15.5.4 Control the motor without using CiA402 demo

The motor project also does not have to run igh_cia402_single_axis_demo or igh_cia402_10axis_demo directly. Client applications can reuse protocol layers:

  1. First press 15.5.2 to complete IgH and MCAN Port initialization.
  2. Use igh_cia402_axis_init() to create an axis table, describing the slave, MCAN channel, NodeID and target step of each motor.
  3. Use igh_cia402_context_init() to bind MCAN Port and axis table.
  4. In the startup phase, call igh_cia402_send_nmt_all(), igh_cia402_configure_csp_all_timeout(), igh_cia402_request_actual_position_all_timeout(), igh_cia402_enable_all() to complete NMT, CSP mapping, actual position reading and CiA402 enablement.
  5. In the motion cycle, call igh_cia402_process_rx() to process TPDO/SDO/heartbeat, and then call igh_cia402_send_targets_all() or igh_cia402_send_target_step() to send the target position.
  6. If you need to schedule sending, enable DC Sync0 first, and then call igh_cia402_set_scheduled_tx(); the RPDO target and SYNC can be scheduled independently.

In this way, the demo is only used as a bring-up and regression testing tool, and the customer's own program can still use the same startup, sending and receiving, diagnosis and reservation capabilities.

15.6 Run CiA402 demo

The single-motor bring-up example uses slave 0, MCAN0, NodeID 1, and 1Mbps by default; for the first bring-up, it is recommended to explicitly use --step 0 to avoid active movement:

text
sh
sudo ./build/igh_cia402_single_axis_demo \
  --bitrate 1000000 \
  --cycle-us 10000 \
  --cycles 20 \
  --step 0

For single-board CAN FD or full-capacity bring-up, explicitly use a 1024B PDO, a longer period and 1 slave. For classic CAN/CiA402 bring-up, normally keep --pdo-n 3:

text
sh
sudo ./build/igh_cia402_10axis_demo \
  --slaves 1 \
  --pdo-n 8 \
  --cycle-us 10000 \
  --cycles 10000

After the system is stable, shorten the period, for example 1ms:

text
sh
sudo ./build/igh_cia402_10axis_demo \
  --slaves 1 \
  --pdo-n 3 \
  --cycle-us 1000 \
  --cycles 10000 \
  --dc-sync0 \
  --dc-cycle-us 1000 \
  --dc-shift-us 700

Commonly used parameters:

Parameters Description
--slaves N Number of ECAN-Lite slaves participating in the demo, default 3
--pdo-n 1..24 PDO size multiplier, total bytes are 128*N; start CiA402/classic CAN from 3, and start CAN FD from 8
--cycle-us N EtherCAT process data cycle
--cycles N Number of demo running cycles
--motion-div N The 10-axis demo target frame is sent at reduced frequency; the default is 1, which means it is sent once per EtherCAT cycle. When set to 2, the CAN target frame period is 2 times the EtherCAT cycle
--profile N PDO package profile
--align4 Frame packets are aligned by 4 bytes
--skip-sdo-config Skip starting SDO configuration, suitable for repeated debugging
--dc-sync0 Enable DC Sync0
--dc-cycle-us N DC Sync0 period; default follows --cycle-us
--dc-shift-us N DC Sync0 shift; it needs to be combined with OP stability adjustment on the physical machine

During the startup phase, the demo will write the PDO profile, channel configuration and CAN FD TDC default value. TDCOffset=0 and TDCFilter=0 indicate that the firmware automatically calculates according to the data segment timing; when the data segment reaches 5M or more, the firmware forcibly enables TDC.

15.6.1 IgH Three-slave Reference Stable Points

The following points are current reference long-test results with the productized IgH adapter using per-slave domains, three slaves, CRC16 enabled by default, base mode, root execution, SCHED_FIFO, and CPU affinity. Short tests should only be used to screen candidate phases; product configurations should be based on 2-minute or longer runs.

Mode Cycle PDO configuration Recommended shift Result
SM/free 1ms 384B / 512B / 640B No DC shift 2-minute stable point
SM/free 2ms 768B / 1280B No DC shift 2-minute stable point
DC Sync0 1ms 384B 700us or 800us 2-minute stable point
DC Sync0 1ms 512B 0us 2-minute stable point
DC Sync0 1ms 640B 450us / 650us / 800us 2-minute stable point
DC Sync0 2ms 768B 600us 2-minute stable point
DC Sync0 2ms 1280B 1600us 2-minute stable point

These results are reference boundaries rather than guarantees for every host, NIC, and cable combination. When expanding to a larger PDO or heavier real CAN traffic, monitor WKC, OP state, TxPDO header, 0x9011 cycle diagnostics, and 0x9020..0x9023 per-channel data-path diagnostics together.

15.7 SII/EEPROM and SM layout check

The device EEPROM/SII must maintain a large PDO single buffer layout, otherwise IgH OP/DC operation will be disrupted by incorrect SM configuration:

Projects Requirements
SM2 Outputs Start 0x1100, Size 3072, ControlByte 0x66
SM3 Inputs Start 0x1D00, Size 3072, ControlByte 0x22
PDO chunk 0x1C12/0x1C13 Select the first N 128B chunks

Manual checking available with scripts:

text
sh
sudo scripts/ecan_sii_sm_layout.sh check \
  --ethercat ../ethercat-install/bin/ethercat \
  --position 0 \
  --pdo-bytes 3072

When repair is required, manual confirmation must be performed before execution:

text
sh
sudo scripts/ecan_sii_sm_layout.sh fix \
  --ethercat ../ethercat-install/bin/ethercat \
  --position 0 \
  --pdo-bytes 3072

16. Debugging and Diagnostics

16.1 OP exception

Priority checks:

  • Whether SM2/SM3 in EEPROM/SII is 0x1100/0x1D00, 3072B, 0x66/0x22.
  • Whether the 0x1C12/0x1C13 assignment quantity is consistent with 0x8010/0x8011 PDO size multiplier.
  • Whether the IgH adapter uses the per-slave domain/FMMU segmentation strategy; consider the large PDO/FMMU patch only for old examples or old masters.
  • Is DC shift too small? If the output data does not arrive before Sync0, it will cause WC miss or OP loss.

16.2 PDO parsing error

Check out:

  • 0x8010/0x8011 Status
  • LastPDOError
  • PDOErrorCounter
  • PDOOverflowCounter
  • IgH protocol layer parse_diag, including offset, packet_end, ctrl, seq, payload_len, payload_crc16, layout_id, ch, dlc, tsf, kind.

16.3 CAN bus abnormality

Check out:

  • channel_status in PDO header
  • ECR/PSR/IR/RXF0S/RXF1S/TXFQS/TXEFS for 0x9000..0x9003
  • Error count and terminating resistor status for external CAN tools
  • Are the baud rate, sampling point, TDC, and CAN FD BRS consistent with the peer end?

17. Verify result data

Verification environment:

item value
Main site Ubuntu 26.04 physical machine
EtherCAT port enp4s0
IgH 1.6.9
Slave ECAN-Lite, 1 unit
Item Result Data
--- ---
PDO configuration TxPDO/RxPDO are both 1024B
EtherCAT cycle 10ms
CAN FD configuration Arbitration segment 1Mbps, data segment 5Mbps, BRS on
Bidirectional CAN FD Communication Pass
PDO parsing error 0
Send discard 0
Bidirectional data error 0
Device recovery status Normal

18. Technical specifications

Parameters Specifications
Main Control HPMicro HPM5E00 Series RISC-V MCU
EtherCAT 2-port, 100Mbps, CoE/FoE
CAN 4-channel MCAN
CAN Protocol CAN 2.0A/B, CAN FD ISO
CAN FD data field Maximum 64B
Recommended PDO Start from 384B/direction for classic CAN; start from 1024B/direction for CAN FD
Max PDO 3072B/direction
PDO granularity 128B
PDO fixed header 24B
PDO package 2B control word + CAN ID + optional timestamp + Data
Standard ID Field 2B
Extended ID field 4B
timestamp/reservation packaging off / delta16, delta32/full64; RxPDO full64 format=1 for SYNC0 phase reservation
TDC turned on by default, forced to turn on for 5M and above
Parameter persistence Flash configuration image, CRC32
Firmware Maintenance FoE Support
CPU/mchtmr CPU 400MHz, mchtmr 24MHz

19. Revision history

Version Date Description
V2.2 2026-05 Added SYNC0 scheduled sending instructions, direct/scheduled sending real-time performance comparison, board-level clock and configuration default value instructions
V2.1 2026-04 Added IgH master integration guidance, PDF generation instructions and CANFD two-way data verification records
V2.0 2026-04 Rewritten as dynamic PDO two-layer encapsulation protocol, removing the old fixed slot description

Copyright (c) 2026 LanMotion.