Skip to content

SAE J1939

farzad edited this page Oct 7, 2026 · 1 revision

SAE J1939

J1939 is the CAN protocol of trucks, buses and off-highway machines. It uses 29-bit extended IDs whose bits are structured data: a 3-bit priority, an 18-bit Parameter Group Number (PGN) and an 8-bit source address (plus a destination address for peer-to-peer "PDU1" PGNs). Peykan implements it in j1939.py without a DBC; the simulator side is simulator/j1939_runner.py. It runs alongside the 11-bit signals on the same bus (turn it off with PEYKAN_J1939_ENABLED=false).

PGN catalog

PGN Acronym SPNs Simulator period
0xF004 EEC1 513 actual engine torque, 190 engine speed 50 ms
0xF003 EEC2 91 accelerator pedal, 92 engine load 50 ms
0xFEEE ET1 110 coolant temperature, 174 fuel temperature 1 s
0xFEF1 CCVS1 84 wheel-based vehicle speed 100 ms
0xFEF2 LFE1 183 fuel rate, 51 throttle valve position 500 ms
0xFEFC DD1 96 fuel level 1 s
0xFEF7 VEP1 168 battery potential 1 s
0xFECA DM1 Active DTCs (SPN + FMI + occurrence count) and lamp status 1 s
0xEA00 Request Asks ECUs to send a PGN on demand
0xEC00 / 0xEB00 TP.CM / TP.DT Multi-packet transport on demand

Source addresses used by the simulator: engine 0x00, brakes 0x0B, instrument cluster 0x17. All values come from the same driving model as the 11-bit signals, so J1939 engine speed and DBC engine speed agree.

Decoding

peykan j1939-decode 0x0CF00400 "00 00 00 20 4e 00 00 00"

gives priority 3, PGN 0xF004 (EEC1) from source 0, ENGINE_SPEED 2500 rpm. J1939 signals also show up in get_vehicle_snapshot and the dashboard, grouped as J1939:<acronym>.

Requesting a PGN

peykan j1939-request ET1        # or 0xFEEE, or 65262

or the request_j1939_pgn tool, which accepts acronyms and hex strings as well as integers. When nothing answers, the reply lists the known PGNs so a model can correct itself.

Trouble codes (DM1)

peykan j1939-dtcs

Each DM1 carries lamp states (malfunction indicator, red stop, amber warning, protect) and active DTCs. On a real truck every ECU broadcasts its own DM1, so read_j1939_dtcs / j1939-dtcs report the latest DM1 of every source address: all active codes, each tagged with source_address, plus each lamp at its most severe state and a per-ECU list.

Multi-packet transport (BAM)

A DM1 with two or more DTCs is longer than 8 bytes. J1939-21 sends such messages as a broadcast announcement (TP.CM, control byte 0x20 "BAM", with total size, packet count and the PGN) followed by numbered 7-byte data packets (TP.DT) 50 ms apart. Peykan builds these (j1939.build_bam) and reassembles them (j1939.TransportReassembler) everywhere DM1s are read: the tools, the CLI and log analysis. The misfire fault produces such a DM1 (SPN 1322 FMI 31 and SPN 651 FMI 7).

Only BAM (broadcast) is implemented; the peer-to-peer RTS/CTS variant isn't.

Faults on J1939

Fault J1939 DTCs
overheat SPN 110 FMI 0
abs_fault SPN 84 FMI 5
low_fuel SPN 96 FMI 18
misfire SPN 1322 FMI 31, SPN 651 FMI 7
battery_low SPN 168 FMI 18
crash, door_ajar none (airbag and body faults aren't reported over J1939)

See Fault Injection.

Clone this wiki locally