Software Products

What is J1939

What is J1939?

  • It is a standard maintained by the Society of Automotive Engineers (SAE).
  • The standard defines how information is transferred across a network to allow ECUs (i.e. computers) to communicate information (e.g., vehicle speed).
  • Think of J1939 as a software specification that rides on top of a CAN bus.
  • In order to understand J1939, you must first understand CAN.
SAE J1939 Overview – High-performance CAN bus networking for heavy-duty vehicles

SAE J1939

Introduction

This article is intended to give engineers a brief overview of the SAE J1939 protocol. For details on the specification itself, please visit the Society of Automotive Engineers. Here is a printable version of this J1939 introduction

SAE J1939 is a replacement for the SAE J1587/J1708 network which has been used for medium and heavy duty commercial vehicles for the past 20 years. Today SAE J1939 is used as the standard communications bus for commercial vehicle’s diagnostic and control applications. Due to its popularity and success, it has been adopted by the agricultural (ISO 11789) and marine industries (NMEA 2000).

Several different application layers exist and are known as device profiles. For example, CiA 401 defines the application layer (i.e. device profile) for a generic I/O device while CiA 402 defines operation for servo drives, frequency inverters and stepper motors. Altogether there are more than 50 separate and defined device profiles.

J1939 Overview

SAE J1939 is a high level communications protocol, which operates on a Controller Area Network (CAN) bus. SAE J1939 specifies exactly how information (e.g. engine RPM) is exchanged between electronic control units (ECUs) on a vehicle.

It defines the data’s priority, size, scaling, and offset. For example, J1939 specifies engine RPM to have a default priority of 3, to have a size of 16-bits, a resolution of 0.125 rpm/bit, and an offset of 0.

The standard goes on to define many other aspects, including message timeouts, how large messages are fragmented and reassembled, the network speed, the physical layer, and how applications acquire network addresses.

SIMMASOFTWARE

J1939 Introduction

The SAE J1939 set of profiles is based on the Controller Area Network (CAN) data link layer (ISO 11898-1) using the extended frame format (29-bit identifiers). Several documents have undergone revision after the initial publication in 1998. The specifications have been added to, parts taken off and clarified. The set of specifications, include:
The naming of the layers is not always compliant to the OSI reference model and to CiA's recommended terminology. The J1939/21 and J1939/31 define partly an application layer, and the J1939/71 and J1939/73 specify an application profile.

SAE J1939 Parent Document

The J1939 standard is a recommended pratice for serial control and communications for light, medium, and heavy duty vehicles. The main purpose of J1939 is to allow ECUs to communicate together by defining a common message structure. J1939 is issued by the ‘Truck Bus Control and Communication Network’ Committee.

The J1939 document serves as the parent document for the specification. It includes tables for source addresses, preferred addresses, function codes and industry groups.

SAE J1939/11 Physical Layer

J1939/11 specifies one of three possible physical layers for a J1939 network. This specification is responsible for defining things such as backbone length, stub length, network termination, twists per inch, shielding, shielding termination, baud rate, and signal slew rate.

Besides the above mentioned parameters there are several other details such as connector dimensions and testing requirements specified by this standard. For complete information, we recommend buying the specification from the SAE.

J1939/11 Details:

  • Backbone length max: 40 meters
  • Stub length max: 1 meters
  • Node count max: 30
  • CAN bus data rate: 250 Kbps
  • CAN bus tolerance: +/- 0.05%
  • Cable: Twisted shielded pair

SAE J1939/14 Physical Layer

J1939/14 specifies one of three possible physical layers for a J1939 network. This specification is responsible for defining things such as backbone length, stub length, network termination, twists per inch, shielding, shielding termination, baud rate, and signal slew rate.

Besides the above mentioned parameters there are several other details such as connector dimensions and testing requirements specified by this standard. For complete information, we recommend buying the specification from the SAE when it becomes available.

J1939/14 Details:

  • Backbone length max: not available
  • Stub length max: not available
  • Node count max: not available
  • CAN bus data rate: 500 Kbps
  • CAN bus tolerance: +/- 0.05%
  • Cable: Twisted unshielded pair

