Press "Enter" to skip to content

SAE J1939 ECU Simulator Board Programming with Visual Studio C#

This post refers to a simplified version of our SAE JCOM1939 Monitor – JCOM1939 Monitor, Analyzer, and ECU Simulator, a C# application created in Visual Studio. The JCOM1939 Monitor Software, a unique and powerful tool, allows you to monitor, analyze, and simulate SAE J1939 data traffic. It works seamlessly with our JCOM.J1939.USB device acting as an SAE J1939 to USB or UART gateway. With its user-friendly interface and comprehensive features, you can monitor SAE J1939 data traffic, scan the network, simulate an ECU, including full node address negotiation features, and respond to data request messages.

Hardware Requirements

It’s important to note that the jCOM1939 Monitor Software requires using our gateways for the demo code and the actual monitor program to function. Our software is specifically designed to work exclusively with our hardware and is not compatible with hardware from other manufacturers.

The jCOM1939 Monitor software works directly with the following SAE J1939 gateways:

In contrast to the complete monitoring software, the demo program introduced in this post is available in complete source code. The C# code was developed using Visual Studio 2013 but can be easily imported into newer versions.

Functionality

The first step in using the software is to select the COM port assigned to the gateway. The program offers choices by scanning the PC for available COM ports. After selecting the right COM port and clicking the Start command button, the heartbeat messages appear on the screen. The gateway sends the heartbeat message every second.

Clicking on the Request Status will provide feedback such as REPSTATUS – Listen-Only Mode, indicating that the gateway will only receive SAE J1939 PGNs and display them. However, be aware that you must set a PGN filter for data to be displayed. That PGN filter is hard coded as 65280 but can be modified to any other PGN.

Use the Add Filter command button to add the filter and Delete Filter to remove it.

To transmit data into an SAE J1939 network, you must claim a node address. This is accomplished by clicking Claim Address. Please know that you will need at least one other network node to establish communication; otherwise, the address claim will fail.

After the node address has been claimed successfully, you can transmit data into the network. Yet again, all parameters, such as the desired node address and the transmitted data, are hard-coded into the program but can be easily modified. After all, the code is designed to demonstrate the communication between the gateway and the PC.

C# Source Code

I will not describe the source code in detail since this would require tremendous effort and time. Every programmer with some basic C# experience will be able to recognize the important parts, and I have tried to keep the program as simple as possible. The code explains the gateway’s most important commands and how to receive feedback and data.

However, to understand the protocol between the gateway and the PC, you will need to read our document (PDF):

Download


SAE J1939 Starter Kit and Network Simulator

Our JCOM.J1939 Starter Kit and Network Simulator is designed to allow the experienced engineer and the beginner to experiment with SAE J1939 data communication without the need to connect to a real-world J1939 network, i.e., a diesel engine. To establish a network, you need at least two nodes. That fact applies especially to CAN/J1939, where the CAN controller will shut down after transmitting data without receiving a response. Therefore, our jCOM.J1939 Starter Kit and Network Simulator consists of two J1939 nodes, namely our jCOM.J1939.USB, an SAE J1939 ECU Simulator Board with USB Port.

The jCOM.J1939.USB gateway board is a high-performance, low-latency vehicle network adapter for SAE J1939 applications. The board supports the full SAE J1939 protocol according to J1939/81 Network Management (Address Claiming) and J1939/21 Transport Protocol (TP).

More Information…

Comments are closed.

Copyright © 2024 Copperhill Technologies Corporation