Site Information

 Loading... Please wait...

SAE J1939 Programming with Arduino – Application Structure

Posted by Wilfried Voss on

This post is part of a series about SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino.

SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino

As with every Arduino application, the initialization of data and the J1939 protocol takes place during the setup() function, while the actual application resides in loop().

  • setup() - The j1939.Init function is mandatory to operate ARD1939. You also need to set the preferred address and a NAME (for test purposes you can use the project default settings). Setting an address range is optional.

ARD1939 will not deliver any data (PGNs) unless you set the message filter. ARD1939 supports up to 10 (UNO) or 100 (Mega 2560) message filters.

  • loop() – This function must start with a delay() call, directly followed by j1939.Operate(). It is mandatory that the delay time and the time passed to j1939.Operate are identical, otherwise the protocol timing will be off, which, in turn, will cause error conditions.

The functionality settings can be found inside the ARD1939.h file:


A Comprehensible Guide to J1939

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.

Read more...