SAE J1939/15 Reduced Physical Layer

J1939/15 specifies one of three possible physical layers for a J1939 network. This specification is responsible for defining things such as backbone length, stub length, network termination, twists per inch, shielding, shielding termination, baud rate, and signal slew rate.

Besides the above mentioned parameters there are several other details such as connector dimensions and testing requirements specified by this standard. For complete information, we recommend buying the specification from the SAE.

J1939/15 Details:

  • Backbone length max: 40 meters
  • Stub length max: 3 meters
  • Node count max: 10
  • CAN bus data rate: 250 Kbps
  • CAN bus tolerance: +/- 0.05%
  • Cable: Twisted unshielded pair

SAE J1939/21 Data Link Layer

J1939/21 specifies the datalink layer for a J1939 network and is the only datalink layer published and supported for J1939. This specification is responsible for defining the bit encoding of 29-bit CAN identifiers.

Also included in this specification is the encoding for source address (SA), destination address (DA), priority (P), and parameter group number (PGN).

SAE J1939/71 Vehicle Application Layer

J1939/71 specifies the application layer for a J1939 network and is the only application layer published and supported for J1939. This specification is responsible for defining all application layer SPNs and PGNs. Also included in this specification is a parameters, offset, scaling, and acceptable range. PGNs are defined to be broadcast or destination specific and given a transmit rate. Below is an example PGN.

PGN 65101 Total Averaged Information

Transmission Repetition: On request
Data Length: 8
Default Priority: 7
Parameter Group Number: 65101
Start Position Length Parameter Name SPN
1-2 2 bytes Engine Total Average Fuel Rate 1834
3-4 2 bytes Engine Total Average Fuel Economy 1835

SAE J1939/73 Diagnostics Layer

J1939/73 specifies the diagnostic layer for a J1939 network and is the only application layer published and supported for J1939. This specification is responsible for defining all diagnostic layer SPNs and PGNs. J1939-73 defines messages for active faults, passive faults, and clearing faults. Also messages for OBD-2 compliance and flash bootloader operation (i.e. erase and programing of flash).

PGN 65226 Active Diagnostic Codes

Transmission Repetition: See J1939-73 spec
Data Length: Variable
Default Priority: 6
Parameter Group Number: 65226
Start Position Length Parameter Name SPN
1.8-1.7 2 bits Malfunction Indicator Lamp Status 1213
1.6-1.5 2 bits Red Stop Lamp Status 623
1.4-1.3 2 bits Amber Warning Lamp Status 624
1.2-1.1 2 bits Protect Lamp Status 987
3-6 4 bytes DTC n/a

SAE J1939/81 Network Management

J1939/81 specifies the network management for a J1939 network and is the only network management layer published and supported for J1939. This specification is concerned with the management of source addresses and the association of those addresses with an actual function and with the detection and reporting of network related errors.

Due to the nature of management of source addresses, J1939-81 also specifies initialization processes, requirements for reaction to brief power outages and minimum requirements for ECUs on the network.

SAE J1939/82 Compliance

J1939/82 specifies a set of compliance tests for J1939 protocol stacks and applications. Compliance testing is recommended but not manditory.

There is around 130 tests total, which test from the data link to the application layers. There are tests to validate address encoding, multi-frame fragmentation, request processing, and address claiming.

The purpose of these compliance tests is to generate one or more verification documents that outline the data needed to assure that an ECU is designed to operate as a node on a SAE J1939 network. These tests are to allow testing of a Device to determine self-compliance by the manufacturer of a device. The manufacturer can use its record of what procedures were run successfully to show the level of compliance with J1939.

SAE J1939 PGN

In SAE J1939, the acronym PGN stands for Parameter Group Number and represents the identifier of a J1939 message. Every J1939 message has a unique PGN assigned to it by the SAE committee when the message is defined.

