J1939 Documentation
Version 4.16.00
Loading...
Searching...
No Matches
j1939_cos_tunnel.h File Reference

Detailed Description

This modules provides a tunnel via a CAM11 and CAM21 message to an existing CANopen Slave Protocol Stack. Please note that the symbol J1939_COS_TUNNEL must be set to 1 in order to enable this functionality.

The CANopen Slave Protocol Stack and the J1939 Protocol Stack can be initialised on the same CAN interface, but they can not run at the same time on a physical CAN interface. This means when the J1939 Protocol Stack is started by calling J1939_MgrStart(), the corresponding CANopen function CosMgrStart() shall not be called.

The tunnel provides an interface to the CANopen Slave object dictionary. The CAM11 message emulates a CANopen SDO service request, the CAM21 message emulates the CANopen SDO service response. The following example depicts the PDU exchange between an ECU with source address 1 running the CANopen Slave protocol stack and a J1939 tool running on ECU address 8. The J1939 tool starts a request on object 1000h:00h using the CAM11 PDU.

1C050108 8 40 00 10 00 00 00 00 00
1C060801 8 43 00 10 00 94 01 02 00

Adding the CAM11 amd CAM21 PDU

The tunnel is available when the handler ECU_PgnCAM11() and ECU_PgnCAM21() are added to a PGN list.

+ Include dependency graph for j1939_cos_tunnel.h:

Functions

int16_t ECU_PgnCAM11 (uint8_t *pubDataV, uint16_t uwSizeV, uint8_t ubSrcAddrV, uint8_t ubNetV)
 
int16_t ECU_PgnCAM21 (uint8_t *pubDataV, uint16_t uwSizeV, uint8_t ubSrcAddrV, uint8_t ubNetV)
 

Function Documentation

◆ ECU_PgnCAM11()

int16_t ECU_PgnCAM11 ( uint8_t * pubDataV,
uint16_t uwSizeV,
uint8_t ubSrcAddrV,
uint8_t ubNetV )
Parameters
[in]pubDataVPointer to SDO request data
[in]uwSizeVSize of data
[in]ubSrcAddrVSource address
[in]ubNetVJ1939 Network channel
Returns
eJ1939_HANDLER_RESULT_OK

The function adds a handler for SDO request messages between the J1939 Protocol Stack and the CANopen Slave Protocol Stack.

◆ ECU_PgnCAM21()

int16_t ECU_PgnCAM21 ( uint8_t * pubDataV,
uint16_t uwSizeV,
uint8_t ubSrcAddrV,
uint8_t ubNetV )
Parameters
[in]pubDataVPointer to SDO request data
[in]uwSizeVSize of data
[in]ubSrcAddrVSource address
[in]ubNetVJ1939 Network channel
Returns
eJ1939_HANDLER_RESULT_OK

The function adds a handler for SDO response messages between the CANopen Slave Protocol Stack and the J1939 Protocol Stack.