Press "Enter" to skip to content

ARD1939 – SAE J1939 Protocol Stack Code for Embedded Systems

Foreword

by Wilfried Voss, author of SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino

I find it necessary to highlight a few non-technical (and perhaps politically incorrect) aspects of developing what I consider the most interesting feature of my book—the ARD1939, an SAE J1939 protocol stack for Arduino.

Traditionally, implementing an SAE J1939 protocol stack has been financially out of reach for many engineers. The software—whether as source code or object code—often comes with exorbitant costs or hefty royalties, requiring payment for each copy. However, with Arduino hardware, this is changing. The ARD1939 protocol stack is now available as a free download.

Frankly, for an experienced programmer, developing an SAE J1939 protocol stack is not particularly challenging. The real hurdle is the cost of acquiring the official SAE J1939 Standards Collection. I stand by my code, considering it on par with commercially available protocol stacks. I have successfully tested it against multiple commercial SAE J1939 devices.

While I initially considered releasing ARD1939 as open-source, I ultimately chose to provide it as pre-compiled code. This decision was primarily out of respect for small businesses that rely on selling SAE J1939 devices and software tools.

That said, the original source code is adaptable to other embedded hardware (I have it running on an ARM system) and even Windows or Linux PCs with CAN capabilities.

For the average Arduino user, the pre-compiled ARD1939 code should be more than sufficient to develop effective SAE J1939 applications. Access to the source code is unnecessary since the stack supports all SAE J1939 protocol features—the real focus should always be on the application itself.

Note: With the release of my upcoming book J1939 Development of Embedded Systems, I will also release the full source code of the ARD1939 protocol stack.


Join the J1939 Community

Become part of the J1939 community on our website, where you’ll find project updates, technical discussions, programming tips, code examples, and opportunities to exchange ideas with fellow developers.


Functionality

Fully functional SAE J1939 protocol stack, according to:

  • SAE J1939/21 (Network Management, Address Claim Process)
  • SAE J1939/81 (Transport Protocol, the transport of messages of up to 1785 bytes, including BAM and RTS/CTS sessions)*
  • SAE J1939/73 (Application Layer – Diagnostics), including automatic handling of multi-packet Diagnostic Messages via the SAE J1939 Transport Protocol
  • Does not currently support SAE J1939/22 (CAN FD). Since customer demand has been minimal, development has focused on Classical CAN (SAE J1939). Support for SAE J1939/22 is planned for a future release.

* The Transport Protocol (TP) supports one concurrent Broadcast Announce Message (BAM) session and one concurrent RTS/CTS session. This design is sufficient for the overwhelming majority of SAE J1939 applications, as simultaneous multiple TP sessions are uncommon in practice.


Applicable Hardware

* I chose the Arduino Uno as the initial development platform for ARD1939, not because of its low cost, but to ensure that the protocol stack would run reliably even on resource-constrained microcontrollers. As it turned out, however, the Uno’s limited RAM imposes practical restrictions on the implementation of the SAE J1939 Transport Protocol (TP), allowing support for only a simplified version of its functionality. On all other platforms tested—including the Arduino Due, ESP32, and Teensy—ARD1939 supports the complete TP feature set without such limitations.

Designed for maximum portability, ARD1939 uses standard, generic C++ throughout. Porting the protocol stack to other microcontroller families—such as ARM Cortex-M, STM32, NXP, Renesas, or Microchip devices—typically requires only the implementation of the hardware-specific timer functions and CAN driver interface. The protocol logic itself remains unchanged.


ARD1939 – Implementation and Technical Insights

SAE J1939 ECU Programming & Vehicle Bus Simulation with ArduinoAll technical information about ARD1939, the SAE J1939 protocol stack for Arduino, plus detailed description of implementation and available function calls is included in SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino by Wilfried Voss.

While this book primarily uses Arduino-based platforms such as the Uno, Due, and Mega 2560 for its examples, the documentation of the ARD1939 protocol stack and the associated programming concepts apply equally to other supported microcontroller families, including ESP32, Teensy, and similar platforms. Since the protocol stack is implemented in standard, hardware-independent C++, the underlying concepts and programming techniques remain the same regardless of the target hardware.

Arduino sketches (software projects) include a J1939 network scanner, and a simple SAE J1939 to USB Gateway application with associated Windows GUI (Visual Studio C# project).

The collection of sketches is concluded by the ARD1939 project, a fully functional SAE J1939 protocol stack for the Arduino Uno and Mega 2560.


Download ARD1939 and Programming Samples

All programming samples in the book and on this website are free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The samples are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. With downloading these programs, you confirm that these code samples and projects were created for demonstration and educational purpose only.


Disclaimer of Warranty and Support

Please note that the software is provided “as is” and does not include technical support.

That said, we can confirm that it has been successfully tested by numerous engineers and works reliably with platforms such as the Arduino Uno, Mega 2560, Due, and ESP32. This software is intended purely for demonstration and educational purpose. It is not intended for commercial use.

If you plan to use the code in a professional or commercial application, we strongly recommend purchasing a professionally supported protocol stack from a reliable vendor. These solutions typically include technical support and are better suited for production environments.

Thank you for your understanding.


A Comprehensible Guide to SAE J1939A Comprehensible Guide to J1939 is the first work on the SAE J1939 protocol 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.

The information in this book is based on two documents of the SAE J1939 Standards Collection:

  • J1939/21 – Data Link Layer
  • J1939/81 – Network Management

This book attempts to create an enjoyable and readable SAE J1939 reference for everybody. The information provided in this book is, besides the SAE J1939 Standards Collection, based on publicly available information such as, but not limited to, websites and printed literature, as well as contributions by engineers familiar with Controller Area Network and the SAE J1939 protocol. The information in this book, while based on the J1939 standard, is not a reproduction of any copyrighted SAE document. More Information…

Copyright © 2024 Copperhill Technologies Corporation
wpChatIcon
wpChatIcon