A PGN is 18-bits wide and is made up of the following fields: Extended Data Page, Data Page, PDU Format, PDU Specific. Depending on the value of the PDU Format field, a message is either destination specific, meaning it is for a specific CA, or global, meaning it is for all CAs. The PGN identifier is encoded to allow for a maximum of 8,672 unique PGNs.

PGN 61444 Electronic Engine Controller 1

Transmission Repetition: engine speed dependent
Data Length: 8
Default Priority: 3
Parameter Group Number: 61444
Start Position Length Parameter Name SPN
1.1 4 bits Engine Torque Mode 899
2 1 byte Driver’s Demand Engine – Percent Torque 512
3 1 byte Actual Engine – Percent Torque 513
4-5 2 bytes Engine Speed 190
6 1 byte Source Address of Controlling Device of Engine 1483
7.1 4 bits Engine Starter Mode 1675
8 1 byte Engine Demand – Percent Torque 2432

Source Address

In SAE J1939, the acronym SA stands for Source Address and represents the address of a controller application. A source address is 8-bits wide and is included in every J1939 message. Also, every J1939 controller application (i.e. ECU), has a unique SA.

J1939 requires every CA to have a unique source address (SA) to guarentee that all CAN identifiers are unique. This is a requirement of the CAN Bosch specification and is required for correct CAN functionality. J1939-81 specifies an address claim procedure which details what steps should be taken if more than one controller application (CA) has the same source address (SA).

J1939 SA Example

  • 0: Engine #1
  • 1: Engine #2
  • 3: Transmission #1
  • 4: Transmission #2
  • 5: Shift Console – Primary
  • … : …
  • 254: Null
  • 255: Global – All CAs

Destination Address

In SAE J1939, the acronym DA stands for Destination Address and represents the intended target address for a destination specific message. Every J1939 controller application (i.e. ECU) has a unique address, and destination specific messages can be directed to any address.

Protocol Data Unit 1 (PDU1)

In SAE J1939, the acronym PDU1 stands for Protocol Data Unit 1 and represents a message that is destination specific. If a message is a PDU1 or PDU2 format is specified by the protocol format (PF) field contained in the PGN.

A PF field less than or equal to 239 indicates a PDU1 format message. The PDU format entity was created to allow for the maximum number of PGNs but still allowing for destination specific messages.

Protocol Data Unit 2 (PDU2)

In SAE J1939, the acronym PDU2 stands for Protocol Data Unit 2 and represents a message that is not destination specific, which is also referred to as a global destination message. If a message is a PDU1 or PDU2 format is specified by the protocol format (PF) field contained in the PGN.

A PF field greater than or equal to 240 indicates a PDU2 format message. The PDU format entity was created to allow for the maximum number of PGNs but still allowing for destination specific messages.

For more detailed information please visit simmasoftware.com/products/J1939/protocol-stack
Simma Software, Inc. specializes in real-time embedded software for the automotive industry.

Products and services include protocol stacks, bootloaders, device drivers, training, and consultation on the following technologies:

J1939, CAN, J1587, J1708, J2497, J1922, ISO 15765, CANopen, UDS, XCP, LIN.
Simma Software, Inc.
5940 South Ernest Drive
Terre Haute, IN 47802
Toll Free: 888-256-3828
Fax: 208-445-2912
Image_5_1

What is CAN?

  • CAN stands for Controller Area Network
  • CAN is a form of serial communications (think sequential, 1 bit after another... )
  • Multidrop bus meaning all ECUs are connected to the same set of wires.
  • CAN transmits data with a binary model: 0 is called a dominant bit and a 1 is called a recessive bits.

CAN Frames

  • CAN uses four different types of frames for communicating information and the state of the bus.
    1. Data frame (used by CAN to send data)
    2. Request frame (used by CAN to request data)
    3. Error frame (used by CAN to indicate error)
    4. Overload frame (used by CAN to insert a delay)

CAN Data Frame

  • A CAN data frame uses the standard communication architecture of a header followed by data.
  • The header is known as the identifier. It is either 29 bits (CAN 2.0B) or 11 bits (CAN 2.0A)
  • The data is sent as bytes and is somewhere from 0 to 8 bytes in length.
  • Example: "984 1,2,3,4"

