Understanding SAE J1939-21 Data Link Layer: Message Formats, Transport Protocol, and Design Insights

Message Format and Protocol Data Unit (PDU)

SAE J1939-21 specifies the data link layer for high-speed vehicle communication networks using the Controller Area Network (CAN) protocol with a 29-bit identifier (ISO 11898-1 CEFF). The Protocol Data Unit (PDU) contains priority, extended data page, data page, PDU Format (PF), PDU Specific (PS), and Source Address (SA). The Parameter Group Number (PGN) identifies the data content and is derived from the PF and PS fields.

The PDU can be in one of two formats: PDU1 (PF 0-239) where PS is the Destination Address, used for specific communication to a single node. PDU2 (PF 240-255) where PS is a Group Extension, used for broadcast or group-specific messages. This distinction allows efficient addressing and filtering on the bus.

Attribute PDU1 PDU2
PF Range 0 to 239 240 to 255
PS Interpretation Destination Address (DA) Group Extension (GE)
Communication Type Point-to-point Broadcast / Group
PGN Calculation PGN = (PF << 8) | 0x00 PGN = (PF << 8) | PS
🛠️ Design Insight: Using PDU2 for broadcast and PDU1 for directed messages allows nodes to selectively ignore messages not intended for them. This reduces CPU load and improves network determinism, a key requirement for real-time vehicle control.

Transport Protocol and Connection Management

When a message exceeds 8 bytes, the transport protocol (TP) handles segmentation and reassembly. The TP uses connection management (CM) messages to establish a session: Request to Send (RTS), Clear to Send (CTS), End of Message (EOM), and Abort. Data is transferred in multiple Data Transfer (DT) packets of up to 8 bytes each. The TP ensures reliable delivery with sequence numbers and timeouts.

Connection constraints include a maximum packet count of 255 and a maximum total data length of 1785 bytes per connection. Timeout defaults (e.g., 200 ms for CTS) must be observed to avoid bus stalling.

⚠️ Common Mistake: Failing to implement proper timeout handling or incorrect sequence numbering in transport protocol sessions can cause failed transfers or network lockouts. Always validate CTS timing and packet sequence continuity.

Frequently Asked Questions

How is a PGN calculated from the PDU?

PGN is derived from the PDU Format (PF) and PDU Specific (PS) fields. For PDU1 (PF < 240), the PGN is (PF << 8) | 0x00. For PDU2 (PF >= 240), it is (PF << 8) | PS. The reserved Extended Data Page (EDP) and Data Page (DP) bits may also be included in the full 18-bit PGN.

When should I use PDU1 vs PDU2 addressing?

Use PDU1 when sending a message to a specific destination ECU (point-to-point). Use PDU2 for broadcast or group addressing where multiple nodes may consume the message. PDU2 is also required for global requests and responses.

What are the priority levels and how do they affect arbitration?

Priority is encoded in the first 3 bits of the 29-bit identifier, with 0 being highest and 7 lowest. Higher priority messages win bus arbitration. Critical safety messages (e.g., brake control) should use high priority (low numbers).

How does the transport protocol ensure reliable delivery for long messages?

The transport protocol uses a handshake mechanism: the sender transmits a Request to Send (RTS) with total size and packet count. The receiver responds with Clear to Send (CTS) specifying how many packets it can accept. Data packets are sent sequentially, and an End of Message (EOM) confirms completion. Timeouts and retries handle errors.

Leave a Reply

Your email address will not be published. Required fields are marked *