Site Information

 Loading... Please wait...

A Beginner's Guide to SAE J1939 Embedded Software Development

Posted by Wilfried Voss on

Introduction

Welcome to my beginner's guide! By opening this page, you have entered the first and probably most crucial stage toward developing your SAE J1939 project: Reading. Over the years, I dealt with many newcomers to the J1939 technology, some of them motivated by great product ideas. Others were thrown into a project because they were embedded system programmers. What they all had in common was that they were grateful to have found me, and they all wanted to pick my brain. The problem is, while I happily share my knowledge, a phone call or multiple emails cannot sufficiently explain the topic of J1939 embedded software development. My answer was always consistent and sometimes frustrating for the engineer eager to get his hands on some embedded hardware: You need to grasp your development's full scope, and that includes a solid understanding of the SAE J1939 protocol. The J1939 serial protocol is not complicated, but it comes with a multitude of ingenious features, and learning about these features will speed the development process. You also need a basic set of development tools, including a J1939 monitoring and simulation network. I will explain everything in the following, and I will provide references for you to check out.

Let's start with the reading part. I have invested significant efforts to document everything regarding SAE J1939 development on this website and books I wrote. Consequently, I will mostly point you to existing posts plus a few additional resources. Whenever necessary, especially when it comes to development tips, I will add previously undocumented tips.

Controller Area Network (CAN)

Every development involving SAE j1939 requires a basic knowledge of Controller Area Network (CAN). The CAN Bus provides the hardware layer for J1939, i.e., the serial connection. Let me stress the word “basic:” It helps to understand the CAN Bus technology, but what kind of knowledge level you would like to reach is up to you. The following references start with a basic overview, continuing to more detailed literature.

A Brief Introduction to Controller Area Network:
https://copperhilltech.com/a-brief-introduction-to-controller-area-network/

Controller Area Network (CAN Bus) – Serial Network Technology for Embedded Systems (PPT Presentation):
https://copperhilltech.com/blog/controller-area-network-can-bus-serial-network-technology-for-embedded-systems/

A Comprehensible Guide to Controller Area Network:
https://copperhilltech.com/a-comprehensible-guide-to-controller-area-network/

SAE J1939

SAE J1939 is a higher-layer protocol that uses the CAN Bus technology as the hardware layer. The protocol is not complicated, and it is well documented. The complete SAE J1939 Standard comes in the form of a colossal work of 1600+ pages with a painfully high price tag. Consequently, I don’t necessarily recommend buying it to learn J1939. Here, too, the following references start with a basic overview up to detailed literature.

A Brief Introduction to the SAE J1939 Protocol:
https://copperhilltech.com/a-brief-introduction-to-the-sae-j1939-protocol/

SAE J1939 – Serial Control and Communications Vehicle Network:
https://copperhilltech.com/blog/sae-j1939-serial-control-and-communications-vehicle-network/

SAE J1939 Address Claim Procedure – SAE J1939-81 Network Management:
https://copperhilltech.com/blog/sae-j1939-address-claim-procedure-sae-j193981-network-management/

After you worked through the SAE J1939 documentation, you will realize that almost everything regarding J1939 programming has to do with reading and transmitting PGNs (Parameter Group Numbers). However, many beginners don’t realize that the read/write process comes with some exceptions:

  • Not all PGNs are dedicated to engine data and performance. A great range of PGNs is used for network management, diagnostics, and more.
  • Not all data containing PGNs are transmitted periodically using their individual message frequency. Some data are only available per request.
  • In order to transmit a PGN into an SAE J1939 network, you need to acquire a node address first.

For the beginner, that means, when it comes to PGNs, familiarize yourself with:

  • The PGN range.
  • The difference between message broadcasting and peer-to-peer communication.
  • The message request procedure.
  • The address claim procedure.

SAE J1939 - Digital Annex

We’re still looking at PGNs… In order to determine the nature of data containing PGNs, you will need to purchase the SAE J1939-71 Standard. J1939-71 specifies the application layer for a J1939 network, and it is responsible for defining all application layer SPNs and PGNs. Also included in this specification are parameters, offset, scaling, and acceptable range.

However, the SAE (Society of Automotive Engineers) also offers a digital form of SAE J1939-71, called J1939DA (Digital Annex). The digital annex is a Microsoft Excel file that contains all PGNs and their description. It can be sorted and searched for easier use. Yet again, it comes with a hefty price tag of $260 (at the time of this writing), but it is well worth the investment as it will help with your development.

Reference:
https://www.sae.org/standards/content/j1939da_202003/

SAE J1939 Data Traffic Simulation and Monitoring

For obvious reasons, most engineers will not have the opportunity to perform tests of their devices on a real-world, running vehicle. For that reason, we at Copperhill Technologies have developed several devices for SAE J1939 data simulation, monitoring, and recording.

But let’s make this a point: When it comes to developing and testing your application, you will need a J1939 network. A single node connected to your device will not do. A working network provides J1939 operation under stable conditions, i.e., the assurance that any possible communication problems have to do with your device (no pun intended; that’s just in the nature of things).

Let me explain the single-node insufficiency: I have had several cases where users challenged the proper operation of our single-node simulator. The problem was always solved by checking the following:

  • Did you activate the termination resistors on both devices?
  • Are you using the same CAN baud rate on both devices?
  • Is your device in silent mode?

Silent mode devices are “invisible” to the rest of the network. They must be tested while connected to a running network. See: How CAN Bus Automatic Baudrate Detection Works And What To Consider When Connecting To A Network.

SAE J1939 Starter Kit and Network Simulator:
https://copperhilltech.com/sae-j1939-starter-kit-and-network-simulator/

Last, but not least...

As I mentioned earlier, I have invested significant efforts to document everything regarding SAE J1939 development on this website. Whenever you see a product on this website that sparks your interest, please take your time to check out and read all the references on the product’s page, as they may address your concerns and questions.