...
🇨🇳 Meet SonnePower at bauma CHINA 2026   |   Nov. 24–27, 2026   |   Shanghai New International Expo Centre (SNIEC)   |   BOOTH N1.576 🇨🇳 Meet SonnePower at bauma CHINA 2026   |   Nov. 24–27, 2026   |   Shanghai New International Expo Centre (SNIEC)   |   BOOTH N1.576

SAE J1939 PGN & SPN Decoding Guide: From CAN Raw Data to HMI Visualization

Table of Contents

Short Answer / TL;DR:

  • What is PGN? It is an 18-bit identifier (Parameter Group Number) within a 29-bit CAN ID that defines the content of a J1939 message.

  • How to extract it? By applying bit-masking to the PDU Format (PF) and PDU Specific (PS) fields of the CAN identifier.

  • Why HMI needs hardware-level decoding? To ensure zero data loss and sub-20ms latency on high-load vehicle networks without taxing the application CPU.

In the world of mobile machinery—ranging from excavators and tractors to heavy-duty trucks—the SAE J1939 protocol is the digital nervous system that enables seamless communication between ECUs, engines, and transmissions. For OEMs, the ability to accurately decode J1939 data and present it on a rugged HMI is the foundation of a modern, intelligent machine.

1. Why Standard Displays Struggle with J1939 Data

Most off-the-shelf industrial displays treat CAN data as a simple stream of raw identifiers. However, mobile machinery operates on a complex 29-bit extended identifier structure that requires specialized handling.

Common pitfalls in standard HMI integration include:

  • Decoding Latency: Relying on software-based switch-case logic leads to UI lag when bus loads exceed 70%.

  • Data Integrity: Without hardware-level filtering, high-frequency messages like Engine Speed can be missed during peak processing.

The SonnePower Advantage: Our rugged displays utilize a dedicated hardware J1939 stack that pre-filters PGNs, ensuring that your HMI remains responsive even on congested networks.

Deep Dive: Extracting the 18-bit PGN from a 29-bit ID

To identify what a message contains, you must first extract the Parameter Group Number (PGN). A J1939 29-bit ID consists of the Priority, Reserved bit, Data Page, PDU Format (PF), PDU Specific (PS), and Source Address (SA).

Practical Example: Hand-Decoding Engine Speed

Let’s take a raw CAN ID captured from the bus: 0x0CF00401.

  1. Identify the PF (PDU Format): Looking at bits 16-23, the PF is 0xF0 (240 in decimal).

  2. Determine PDU Type: Since PF ≥ 240, this is a PDU2 (Broadcast) message, meaning the PS acts as a Group Extension.

  3. Calculate the PGN: Combining the Reserved bit, Data Page, PF, and PS, we get 0x0F004.

    • Result: PGN 61444 (Electronic Engine Controller 1 – EEC1).

SPN Mapping: From Hexadecimal to Physical Values

Within the 8-byte payload of PGN 61444, we extract the Suspect Parameter Number (SPN) for Engine Speed (SPN 190).

The Calculation Formula

J1939 uses a linear scaling factor to convert raw binary into engineering units:

Physical Value = (Raw Value × Resolution) + Offset

Engine Speed (SPN 190) Calculation

  • Position: Bytes 4 and 5 (2 bytes, Little-Endian).

  • Resolution: 0.125 rpm/bit.

  • Offset: 0.

The Hand-Check (As recommended by GPT 5.2): Suppose the HMI receives a raw payload where Bytes 4-5 are 0x20 0x4E.

  1. Reconstruct Raw Value: 0x4E20 = 20,000 in decimal.

  2. Apply Formula: Actual RPM = 20,000 × 0.125 = 2,500 rpm

  3. HMI UI Strategy: For high-precision gauges, SonnePower displays use Anti-aliased Rendering to ensure the needle movement remains fluid at 2,500 RPM.

Advanced Diagnostics: Decoding DM1 & DM2 Faults

Beyond simple gauges, a J1939 display must act as a diagnostic tool by handling Diagnostic Trouble Codes (DTCs).

  • DM1 (Active Faults): PGN 65226. These inform the operator of current faults.

  • DM2 (Historical Faults): Used to recall previous fault codes for maintenance.

HMI Logic: When a DM1 is detected, the SonnePower HMI automatically triggers a pop-up alert, translating the raw FMI (Failure Mode Indicator) into human-readable text (e.g., “Sensor Voltage Above Normal”).

Efficiency for OEMs: Reducing "Switch-Case" Drudgery

Many engineers waste weeks writing manual bit-shifting code for every new SPN. With the SonnePower Graphical Toolchain, you can:

  1. DBC File Import: Instantly map PGNs and SPNs by dragging in your J1939 database.

  2. Logic-Free Binding: Bind decoded SPNs directly to UI gauges without writing a single line of switch-case logic.

  3. High-Load Optimization: Define hardware filters to ignore irrelevant PGNs, ensuring zero data loss for critical signals.

FAQ: J1939 HMI Quick Reference

How do I handle "Not Available" signals?

In J1939, a value of 0xFF indicates the signal is not available. Your HMI should show “—” instead of 255.

What is the difference between PDU1 and PDU2?

PDU1 (PF 0-239) is for peer-to-peer communication, while PDU2 (PF 240-255) is for broadcasting data to all devices on the bus.