Diagnostics via CANoe Gateways
Copyright © 2022 - Vector Informatik GmbH 11
Contact Information: www.vector.com or +49-711-80 670-0
CanTpSetTxIdentifier( conn, 0x400); // replace with ECU’s CAN ID
CanTpSetBlockSize( conn, 0); // additional configuration
CanTpSetSTmin( conn, 5);
gConnectionMap[0][0] = conn; // Set CAN side connection handle
SetBusContext( gContextFR); // access FlexRay network side
conn = FrTP_CreateConnUnicast(120,121); // replace with ECU’s send/receive slots
FrTP_SetAddresses( conn, 2, 4444,1234); // replace with ECU’s send/receive addr.
// Routing here:
// CAN 0x200 >> FlexRay 4444
// FlexRay 1234 >> CAN 0x400
// Note that the API of this function
// depends on the used TP protocol on
// FlexRay!
FrTP_SetMaxPDULength( conn, 32); // additional configuration
gConnectionMap[0][1] = conn; // Set FlexRay side connection handle
// Second pair ...
}
5.4.3 Find corresponding connection
The following utility functions will retrieve the corresponding connection on the other bus, or return 0 if
no such connection is found.
// Return CAN connection handle for a FlexRay connection handle
long GetCanConn( long frConn)
{
dword i;
for( i = 0; i < elcount(gConnectionMap); ++i)
{
if( gConnectionMap[i][1] == frConn)
return gConnectionMap[i][0];
}
return 0;
}
// Return FlexRay connection handle for a CAN connection handle
long GetFrConn( long canConn)
{
dword i;
for( i = 0; i < elcount(gConnectionMap); ++i)
{
if( gConnectionMap[i][0] == canConn)
return gConnectionMap[i][1];
}
return 0;
}
5.4.4 CAN-side callback implementation
The TP implementation in the OSEK_TP.vmodule modeling library will indicate the arrival of data, the
completion of a data transfer, and errors by calling special CAPL callback functions. These functions
have to be implemented in the gateway.
Note that data received on a CAN connection is sent immediately on the corresponding connection on
the FlexRay network.
CanTp_ReceptionInd( long handle, BYTE data[])
{
long frConn, status;
// Find the corresponding FlexRay connection
frConn = GetFrConn( handle);