npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@embedded32/j1939

v1.0.0

Published

Professional SAE J1939 protocol stack for heavy-duty vehicle communication

Readme

@embedded32/j1939

Professional-grade SAE J1939 protocol stack for the Embedded32 platform.

Overview

This package provides:

  • J1939 ID Parsing - Extract priority, PGN, source address from 29-bit CAN IDs
  • PGN Database - 50+ standard automotive parameter definitions
  • Message Decoding - Map raw CAN data to J1939 semantics
  • Transport Protocol - Multi-packet message handling (BAM, RTS/CTS)
  • Address Claim - Device network addressing
  • Diagnostics - DM1, DM2 fault code support with SPN/FMI decoding

Installation

npm install @embedded32/j1939

Usage

Parse J1939 CAN Identifier

import { parseJ1939Id, buildJ1939Id } from "@embedded32/j1939";

// Parse a 29-bit J1939 ID
const msg = parseJ1939Id(0x18f00401);
// { priority: 3, pgn: 0xF004, sa: 0x01, pf: 0xF0, ps: 0x04, dp: 0, extended: true }

// Build a J1939 ID
const id = buildJ1939Id({ pgn: 0xF004, sa: 0x01, priority: 3 });
// 0x18F00401

Decode J1939 Messages

import { decodeJ1939, formatJ1939Message } from "@embedded32/j1939";

const frame = {
  id: 0x18F00401,
  data: [0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80]
};

const msg = decodeJ1939(frame);
// { pgn: 0xF004, name: "Electronic Engine Controller 1", sa: 0x01, raw: [...] }

console.log(formatJ1939Message(msg));
// "[J1939] Electronic Engine Controller 1 (0x00F004) from SA=0x01"

CAN ↔ J1939 Gateway

import { CANInterface, SocketCANDriver } from "@embedded32/can";
import { J1939CANBinding } from "@embedded32/j1939";

const can = new CANInterface(new SocketCANDriver("can0"));
const binding = new J1939CANBinding(can, runtime.getMessageBus());

binding.start();

// Receive J1939 messages
runtime.getMessageBus().subscribe("j1939.rx", (msg) => {
  console.log(`Received ${msg.payload.name}`);
});

// Send J1939 messages
runtime.getMessageBus().publish("j1939.tx", {
  payload: { pgn: 0xF004, sa: 0x01, data: [...] }
});

Transport Protocol (Multi-Packet)

import { J1939TransportProtocol } from "@embedded32/j1939";

const tp = new J1939TransportProtocol();

// Send large message using BAM
tp.sendBAM({
  pgn: 0xFECA,
  sa: 0x01,
  data: new Uint8Array(50)
});

// Listen for multi-packet messages
tp.onMessageComplete((message) => {
  console.log(`Received ${message.data.length} bytes`);
});

DM1/DM2 Fault Code Decoding

import { DiagnosticsManager } from "@embedded32/j1939";

const dm = new DiagnosticsManager();

const result = dm.processDM1(0x01, dm1Data);

console.log('Lamp Status:', result.lamps);
// { mil: true, flash: false, amber: false, protect: false }

result.activeDTCs.forEach(dtc => {
  console.log(`SPN: ${dtc.spn} (${dtc.spnDescription})`);
  console.log(`FMI: ${dtc.fmi} (${dtc.fmiDescription})`);
});

PGN Constants

| PGN | Name | Description | |-----|------|-------------| | 0xF004 | EEC1 | Electronic Engine Controller 1 | | 0xF003 | ETC1 | Electronic Transmission Controller 1 | | 0xFEEE | ET1 | Engine Temperature 1 | | 0xFEEF | EFL | Engine Fluid Level | | 0xFEF7 | VEP1 | Vehicle Electrical Power 1 | | 0xFECA | DM1 | Active Diagnostic Trouble Codes | | 0xFECB | DM2 | Previously Active DTCs | | 0xEA00 | Request | Request PGN |

License

MIT © Mukesh Mani Tripathi