Understanding SAE J1939 Protocol in Heavy-Duty Vehicles

SAE J1939 is a high-level communication protocol that standardizes data exchange among electronic control units (ECUs) in heavy-duty vehicles. Built upon the Controller Area Network (CAN) bus, J1939 defines a comprehensive framework for messaging, including detailed specifications for message formats, parameter group numbers (PGNs), suspect parameter numbers (SPNs), and addressing mechanisms. This article provides an in-depth technical exploration of these components from a programming perspective.

J1939 Message Format

In J1939, each message transmitted over the CAN bus utilizes a 29-bit identifier, which is segmented into several fields:

  • Priority (3 bits): Determines the urgency of the message, with lower values indicating higher priority.
  • Reserved Bit (1 bit): Currently reserved for future use and typically set to zero.
  • Data Page (1 bit): Used to extend the range of PGNs.
  • PDU Format (PF) (8 bits): Indicates the format of the Protocol Data Unit and, in combination with the PDU Specific field, defines the PGN.
  • PDU Specific (PS) (8 bits): Specifies the target address for destination-specific messages or provides additional information for broadcast messages.
  • Source Address (8 bits): Identifies the transmitting ECU.

The combination of the PF and PS fields constitutes the PGN, which uniquely identifies the parameter group conveyed by the message. Understanding and correctly interpreting these fields are crucial for effective communication within a J1939 network.

J1939 Message Identifier Structure

The 29-bit identifier in J1939 messages is segmented as follows:​

FieldLength (bits)Description
Priority3Message priority; lower values indicate higher priority.
Reserved (R)1Reserved bit, typically set to zero.
Data Page (DP)1Used to extend the range of PGNs.
PDU Format (PF)8Defines the message format and, in combination with PDU Specific, determines the PGN.
PDU Specific (PS)8Specifies the target address for destination-specific messages or provides additional information for broadcast messages.
Source Address (SA)8Identifies the transmitting ECU.

Note: The combination of DP, PF, and PS fields constitutes the 18-bit PGN

Parameter Group Numbers (PGNs) and Suspect Parameter Numbers (SPNs)

  • Parameter Group Numbers (PGNs): PGNs are 18-bit identifiers that categorize messages containing related parameters. Each PGN defines a specific set of data points relevant to vehicle operation, such as engine temperature or fuel consumption.
  • Suspect Parameter Numbers (SPNs): Within each PGN, SPNs uniquely identify individual parameters. SPNs provide detailed information about each parameter, including data type, scaling, offset, and range. For example, an SPN might represent the engine coolant temperature, specifying how to interpret the raw data received.

Programmatically, parsing J1939 messages involves extracting the PGN from the 29-bit identifier to determine the parameter group, and then interpreting the SPNs within the data payload to access specific parameter values.

Parameter Group Numbers (PGNs)

PGNs categorize messages containing related parameters. Below is an example of a PGN breakdown:

Parameter Group NamePGNDescription
Engine Temperature 165262Contains parameters like engine coolant temperature and fuel temperature.
Vehicle Position65267Provides GPS-based vehicle position data.
Electronic Engine Controller 161444Conveys engine torque and speed information.

Note: PGNs are derived from the combination of DP, PF, and PS fields in the message identifier.

Suspect Parameter Numbers (SPNs)

SPNs uniquely identify individual parameters within a PGN. An example for PGN 65262 (Engine Temperature 1) is shown below:​

SPNParameter NameOffset (bytes)Length (bytes)Resolution (Units per bit)Data RangeOperational RangeDescription
110Engine Coolant Temperature111°C per bit, offset -40°C0 to 250°C-40 to 210°CMeasures the temperature of the engine coolant.
174Fuel Temperature211°C per bit, offset -40°C0 to 250°C-40 to 210°CMeasures the temperature of the fuel.

Note: The offset indicates the starting byte position within the data payload where the parameter value is located.

Addressing and Node Identification

J1939 assigns each ECU a unique 8-bit address (0-253), facilitating node identification within the network. Addresses 254 and 255 are reserved for special purposes, such as the global address and null address. The protocol supports both static addressing, where each ECU has a predefined address, and dynamic addressing, which involves an address claim process.

During dynamic addressing, ECUs broadcast an Address Claimed message containing their preferred address and a unique 64-bit NAME, which includes fields like function, vehicle system, and manufacturer code. If address conflicts arise, they are resolved based on the precedence defined in the NAME fields. Implementing this process programmatically requires handling the Address Claimed and Cannot Claim Address messages, ensuring that each ECU operates with a unique address.

Address RangePurpose
0–253Dynamically or statically assigned ECU addresses.
254Reserved for the global (broadcast) address.
255Reserved for the null address (e.g., when an ECU cannot claim an address).

Transport Protocol for Multi-Packet Messages

While the CAN protocol limits data frames to 8 bytes, J1939 accommodates larger messages through its Transport Protocol (TP). This protocol defines methods for segmenting, transmitting, and reassembling messages up to 1,785 bytes. There are two primary TP methods:

  • Connection Mode Data Transfer: Used for messages between specific ECUs, involving a handshake process to manage data transfer.
  • Broadcast Announce Message (BAM): Employed for broadcasting messages to all ECUs without a handshake, suitable for data that multiple nodes need to receive.

Implementing these protocols requires managing sequence numbers, timeouts, and ensuring data integrity during transmission and reassembly.

Practical Implementation Considerations

When developing software to interface with a J1939 network, consider the following:

  • CAN Interface Configuration: Ensure the CAN controller is set to use a 29-bit identifier and operates at the standard J1939 baud rate of 250 kbps.
  • Message Parsing: Develop routines to extract and interpret the 29-bit identifier fields, accurately identifying PGNs and SPNs to process the data payload effectively.
  • Address Management: Implement the address claim procedure to handle dynamic addressing and resolve conflicts, ensuring each ECU has a unique address.
  • Transport Protocol Handling: Manage the segmentation and reassembly of multi-packet messages, adhering to the timing and sequence requirements specified by the J1939 standard.

Leave a comment