Recent Posts
SAE J1939 Programming with Arduino - Multi-Packet Broadcast (BAM Session)
Posted by
onThis post is part of a series about SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino.
In order to broadcast a multi-packet message, a node must first send the Broadcast Announce Message (BAM), which contains the following components:
- Parameter Group Number (PGN) of the multi-packet message
- Size of the multi-packet message
- Number of packages
The BAM message allows all receiving nodes (i.e. all nodes interested in the message) to prepare for the reception by allocating the appropriate amount of resources (memory).
The Broadcast Announce Message (BAM) is embedded in the Transport Protocol – Connection Management (TP.CM) PGN 60416 and the actual data transfer is handled by using the Data Transfer PGN 60160.
The last packet of a multi-packet PGN may require less than eight data bytes. All unused data bytes in the last package are being set to 0xFF.
The transport of Multi-Packet Broadcast messages is not regulated by any flow-control functions and thus it is necessary to define timing requirements between the sending of a Broadcast Announce Message (BAM) and the Data Transfer PGN. The following picture demonstrates the message sequence and timing requirements for a broadcasted multi-packet message.
As is demonstrated in the previous image:
- The message packet frequency will be between 50 to 200 msec.
- A timeout will occur when a time of greater than 750 ms (T1) elapsed between two message packets when more packets were expected.
Timeouts will cause a connection closure.
A connection is considered closed when:
- The sender of a data message sends the last Data Transfer package.
- A timeout occurs.
Note: The SAE J1939/21 document is not very specific regarding the time range of 50 to 200 milliseconds, i.e. how the range was defined and which time should be applied under which conditions.
First of all, a minimum of 50 milliseconds creates ample time for other message to go through the network. Using the lowest message priority assures that higher-priority messages still reach the bus in a timely manner. In other words, the combination of a long time and low priority guarantees to a certain degree that long data messages do not disrupt the regular data traffic.
The range of 50 to 200 milliseconds, however, still remains a mystery. It may be based on the technology when SAE J1939 was introduced, i.e. there may have been ECUs with a reaction time of up to 200 milliseconds. Another, more plausible explanation may be that the time can be chosen due to application needs, meaning 200 milliseconds are less intrusive to the regular data traffic than 50 milliseconds.
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.