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 and Bosch CAN specification.
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 (NMEA2000).
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.
SAE J1939 uses a simple datalink layer to communicate information. Altogether there are six subfields which are encoded into the 29-bit CAN identifier, they are shown below and are: Priority, Extended Data Page, Data Page, Protocol Format, Protocol Specific, and Source Address.
P is the priority of the message, EDP and DP make up 4 different pages with one page being reserved for ISO 15765-3. PF and PS define the parameter group number and destination address, and SA is the source address of the controller application. For details about this encoding, refer to SAE J1939-21.
At the heart of J1939 is the Parameter Group Number (PGN), which is a unique number
assigned to every J1939 message. The PGN serves to identify the message and its data.
Although sometimes a message will contain a single parameter (e.g. VIN), typically the
PGN will contain a group of parameters. In the standard there is a total of 8,672 PGNs.
For an example message, take PGN 61,444. It identifies the "Electronic Engine Controller
1" message. Per the specification, "EEC1" has seven different parameters embedded in
the data field of the message. Engine RPM is one of those seven parameters.
J1939 Message Sizes
J1939 has three different allowed message sizes, they are: 3 bytes, 8 bytes, and variable
length. There is only one message which is three bytes in length, and that is the request
message (PGN 59,904).
The majority of messages in J1939 are 8 bytes in length. This allows for a more efficient
use of the network bandwidth by maximizing the amount of data on the network by
reducing the number of messages.
Variable length messages are messages with a length from 9 to 1,785 bytes. These
messages are too large to fit in a single CAN data frame and must be fragmented by the
transmitter and reassembled by the receiver. This process is defined by J1939's transport
protocol which is specified by J1939-21.
The transport protocol layer defines two different types of message fragmentation: BAM and CM. There are several differences between those two types, the main difference being the destination address. A BAM uses a global destination address and is therefore sent to all CAs, while a CM is destination specific. Due to the addressing scheme, only a single BAM can be transmitted simultaneously, while multiple CMs using different destination addresses may be simultaneously transmitted.
Another difference between BAMs and CMs is the time is takes to send a messages. With a BAM, data packets must be spaced at least 50 ms apart and no more than 200 ms. With a CM, data frames may be sent as quickly as possible.
J1939 Physical Layers
Currently there are two 250 Kbps physical layers defined, J1939-11 and J1939-15, with a
500 Kbps layer, J1939-14, under development.
J1939-11 specifies a shielded twisted pair of wires with a maximum backbone length of 40 meters and maximum stub length of 1 meter. It uses a three pin connector and allows for up to 30 nodes.
J1939-15 specifies an unshielded twisted pair of wires with a maximum backbone length of 40 meters and maximum stub length of 3 meters. It uses a two pin connector and allows for up to 10 nodes.
J1939 CAN Parameters
SAE J1939-11 and -15 specify a network data rate of 250 Kbps with a minimum period of 3.998 us and a maximum period of 4.002 us. CAN networks also allow and require for custom sample point settings. For J1939, the sample point setting has a maximum value of 87.5%. Nodes should be set as close as possible but not exceed 87.5%.
CAN peripherals also allow for synchronous jump width (SJW) settings of 1 to 3. The SJW value dictates how much time can be added or subtracted to the node's CAN clock for syncronization purposes. J1939 allows only for a single SJW.
J1939 Shield Termination
For networks with a shield, in one spot with least electrical noise and close to the middle, the shield should be connected directly to ground.
Nodes will connect to the shield via a resistor and capacitor in series. The resistor should have a value of 1 ohm and the capacitor should have a value of 0.68 uF.
J1939 Clock Tolerance
J1939, which is based on a CAN bus, has a much tighter clock tolerance than what is stated in the CAN ISO 11898 documents. CAN specifics a tolerance of 1.58% while J1939-11 and J1939-15 specify a clock tolerance of 0.05%. Because of these tight tolerances, CAN peripherals often may not be driven by PLL (Phase Lock Loop) and FLL (Frequency Locked Loop) multipliers.
PLLs and FLLs, which are used to multiply frequencies introduce clock jitter. Clock jitter is variation from period to period in a clock signal. Crystals have very low jitter as compared to PLL/FLL circuits. Due to this, jitter can introduction errors into the CAN bus. Consult the microcontroller datasheet for PLL/FLL jitter amounts.
J1939 Network Termination
All SAE J1939 networks utilize, and require, two resistors at each end of the backbone. These resistors are balanced with the impedance of the network cable and prevent electrical reflections. Reflections are much like audiable echos, and without dampening, can prevent high-speed operation.
SAE J1939-11 and J1939-15 both specify terminating resistors should not be contained inside of electronic control units. If resistors are placed inside of an ECU, if that ECU is removed from the network then the network will fail to operate. This also allows for backbones to be extended as needed. Instead, terminating resistors should be placed into cable plugs which serve to seal and cap the end of networks. Terminating resistors have a minimum resistance of 110 ohms, typical of 120 ohms, and maximum of 130 ohms.
J1939 Protocol Stack
What is a J1939 protocol stack? A J1939 protocol stack is a software library that handles the appropriate layers of the OSI 7 layer model.
J1939 specifies layer 1 (physical), layer 2 (data link), layer 3 (network), and layer 4 (transport), and layer 7 (application).
In simple terms, a J1939 protocol stack, for inbound data, will convert and reassemble received raw CAN frames and present complete and valid J1939 messages to the user's application.
For outbound data, a J1939 protocol stack will accept complete messages from the user's application then convert, fragment, and transmit raw CAN frames onto the J1939 network.
J1939 NAME Field
Every ECU, or CA (controller application) on a J1939 network has a unique NAME. The NAME is 64 bits wide and is made up of the following fields: Arbitrary Address Capable, Industry Group, Vehicle System Instance, Vehicle System, Reserved Bit, Function, Function instance, ECU Instance, Manufacturer Code, and Identity Number. The NAME field gives each CA a unique identity. Nodes on the network use the NAME field to distinguish between each other. The NAME field is also essential to Network Management as it establishes node priority. The NAME translates to a number; the lowest numeric values have the highest priority when claiming addresses.
An ECU may contain multiple CAs and NAME fields.
J1939 Address Claiming
In J1939 CAs, or electronic control units, on the vehicle network bus must claim a unique source address to enable communication. Addresses 0 to 128 are pre-assigned and CAs which use these addresses are allowed to communicate immediately after power up. In anticipation of future devices and functions, however, J1939 includes a method for dynamically assigning addresses. New devices must announce an address for themselves by transmitting an address claim message.
Sending an Address Claim message the new (non-addressed) device sends out an Address Claim PGN indicating the address it is assuming. All devices on the network compare this newly claimed address with their internal address tables. If the address is already in use by a device with a higher priority (determined by the NAME), the higher priority device indicates the conflict by sending out a Address Claim message. The lower priority device immediately stops using the address and must claim a new one.
About the SAE
SAE, Society of Automotive Engineers, is an organization of engineers and technical experts in the aerospace, automotive and commercial-vehicle industries. Their primary goal is to develop technical standards, for example: SAE J2497, SAE J1939, SAE J1850, SAE J1587, and SAE J1708. The SAE provides a venue for government and businesses to agree on technical standards for the worldwide vehicle mobility industry. In general these standards are only recommended practices, which means there is no legal mandate for business to adhere to them. However sometimes goverments madate adoption (e.g. OBD2 and SAE J1979).
J1939 Protocol Dictionary