CAN 2.0A Format

Image_9_1
  • SOF: Start of frame (start bit)
  • ID: Message identifier (indicates msg priority)
  • RTR: Remote transmission request
  • IDE: Identifier extension bit (2.0A or 2.0B)
  • r0: Reserved bit. Sent as dominant.
  • DLC: Data length code. Valid range 0 - 8.
  • CRC D: CRC delimiter. Marks end of CRC field.
  • ACK S: Used for receiver to ACK msg. Sent as recessive.
  • ACK D: Marks end of ACK field.
  • EOF: End of frame. (stop bit). Sent as 7 recessive bits.
  • INT: Intermission. Sent as 3 recessive bits.

CAN 2.0B Format

Image_10_1
  • SRR: Substitute request bit. Sent as recessive. This is simply a placeholder bit to ensure compatibility between 2.0A and 2.0B because 2.0A has RTR.

Bit Stuffing

  • 5 consecutive bits, 6th will be opposite.
  • Allows for clock synchronization.
  • Synchronization happens on recessive to dominant edges.

Questions???

  • What are the names for the two types of bits?
  • What is the DLC field for?
  • What is bit stuffing?
  • What questions do you have?

Physical Layer

  • Bus is made up of two wires: CAN_H and CAN_L. Terminate with 120 Ohm resistors.
  • Bus is differential. Voltage drop from CAN_H to CAN_L determines 0 or 1.
  • Dominant bit(0): CAN_H=3.5V, CAN_L=1.5V
  • Recessive bit(1): CAN_H=2.5V, CAN_L=2.5V

CAN Bus Example

Image_14_1
  • J1939 defines physical layer parameters. (e.g. max backbone length)

CAN ID = 0x1dffffff
(1/1101/1111/1...)

Image_15_1

Bus Arbitration

  • It's what happens when two or more ECUs start to transmit at the same time.
  • Every transmitter must make sure what it sends is also what is on the bus.
  • If there is a difference, then the CAN controller stops.
  • The winner will always be the CAN messages with the lowest identifier.
  • Non destructive.

Bus Arbitration Example

ECU #1 0 1 0 0 0 1
ECU #2 0 1 0 0 1 RX
ECU #3 0 1 1 RX RX RX
Bus 0 1 0 0 0 1

Questions

  • What is bus arbitration used for?
  • Who wins bus arbitration?
  • Is CAN point to point or multidrop?
  • What are the voltage levels for dominant and recessive bits?
  • What questions do you have?

J1939 Overview

  • Uses CAN 2.0B
  • Replaces J1587 and J1708 (although both co-exist on some vehicles today)
  • Used on commercial vehicles (i.e. tractor/trailers, cement mixers, military trucks)

J1939 Message Big Picture

  • Just as CAN is centered around the ID, J1939 is centered around PGN. PGN is defined by the CAN ID.
  • PGN: Parameter Group Number
  • For example, PGN 65215 is "Wheel Speed Information". Data comes in data field.
  • Most PGNs are 8 bytes long. Multibyte variables are sent least significant byte first.
  • Typically 0xFF means "data isn't available", 0xFE means "error". Valid range is 0-250. Check MSB for multibyte variables.

CAN ID Mapping

Image_15_1
  • P: Message priority. Must come first.
  • EDP: Extended data page. J1939 devices must set to 0.
  • DP: Data page. Used to create a second page of PGNs.
  • PF: PDU format:
    • < 240, PS is destination address. (PDU1 format)
    • >= 240, PS is group extension. (PDU2 format)
  • PS: PDU specific. Either destination address or group extension.
  • SA: Source address of controller application (CA).

J1939 PGN Mapping

  • If PF < 240, then PGN = (DP << 9) + (PF << 8), else PGN = (DP << 9) + (PF << 8) + PS
  • Max number of PGNs: (240 + (16 x 256)) x 2) = 8,672

Example J1939 PGN

