Logging J1939 data

In this section we outline how to log J1939 data with your CANedge.


Configure your device

A common use case for the CANedge is to log J1939 data from your heavy-duty vehicle.

Doing so is simple as you can simply connect the device to start recording raw J1939 data using the default Configuration File (using automatic bit-rate detection). In this section we briefly outline a few relevant configurations for J1939 logging.


Filter J1939 PGNs

When logging J1939 data from different vehicle models, you may wish to filter your data based on J1939 PGNs - rather than the full CAN ID (e.g. if source addresses differ by vehicle model/year).

To do so, you can follow the example in the configuration section of the CANedge Docs. Further, the config editor also includes a support tool for testing J1939 PGN filters.


Log J1939 on-request data

In some cases, you may wish to log on-request J1939 data. To do so, you’ll need to transmit the relevant J1939 request frame into the CAN bus - see also our J1939 simple intro.

An example is PGN 65253 (FEE5) which contains the SPN Engine Hours. Below we show what the transmit message could look like for this particular PGN. There are two key things to note:

  1. The transmit frame CAN ID is 18EA00FF, reflecting the J1939 request PGN 59904 (EA00)
  2. The data contains the requested PGN FEE5 (note the byte ordering to E5FE)

Note that not all vehicles will respond to your request messages. Note also that transmitting data may cause vehicle sensors to “wake up” even if the vehicle is turned off. In most cases the CANedge turns off with the vehicle power supply - and if so, this is not an issue. However, if the CANedge is still on when the vehicle is turned off, you may want to implement a control signal to stop transmitting data in this case - see also our OBD2 section for examples.

{
  "can_1": {
    "transmit": [
      {
        "name": "PGN_FEE5",
        "state": 1,
        "id_format": 1,
        "frame_format": 0,
        "brs": 0,
        "log": 1,
        "period": 5000,
        "delay": 150,
        "id": "18EA00FF",
        "data": "E5FE00"
      }
    ]
  }
}

Record data from your J1939 application

  1. Connect the CANedge to your J1939 application, e.g. using a DB9 adapter[1]
  2. Verify that the device turns on and logs data (see the LED section of the CANedge Docs)
  3. Disconnect the device and use e.g. an MDF4 converter to view the raw data
  4. For J1939 data, your converted raw log file will typically look as below:
TimestampEpoch;BusChannel;ID;IDE;DLC;DataLength;Dir;EDL;BRS;DataBytes
1578923892.382550;1;18F0233D;1;8;8;0;0;0;FFFFFFFFFF0CFFFF
1578923892.384300;1;CF00400;1;8;8;0;0;0;087D7D000000F07D
1578923892.391950;1;14F00131;1;8;8;0;0;0;FFFFFFFF00FFFFFF
1578923892.392550;1;CF00A01;1;8;8;0;0;0;00000000FFFFFFFF
1578923892.393150;1;10F01A01;1;8;8;0;0;0;0000FFFFFFFFFFFF
1578923892.393750;1;10FCFD01;1;8;8;0;0;0;FFFFFFFF0000FFFF
1578923892.394300;1;18FD9401;1;8;8;0;0;0;C407FFFF00004B03
1578923892.394900;1;CF00400;1;8;8;0;0;0;087D7D000000F07D
...

Analyze & plot your J1939 data

The asammdf GUI intro details how to convert raw data into human-readable form and e.g. perform plots. This process requires a DBC file. For details, see the process section.


[1]Often you’ll use a DB9-J1939 adapter to connect to a J1939 network in a heavy-duty vehicle. However, in other cases you may need a custom cable in which case the DB9-Generic adapter may be the best choice. Further, there are also cases where you’ll want to log data directly from the raw wiring harness - in which case a CANCrocodile adapter is ideal.