【问题标题】:Transmitting data over ISO-TP (transport protocol) in CANoe using CAPL使用 CAPL 在 CANoe 中通过 ISO-TP(传输协议)传输数据
【发布时间】:2019-04-26 14:30:59
【问题描述】:

将 CAPL 与 CANoe 结合使用,通过 CAN 上的 ISO-TP 传输大量数据。是否有一个例程可以处理嵌入在 CAPL 中的数据分段,还是我需要编写自己的解释?

【问题讨论】:

  • “连续帧”你说的是 ISO-TP 吗?
  • 是使用传输协议。
  • 你是说传输协议吗?

标签: can-bus capl canoe


【解决方案1】:

看看 OSEK_TP CANoe 演示。它展示了如何通过 ISO-TP(Transport Protocol, ISO 15765-2)传输和接收数据。 请参阅nodeA.can 文件和 OSEL_TP API 参考了解实现细节。

这里是最小的例子:

创建和配置连接:

long handle;
handle = CanTpCreateConnection(0);    // 0 = Normal mode
CanTpSetTxIdentifier(handle, 0x700);  // Tx CAN-ID
CanTpSetRxIdentifier(handle, 0x708);  // Rx CAN-ID

发送数据:

BYTE data[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
CanTpSendData(handle, data, elcount(data));

要接收数据,必须实现如下回调函数:

void CanTp_ReceptionInd(long connHandle, byte data[])
{
    write("Received %d byte on connection %d: [%02x] ...",
            elcount(data), connHandle, data[0]);
}

【讨论】:

  • 感谢您的示例和提示。它现在就像一个魅力。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-12-13
  • 2014-07-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-22
  • 1970-01-01
相关资源
最近更新 更多