J1939 Wheel Speed Information

  • PGN: 65215 (0xFEBF)
  • Priority: 6 (default)
  • Length: 8
  • TX Rate: 100 ms
Image_15_1

J1939 Request PGN

  • PGN: 59904 (0xEA00)
  • Priority: 6 (default)
  • Length: 3
  • Destination: Global or specific
  • Bytes 1-3: PGN which is being requested

J1939 Proprietary A PGN

  • PGN: 61184 (0xFEBF)
  • Priority: 6 (default)
  • Length: 0 to 1785
  • Destination: Specific
  • Bytes 0 - 1785: Manufacture specific
  • Usage should not exceed 2% of network utilization

J1939 Proprietary B PGN

  • PGN: 65280 to 65535 (0xFF00 to 0xFFFF)
  • Priority: 6 (default)
  • Length: 0 to 1785
  • Destination: Global
  • Bytes 0 - 1785: Manufacture specific
  • Usage should not exceed 2% of network utilization

Questions

  • Does J1939 use CAN 2.0B or 2.0A?
  • CAN is centered around the ID, J1939 is centered around what?
  • What does the PF field tell you?
  • What questions do you have?

When 8 Bytes Isn't Enough

  • J1939 has a feature for PGNs up to 1,785 bytes. It's called the transport protocol. Two ways:
    1. Send data to global dst (BAM).
    2. Send data to specific dst (CM).
  • Both ways are similar when it comes to the data transfer part, but differ how they start and how fast data can be sent.
  • Only two PGNs are used: Connection Management and Data Transfer

J1939 BAM Big Picture

  • First: Transmit a message to the global address that says:
    1. I'm about to send the following PGN in multiple packets
    2. I'm sending X amount of data
    3. I'm sending Y number of packets.
  • Second: Send data, wait 50ms, send data, wait 50ms, ect...

BAM Message

Transport Protocol - Connection Management

  • PGN: 60416 (0xEC00)
  • Priority: 7 (default)
  • Length: 8
  • Destination: Global
  • Byte 1: Fixed at 32
  • Bytes 2-3: Message size in bytes
  • Byte 4: Number of packets
  • Byte 5: Reserved. Filled with 0xFF
  • Byte 6-8: PGN

Data Transfer PGN

Transport Protocol - Data Transfer

  • PGN: 60160 (0xEB00)
  • Priority: 7 (default)
  • Length: 8
  • Destination: Global
  • Byte 1: Sequence number (1 to 255)
  • Bytes 2-8: Data. Any unused locations in last packet should be filled with 0xFF

BAM Example

Example transmission of VIN. PGN 65260 (0xFEEC). Assumes VIN is 17 bytes long and is simply 1 through 17. VIN ends with an asterisk '*'.

Time (ms) PGN DST 0 1 2 3 4 5 6 7
0 60416 255 32 18 0 3 255 EC FE 0
50 60160 255 1 1 2 3 4 5 6 7
100 60160 255 2 8 9 10 11 12 13 14
150 60160 255 3 15 16 17 '*' 255 255 255

Destination Specific Big Picture

  • First: Transmit a RTS message to the specific address that says:
    1. I'm about to send the following PGN in multiple packets.
    2. I'm sending X amount of data.
    3. I'm sending Y number of packets.
    4. I can send Z number of packets at once.
  • Second: Wait for CTS: CTS says:
    1. I can receive M number of packets at once.
    2. Start sending with sequence number N.
  • Third: Send data. Then repeat steps starting with #2. When all data sent, wait for ACK.

CM Example

Image_34_1

RTS Message

Transport Protocol - Connection Management

  • PGN: 60416 (0xEC00)
  • Priority: 7 (default)
  • Length: 8
  • Destination: Specific
  • Byte 0: Fixed at 16
  • Bytes 1-2: Message size in bytes
  • Byte 3: Number of packets
  • Byte 4: Total number of packet sent in response to CTS.
  • Bytes 5-7: PGN

CTS Message

Transport Protocol - Connection Management

  • PGN: 60416 (0xEC00)
  • Priority: 7 (default)
  • Length: 8
  • Destination: Specific
  • Byte 0: Fixed at 17
  • Byte 1: Max number of packets that can be sent at once. (Not larger than byte 5 of RTS)
  • Byte 2: Next sequence number to start with
  • Bytes 3-4: Reserved. Filled with 0xFF
  • Bytes 5-7: PGN

End of Msg ACK Message

Transport Protocol - Connection

  • Management
  • PGN: 60416 (0xEC00)
  • Priority: 7 (default)
  • Length: 8
  • Destination: Specific
  • Byte 0: Fixed at 19
  • Bytes 1-2: Total message size in bytes.
  • Byte 3: Total number of packets.
  • Byte 4: Reserved. Filled with 0xFF
  • Bytes 5-7: PGN

Connection Abort Message

Transport Protocol - Connection Management

  • PGN: 60416 (0xEC00)
  • Priority: 7 (default)
  • Length: 8
  • Destination: Specific
  • Byte 0: Fixed at 255
  • Byte 1: Connection abort reason.
  • Bytes 2-4: Reserved. Filled with 0xFF.
  • Bytes 5-7: PGN

J1939 Address Claim

  • All ECUs must claim an address on the network.
  • Claim an address by sending PGN 60928 with the source address set to the address you want to claim.
  • If another ECU claims the same address, the ECU with the lower value NAME field wins. NAME field is 64 bits long and is placed in the data field of the address claimed message.
  • If an ECU loses, it can attempt another source address.
  • Two types: "Single Address" and "Arbitrary Address"

J1939 Address Claimed PGN

  • PGN: 60928 (0xEE00)
  • Priority: 6 (default)
  • Length: 8
  • Source: SA requested (254 for Cannot Claim)
  • Byte 1-8: NAME field

J1939 NAME Field

  • Arbitrary Address Capable: Specifies if the ECU can choose another source address if it loses the address claim procedure.
  • Industry Group: Specifies the industry. (e.g. on-highway or Ag)
  • Vehicle System Instance Group: Identifies a particular occurrence of vehicle system. (e.g. trailer #3)
  • Vehicle System: Identifies vehicle system (e.g. trailer)
  • Function: Identifies the function (e.g. ABS)
  • Function Instance: Identifies the function instance (e.g. ABS #1)
  • ECU Instance: Identifies the ECU instance inside of the function field. Used if you have two ECUs making up an ABS controller.
  • Manufacturer Code: Assigned by the SAE to identify your company.
  • Identify Number: Set by manufacturer. If all other fields are the same and two ECUs exist on the network, this field must be unique. (Last line of defense)

J1939/11 Physical Layer

  • J1939/11 Physical Layer
  • Max bus length: 40 meters
  • Max stub length: 1 meters
  • Max node count: 30
  • Shielded twisted pair. Shield is connected directly to ground at center of backbone.
  • Clock tolerance: +/- 0.05%
  • Sample point as close to .875 but not past.

J1939/15 Physical Layer

  • Max bus length: 40 meters
  • Max stub length: 3 meters
  • Max node count: 10
  • Unshielded twisted pair.
  • Clock tolerance: +/- 0.05%
  • Sample point as close to .875 but not past.
  • 200-500ns rise and fall time for CAN signal

Document Summary

  • J1939: Parent. Includes things not listed elsewhere.
  • J1939/11: Physical layer
  • J1939/13: Off-board diagnostics connector
  • J1939/15: Physical layer
  • J1939/21: Data link layer
  • J1939/31: Network layer
  • J1939/71: Vehicle application layer
  • J1939/73: Diagnostics
  • J1939/81: Network management

References

  • BOSCH CAN Specification
  • SAE J1939/11 Physical Layer
  • SAE J1939/15 Physical Layer
  • SAE J1939/21 Data Link Layer
  • SAE J1939/71 Application Layer
  • SAE J1939/81 Network Management

Post Class Questions

  • E-mail: jrsimma "at" simmasoftware "dot" com
  • Phone: 888-256-3828