DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
j1939.h File Reference

SAE J1939 message codec (DETWS_ENABLE_J1939) - the heavy-duty-vehicle / agriculture / marine / genset CAN higher-layer protocol, over 29-bit extended CAN frames. More...

#include "ServerConfig.h"

Go to the source code of this file.

Detailed Description

SAE J1939 message codec (DETWS_ENABLE_J1939) - the heavy-duty-vehicle / agriculture / marine / genset CAN higher-layer protocol, over 29-bit extended CAN frames.

J1939 packs a 29-bit extended identifier as:

bits 28-26 Priority | 25 EDP | 24 DP | 23-16 PF | 15-8 PS | 7-0 SA

The 18-bit Parameter Group Number (PGN) is EDP|DP|PF|PS, where PS is part of the PGN only for PDU2 (broadcast, PF >= 240); for PDU1 (PF < 240) PS is the destination address (DA) and the PGN's low octet is 0. This codec encodes / decodes that id, builds single-frame messages, runs the Transport Protocol (BAM broadcast + RTS/CTS connection mode) with a reassembler for messages up to DETWS_J1939_TP_MAX octets, and builds the Address Claimed (with a 64-bit NAME) and Request PGN messages.

Pure and host-tested. Drive it from the ESP32 TWAI peripheral (or an MCP2515 over SPI) to bridge a J1939 bus onto Wi-Fi - decode engine / transmission / genset PGNs and publish them.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file j1939.h.