Skip to content

Instantly share code, notes, and snippets.

@agmangas
Last active April 12, 2024 06:26
Show Gist options
  • Save agmangas/4f8ef5febcb7564274f77c49ccbc0ffb to your computer and use it in GitHub Desktop.
Save agmangas/4f8ef5febcb7564274f77c49ccbc0ffb to your computer and use it in GitHub Desktop.
Relationship between CAN IDs and J1939 PGNs

CAN IDs & J1939 PGNs

Global PGN Example

Original CAN ID:

1    8    F    0    0    1    0    B
0001 1000 1111 0000 0000 0001 0000 1011

Separated on each individual part:

Part Value
Priority 110
Reserved 0
Data Page 0
PDU Format 11110000
PDU Specific 00000001
Source Address 00001011

Notice that an Extended CAN Identifier has 29 bits, so the first three leading bits are not taken into account.

As the PDU Format is greater or equal than F0 this is a Global PGN. In this type of PGNs the PDU Specific is appended to the PDU Format to get the final PGN.

000000 (6 bits) + Reserved (1 bit) + Data Page (1 bit) + PDU Format (8 bits) + PDU Specific (8 bits)
0    0    F    0    0    1
0000 0000 1111 0000 0000 0001

The PGN is a 18 bit value.

Converted to decimal: 61441.

Specific PGN Example

Original CAN ID:

0    C    8    2    0    E    0    F
0000 1100 1000 0010 0000 1110 0000 1111

Separated on each individual part:

Part Value
Priority 011
Reserved 0
Data Page 0
PDU Format 10000010
PDU Specific 00001110
Source Address 00001111

As the PDU Format is lower than F0 this is a Specific PGN. These belong to messages that are directed to a specific device (peer-to-peer).

000000 (6 bits) + Reserved (1 bit) + Data Page (1 bit) + PDU Format (8 bits) + 00000000 (8 bits)
0    0    8    2    0    0
0000 0000 1000 0010 0000 0000

Converted to decimal: 33280.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment