使用CAPL在CANoe中通过ISO-TP(传输协议)传输数据 [英] Transmitting data over ISO-TP (transport protocol) in CANoe using CAPL
问题描述
将CAPL与CANoe结合使用,可以通过CAN上的ISO-TP传输大量数据。是否有例程可以处理嵌入在CAPL中的数据分段,还是我需要编写自己的解释?
Using CAPL with CANoe to transmit big amount of data via ISO-TP on CAN. Is there a routine, that provides the handling of data segmentation embedded in CAPL or do I need to write my own interpretation?
推荐答案
看看 OSEK_TP CANoe演示。它显示了如何通过ISO-TP(传输协议,ISO 15765-2 )传输和接收数据。
有关实现的详细信息,请参见 nodeA.can
文件和OSEL_TP API参考。
Take a look at the OSEK_TP CANoe demo. It shows how to transmit and receive data over ISO-TP (Transport Protocol, ISO 15765-2).
See the nodeA.can
file and the OSEL_TP API reference for implementation details.
示例:
创建并配置连接:
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));
要接收数据,必须实现以下回调函数:
To receive data, you have to implement the following callback function:
void CanTp_ReceptionInd(long connHandle, byte data[])
{
write("Received %d byte on connection %d: [%02x] ...",
elcount(data), connHandle, data[0]);
}
这篇关于使用CAPL在CANoe中通过ISO-TP(传输协议)传输数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!