SAE J1939 Programming with Arduino - SAE J1939/21 - Transport Protocol (TP)
This post is part of a series about SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino.
Even though extremely effective in passenger cars and small industrial applications, the CAN Bus technology alone was not suitable to meet the requirements of truck and bus communications, especially since its communication between devices is limited to only 8 bytes per message. However, it is possible to extend the size of a CAN Bus message by implementing additional software, i.e. so-called higher layer protocols. SAE J1939 is such a higher layer protocol and it supports up to 1785 bytes per message.
In order to support a size of more than 8 bytes the message needs to be packaged into a sequence of 8 byte size messages. Consequently, the receiver of such a multi-packet message must re-assemble the data. Such functions are defined as Transport Protocol (TP) Functions and they are described in SAE J1939/21.
In order to package CAN Bus messages into a sequence of up to 1785 messages (as well as to re-assemble the CAN Bus frames into one data package) the J1939 Transport Protocol defines the following:
- Each multi-packet message is being transmitted by using a dedicated Data Transfer PGN (60160, TP.DT = Transport Protocol Data Transfer), i.e. all message packets will have the same ID.
- The flow control is managed by another dedicated PGN (60146, TP.CM = Transport Protocol Communication Management).
- The message length must always be 8 bytes (DLC = 8).
- The first byte in the data field contains a sequence number that ranges from 1 to 255.
- The remaining 7 bytes are filled with the data of the original long (> 8 bytes) message.
- All unused data bytes in the last package are being set to 0xFF.
The method of using a sequence number plus the remaining seven data bytes yields a total of (255 packages times 7 bytes/package) 1785 bytes per multi-packet message.
The following images demonstrate the use of the CAN Bus data field including the sequence number and the packaging of multiple CAN Bus messages.
As it is the case with regular 8-byte CAN messages, multi-packet messages (i.e. messages longer than 8 bytes) can be transmitted as a broadcast message (BAM = Broadcast Announce message) or peer-to-peer (RTS/CTS = Request to Send / Clear to Send).
Note: The SAE J1939/21 Standard requires that an ECU supports one BAM and one RTS/CTS session simultaneously.
SAE J1939 has become the accepted industry standard and the vehicle network technology of choice for off-highway machines in applications such as construction, material handling, and forestry machines. J1939 is a higher-layer protocol based on Controller Area Network (CAN). It provides serial data communications between microprocessor systems (also called Electronic Control Units - ECU) in any kind of heavy duty vehicles. The messages exchanged between these units can be data such as vehicle road speed, torque control message from the transmission to the engine, oil temperature, and many more.
A Comprehensible Guide to J1939 is the first work on J1939 besides the SAE J1939 standards collection. It provides profound information on the J1939 message format and network management combined with a high level of readability.