通过示例解析 FSoE 帧结构
一字节安全数据:最简单的安全 PDU
该 PDU 仅包含一个安全数据实例,且只占用一个字节。
| 偏移 | 大小 | 名称 | 描述 |
|---|---|---|---|
| 0 | 1 byte | Command | 命令 |
| 1 | 1 byte | SafeData[0] | 安全数据,第 0 个字节 |
| 2 | 2 byte | CRC_0 | 16 位 CRC |
| 4 | 2 byte | Conn_Id | 唯一连接 ID |
所有多字节字段均以小端序存储。
FSoEShortestSafetyPDU.h
struct __attribute__((packed)) FSoEShortestSafetyPDU {
uint8_t Command;
uint8_t SafeData_0;
uint16_t CRC_0;
uint16_t Conn_Id;
};两字节安全数据
| 偏移 | 大小 | 名称 | 描述 |
|---|---|---|---|
| 0 | 1 byte | Command | 命令 |
| 1 | 1 byte | SafeData[0] | 安全数据,第 0 个字节 |
| 2 | 1 byte | SafeData[1] | 安全数据,第 1 个字节 |
| 3 | 2 byte | CRC_0 | 16 位 CRC |
| 5 | 2 byte | Conn_Id | 唯一连接 ID |
所有多字节字段均以小端序存储。
FSoETwoByteSafeDataPDU.h
struct __attribute__((packed)) FSoETwoByteSafeDataPDU {
uint8_t Command;
uint8_t SafeData_0;
uint8_t SafeData_1;
uint16_t CRC_0;
uint16_t Conn_Id;
};四字节安全数据
| 偏移 | 大小 | 名称 | 描述 |
|---|---|---|---|
| 0 | 1 byte | Command | 命令 |
| 1 | 1 byte | SafeData[0] | 安全数据,第 0 个字节 |
| 2 | 1 byte | SafeData[1] | 安全数据,第 1 个字节 |
| 3 | 2 byte | CRC_0 | 16 位 CRC 0 |
| 5 | 1 byte | SafeData[2] | 安全数据,第 2 个字节 |
| 6 | 1 byte | SafeData[3] | 安全数据,第 3 个字节 |
| 7 | 2 byte | CRC_1 | 16 位 CRC 1 |
| 9 | 2 byte | Conn_Id | 唯一连接 ID |
所有多字节字段均以小端序存储。
FSoEFourByteSafeDataPDU.h
struct __attribute__((packed)) FSoEFourByteSafeDataPDU {
uint8_t Command;
uint8_t SafeData_0;
uint8_t SafeData_1;
uint16_t CRC_0;
uint8_t SafeData_2;
uint8_t SafeData_3;
uint16_t CRC_1;
uint16_t Conn_Id;
};来源: ETG.5100 S (D) V1.2.0,Table 4: Shortest safety PDU 与 Table 3: General Safety PDU,可向 EtherCAT Technology Group (ETG) 申请获取
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow