×

Happy to Help!

This website doesn't store cookies. Enjoy the experience, without worrying about your data!

Great, thanks!

How to Test Quality of J1939 Software Source Code

  • 0

How to Test Quality of J1939 Software Source Code

If your technology R&D department is in search of an off-the-shelf J1939 software solution for ECU communication or diagnostics applications then this article will be a good read.

Our J1939 software development team has shared a placid walk-through of the basic functions that needs to be tested, of each layer of the protocol stack to ensure that you purchase a quality J1939 source code.

For starters, we will introduce J1939 software stack and understand the benefits of integrating pre-tested J1939 software stack solution.

What is J1939 protocol software?

J1939 stack is a software solution developed to support seamless communication and diagnostic services within the in-vehicle network (based on CAN bus protocol).

J1939 protocol based software stack is designed for commercial vehicle applications.

J1939 software stack is complaint to Society of Automotive Engineers (SAE) J1939 standard.

This automotive protocol stack has layered software architecture based on seven-layer ISO-OSI model.

The layers required to be configured and integrated while porting the embedded software depend on the requirement of the specific automotive applications.

The consistent layers of the J1939 software stack, available as off-the-shelf solution include: Data link layer, Network management layer and application layer.

Represented in the figure below, is the architecture of J1939 software stack:

J1939 Software Stack

Source: https://www.embitel.com/blog/embedded-blog/what-is-j1939-software-stack

What are the benefits of integrating a verified and validated J1939 software stack?

J1939 stack is readily available as an off-the-shelf solution. A number of automotive engineering services and tool vendors have launched their pre-packaged and pre-tested SAE J1939 solution.

Integration of such re-usable J1939 software solution with automotive and tooling applications ensures significant savings in development time and cost.

Purchasing an off-the-shelf SAE J1939 protocol stack is a cost-effective option in scenarios similar to the following:

  • As an automotive OEM or Supplier, your R&D team wants to focus on core product development activities.
  • Your in-house R&D or embedded software development team do not have expertise in protocol stack design and development.
  • Your team is facing certain road-block during product development and there are time and cost constraints.

Partnering with a renowned embedded software development vendor also has an added advantage of testing, support and maintenance services that are part of the engagement.

Now that you have arrived at the decision of outsourcing or purchasing pre-tested SAE J1939 stack solution, it is important that you invest in good quality software.

A pre-tested and pre-packaged J1939 software solution ensures you a re-usable stack, thus setting a benchmark among the variety of other automotive software services vendors.

Validating or testing the layered architecture design of J1939 stack

As already mentioned, J1939 software stack typically consists of the following layers:

  1. Data Link / Transport Layer (J1939/21)
  2. Network Management Layer (J1939/81)
  3. Vehicle Application Layer (J1939/71 & 73)

Here are some of the specific basic functions that need to be checked in each of these layers.

Data Link / Transport Layer:

  1. Peer to Peer communication
  2. Broadcast Announce Message

Network Management Layer:

  1. Address Claim Message
    • Self – Configurable Address
    • Commanded Message

Vehicle Application Layer:

  1. Tx and Rx of Standard SPNs packed in PGN’s.

How to check the basic functions of different layers of J1939 solution?

To test the specific functions of each layer, one can design certain test cases.

The derived outcomes indicate if the concerned layer has been designed as per the desired quality or not.

Checking for the aforementioned functionalities ensures an efficient and cost-effective J1939 stack.

J1939/21 – DataLink / Transport Layer:

  1. Peer to Peer Transport Protocol: Peer to peer TP is a dedicated protocol in which the source and destination is following a one-to-one (among ECUs) data transmission.
  1. Broadcast Announce Message(BAM) : BAM is the acronym used for Broadcast Announce Message, generally used for transmission of data greater than 8 bytes.

The BAM is a protocol that follows the one-to-many pattern of communication among the ECUs.

Both the peer to peer and BAM has a particular sequence and  structure as defined by the SAE standard. We can validate the structure and functionality using case scenarios and demo PGNs.

For example:

We can check for transport Broadcast Announce Message using CAN tool, by checking if the ECU (electronic control unit) under test, is transmitting BAM Message with 8 bytes of data message.

These 8 bytes should encompass the first message as sequence number and remaining 7 bytes are data.

Also unused data bytes of last transport data packet should be filled with 0xFF, according to ideal scenario.

J1939/81 -Network Management layer:

  1. Address claim: Each device connecting to the network sends an immediate acknowledgement in form on address claim message.Now, there can be conflicts in the addresses (duplicity) of the devices that send the address claim messages to the network.This situation can be mitigated by two logical manipulations:
    • Self-configurable address: The algorithm should affirm the ECU’s ability to randomly pick its own address in case of conflict. The priority of the devices should be taken into consideration while address claiming during integration of the stack with application.
    • Commanded Message: This again is an algorithm specified message which claims the address according to the input command.

While testing for the above functionality we make sure, the PGN to be tested satisfy the criteria of the test case.

For example:

To check address claim message, a CAN tool can be used. The ECU under test which is being ported with J1939 software stack, should send the first message as an address claim message to claim the address on the network.

Similarly test cases can be checked for self-configurable and commanded message functionalities.

J1939/71 & 73- Vehicle Application Layer

Vehicle Application Layer of J1939 protocol stack manages transmitting and receiving of PGNs’ (Parameter Group Number) messages within the in-vehicle CAN network.

Each PGN consists of various SPNs’ (Suspect Parameter Number) which are nothing but vehicle parameter data fetched from the CAN network.

Such data (SPNs’) are received and transmitted by automotive ECUs’ (control units) through Vehicle Application Layer.

The J1939/71 & 73 protocol standard has a defined unique SPN for each vehicle parameter.

For example – For engine RPM there is a pre-defined unique SPN mentioned in J1939/7x documents.

For testing the source code of J1939 stack designed by an embedded services vendor, one needs to check if control units within the network are able to accurately transmit and receive the data parameters stored in SPNs’

Let’s take an example of SPN 177, which represents Transmission Oil Temperature in PGN 65272.

It consists of two bytes of data. The value of Transmission Oil Temperature ranges from -273 to 1735 degree centigrade with offset of 0.03125 deg C / bit.

With the help of a CAN Tool one can monitor the Tx& Rx of this SPN in PGN 65272 over a CAN Bus network

Change the values from minimum to medium range and to maximum range and check if it is being transmitted correctly between the ECUs’ over CAN network.

 

SAE J1939 standard

 

The pre-tested layers of J1939 source code as informed in the testing guide above, will help you to make more informed decision before outsourcing the software development project.


  • 0

J1939 and OBD2 Stack Integrations With IoT Platform for Fleet Safety

 

Customer:

An automotive after-market company, with product development centers in USA and India, that provides IoT solutions for commercial vehicles and driver analytics.Our customer has designed innovative driver and fleet safety solutions leveraging Deep Learning, Video Analytics and Artificial Intelligence (AI).

 

Business Challenge:

  • One of the driver and fleet safety solutions monitors a range of driving data like seat-belt detection, driver drowsiness, speed of the fleet, engine temperature, emission control, diagnostics  and other automotive ECU (electronic control unit) related data
  • While the driver and environment related data is captured through vision sensors and cameras, a host of vehicle diagnostics and engine data is available only through CAN/LIN in-vehicle networks
  • Our customer was looking for an automotive embedded systems partner with expertise in vehicle diagnostics, J1939 and OBD2 stacks integration and CAN/LIN interface development
  • The customer had recognized the need for a customized solution to meet the unique needs of their AI-based product. However, they also expected the product engineering services partner to help them reduce time-to-market and costs

 

Embitel Solution:

  • Our Automotive Software development team has designed pre-tested, easily configurable and re-usable SAE J1939 and OBD2 (on-board diagnostics) software stacks
  • During the technology workshops, our customer developed trust in our capabilities and the quality of our automotive communication and vehicle diagnostics stacks (J1939 and OBD2)
  • The customer also developed the confidence that configuration and integration of J1939 and OBD2 software stacks will ensure reduced time-to-market and embedded software development costs
  • Our automotive software developers implemented integration of SAE J1939 and OBD2 stacks with Freescale/NXP MCS9S12G controller
  • These pre-tested SAE J1939 and OBD2 software stacks were customized to collect vehicle diagnostics, ECU communication and emission control related data and feed it to the IoT platform
  • SPI interface was designed to facilitate communication between Freescale/NXP controller and the processor of the IoT device
  • Our embedded software team developed a gateway software to capture and process data from CAN/LIN and send it to the processor in a compatible format
  • We also integrated a Flash Boot loader for ECU (electronic control unit) reprogramming through SPI
  • Our team designed and integrated all the low-level device drivers and also customized SPI drivers to support processor and controller communications

 

Embitel Impact:

  • On-chip memory consumption was a critical technology challenge in this project since we were integrating J1939 and OBD2 software stacks with the IoT device for fleet safety and alerts
  • Our automotive team followed best practices of embedded software development and customized the configuration of J1939 and OBD2 stacks to overcome the on-chip memory limitation
  • Since the J1939 and OBD-II stacks and low-level device drivers were pre-packaged, pre-tested and were readily available for deployment, it helped us save software development costs and time for the customer

 

Tools and Technologies:

  • CanOe tool for capl scripting
  • Dcan and Samdia tools for configuration and testing of J1939 stack
  • Freematics OBD-II Emulator for OBD2 stack configuration and testing
  • Software coding language : Embedded C
  • Software IDE: Code Warrior
  • Automotive Protocols : CAN, J1939 and OBD-II