Additional Information

Site Information

 Loading... Please wait...

SAE J1939 Programming with Arduino - Functionality Settings

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

Overall, the sketch supports three versions of the ARD1939 protocol stack, two for the Arduino Uno (ARD1939-Uno and ARD1939-Uno/TP) and one for the Arduino Mega 2560 (ARD1939-Mega).

  1. ARD1939-Uno – For the sake of saving memory resources, this version does not support the Transport Protocol (TP) according to SAE J1939/21.
    Program Storage Space: ~8,200 bytes (~25%)
    Dynamic Memory: ~510 bytes (~25%)
    Message Filters: 10
  2. ARD1939-Uno/TP – This version supports the Transport Protocol (TP) but only for message lengths up to 256 bytes.
    Program Storage Space: ~12,000 bytes (~37%)
    Dynamic Memory: ~1,100 bytes (~55%)
    Message Filters: 10
  3. ARD1939-Mega – This version supports the full SAE J1939 protocol stack including Transport Protocol (TP) for message lengths up to 1785 bytes according to the J1939 standar

Program Storage Space: ~12,300 bytes (~4%)
Dynamic Memory: ~4,600 bytes (~56%)

Note: The exact program storage space and dynamic memory requirements also depend on the extend of the actual J1939 application in the loop () function.

The functionality settings can be found inside the ARD1939.h file, which is part of the project.

The program version (ARD1939VERSION) allows the activation of the Transport Protocol (TP) where 1 = active and 0 = inactive. You can also experiment with the maximum message length (J1939_MSGLEN) and the number of supported message filters (MSGFILTERS), but please pay attention to the Arduino compiler message. It may warn you of memory size problems.

Also, feel free to browse through the file as it allows you a number of further customized settings such as:

  • Preferred Source Address
  • Address Range
  • NAME settings

I am repeating myself here (see chapter SAE J1939/81 – Address Claim Procedure), but I deem the reference necessary at this point:

Note: The NAME fields have been assigned in a way that they will not interfere when used within an existing vehicle network. This has been done by setting the Identity Number and Manufacturer Code to the maximum value, which will result in a more passive role during the address claim process. An ECU with a NAME of higher value is more likely to lose the competition with another node using the same address.

All settings as shown are used for demonstration purposes only. In all consequence, you must follow the SAE's recommendations. Also, you alone (and not the author or publisher) are responsible for the final implementation and the results thereof.


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...