使用CAPL在CANoe中通过ISO-TP(传输协议)传输数据

问题描述 投票:2回答:1

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

can-bus capl canoe
1个回答
4
投票

看看OSEK_TP CANoe演示。它显示了如何通过ISO-TP(传输协议,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]);
}
© www.soinside.com 2019 - 2024. All rights reserved.