The following refers to a Visual Studio C# application, representing a very simplified version of our jCOM1939 Monitor – SAE J1939 Monitor, Analyzer, And ECU Simulator. The jCOM1939 Monitor Software is a tool to monitor, analyze, and simulate SAE J1939 data traffic. The system combines our jCOM.J1939.USB that functions as an SAE J1939 to USB (or UART) gateway. A comprehensive and easy-to-use, easy-to-understand Windows software displays not only SAE J1939 data traffic; it also allows to scan the network, simulate an ECU (incl. full node address negotiation features), and respond to data request messages.
It is important to point out that you will need one of our gateways for both program versions, the demo code and the actual monitor program, to work. The programs are not designed to work with any other hardware from other manufacturers.
The jCOM1939 Monitor software works directly with the following SAE J1939 gateways:
- SAE J1939 ECU Simulator Board With USB Port
- jCOM.J1939 Starter Kit And Network Simulator
- SAE J1939 to Bluetooth Gateway With 9-Pin Deutsch Connection Cable
- SAE J1939 to RS232 & USB Gateway With 9-Pin Deutsch Connection Cable
In contrast to the full monitor software, the demo program, as introduced in this post, is available in full source code. The C# code was developed using Visual Studio 2013, but it can be easily imported to newer versions.
The first step of handling the software is to select the COM port that was 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, you will see the heartbeat messages appearing on the screen. The gateway sends the heartbeat message every one second.
Clicking on the Request Status will provide a 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 will need to 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.
In order to transmit data into an SAE J1939 network, you will need to claim a node address. This is accomplished by clicking Claim Address. Please be aware 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 will be able to transmit data into the network. Yet again, all parameters such as 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 engage into a detailed description of the source code, since this would require some tremendous efforts 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 most important commands to the gateway and how to receive feedback and data.
However, in order to understand the protocol between the gateway and the PC, you will need to read our document (PDF):