The Society of Automotive Engineers standard SAE J1939 is the vehicle bus recommended for communication and diagnostics among vehicle components. It was originally developed for use in heavy-duty industrial vehicles in the United States and is now widely used around the world for a range of automotive applications.

The SAE J1939 protocol uses CAN (Controller Area Network, ISO 11898-1 and ISO 11898-2) as the physical layer. The CAN protocol plays a major role in motor vehicle networking and is a commonly used method of communicating between electronic control units (ECUs). Typical ECUs include: engine, transmission, brakes, instrument panel and doors.

The Project

Our customer, a specialist in liquid level measurements, identified an opportunity to expand their product range by adapting an existing liquid level sensor to have a CAN/J1939 interface.

Their existing sensor had a variable voltage output and a UART interface for configuration, calibration and diagnostic information. The firmware for the original sensor was written in assembler and the customer wanted the new sensor to be written in C.

They supplied the source code to a C# desktop application used to communicate via UART with the existing technology for firmware updates, calibration, configuration and diagnostic purposes.

Our Role

Our first tasks were to complete the customer’s outline specification and to write a design document for the software.

Once the requirements were finalised and agreed, we implemented the firmware. The firmware implementation was flexible enough that we could produce an interim release part way through the project so the customer could demonstrate some features to a potential client.

Concurrently, we updated the Windows Forms desktop application for the new sensor, maintaining the coding standard and general structure.

The Technology

We completed and tested the initial development on an ATSAMC21X-PRO development board and then swapped to the target hardware when early prototypes where available.

We carried out the development using the MPLABX IDE and the Microchip XC32 compiler. The firmware was written in C and the Microchip Harmony library was used.

The Windows Forms application was written in C#.

The validation was performed using a Total Phase Komodo CAN Dual Interface unit and associated Total Phase software.

The Benefit

By taking advantage of our software experience, the customer was able to adopt a higher-level language and a flexible architecture for their new sensor’s firmware.

In choosing a higher-level language for the firmware, it became significantly more maintainable.

It also now acts as a platform to convert their other sensors to the J1939 standard.

Related Projects