前面文章有说,无论是CAN、CANFD、LIN、Ethernet、J1939等总线协议,都会绕不开一个上层应用话题,那就是UDS诊断;然而做过诊断模块测试的朋友都知道最烦的就是发送大量的诊断数据和接收大量的诊断数据问题,这些数据如何进行处理;自己写当然没有问题,不过如果是发送或者接收特定的报文函数还是比较容易实现,那如何实现适配任意的诊断命令的发送或者接收呢?这是个相当繁琐的问题,今天我们就介绍一下这块相关内容的,如何快速、便捷的实现诊断自动化数据的收发。
常见缩写
缩写 | 英文释义 | 中文释义 |
ISO | International Organization for Standardization. | 国际标准化组织。 |
ISO TP | Transport protocol for CAN according to ISO15765-2. Also called OSEK TP. | CAN 传输协议符合 ISO15765-3。 也称为 OSEK TP。 |
J1939 | SAE vehicle bus standard for communication and diagnostics. | 用于通信和诊断的 SAE 车辆总线标准。 |
OSEKTL | ISO TP API introduced with OSEK_TP.DLL. Still available in the current version. | ISO TP API 通过 OSEK_TP.DLL 引入。 在当前版本中仍然可用。 |
PDU | (Transport) Protocol Data Unit, one element of the TP transferred in one CAN message. | (传输)协议数据单元,在一条 CAN 消息中传输的 TP 的一个元素。 |
TP | ISO TP (cf. above) in this context. | ISO TP(参见上文)在此上下文中。 |
常见问题及解答
1、问题
正常模式连接可以使用扩展 CAN 消息 ID 吗?
回答
是的。 设置 Rx 和 Tx ID 值时,将 ID 的最高有效位设置为 1。
2、问题
在写入窗口中打印以下消息:Optional callback function … not found or invalid argument list!
回答
回调函数未在节点中定义,或者其签名未按照本帮助中的定义进行。 请参阅回调函数列表及其签名。
3、问题
如何在网关节点中访问多个 CAN 网络?
回答
在网关中,总线上下文控制 CAN 网络消息的发送和接收。 CAPL程序可以通过调用适当的函数来改变总线上下文;
4、问题
如何设置接收节点在流量控制消息中发送的连续帧状态?
回答
可以通过流控制帧控制函数进行设置
5、问题
尽管接收器指示 CANoe 作为发送器可以发送 STmin 值 < 1 ms 的事件,但连续帧会以 1 ms 延迟发送。 例如,接收器可能指示 STmin 值为 0xF1,持续 100μs。
回答
为了限制CPU上的处理负载,CANoe使用分辨率为1毫秒的定时器。 可以在 CAN.INI 文件中更改 CANoe 定时器的分辨率:
定时器速率=100; 时间管理分辨率在 10 us 内
将此值设置为 25,定时器分辨率为 250 µs。
注意:这会导致 CANoe 的进程负载相当的高!!!
寻址模式
寻址模式 | 模式英文说明 | 模式中文说明 |
Normal | Connections use arbitrary CAN IDs for Tx and Rx messages. | 连接使用任意 CAN ID 来发送和接收消息。 |
Extended (based) | One CAN ID is used as base address, and each ECU gets an address that is added to the ID (to identify the sender), and put into a target byte (to identify the receiver). | 一个 CAN ID 用作基地址,每个 ECU 获取一个地址,该地址添加到 ID 上(以识别发送方),并放入目标字节(以识别接收方)。 |
Extended (free) | Connections use arbitrary CAN IDs for Tx and Rx messages, but ECU addresses are also used to identify the receiver. | 连接使用任意 CAN ID 来发送和接收消息,但 ECU 地址也用于识别接收器。 |
NormalFixed | J1939 messages are used with ECU addresses that are coded into the CAN IDs. | J1939 消息与编码到 CAN ID 中的 ECU 地址一起使用。 |
Mixed | J1939 mode like normal fixed, but an additional address extension byte is used to distinguish otherwise identical receivers. | J1939 模式与普通固定模式类似,但使用附加的地址扩展字节来区分其他方面相同的接收器。 |
Mixed (11 bit) | Like Normal mode, but an additional address extension byte is used to distinguish otherwise identical receivers. | 与正常模式类似,但使用附加的地址扩展字节来区分其他方面相同的接收器。 |