Skip to contentSkip to conversation

can: j1939: add tables for the CAN identifier and its fields

PATCH In review [email protected] 2 participants 2 messages Nov 4, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 can: j1939: add tables for the CAN identifier and its fields

From: Yegor Yefremov <[email protected]>

Use table markup to show the structure of the CAN identifier, PGN, PDU1, and PDU2 formats. Also add introductory sentence.

---
 Documentation/networking/j1939.rst | 46 +++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 4 deletions(-)
Documentation/networking/j1939.rst +42 -4
index 0a4b73b03b99..19d9878d7194 100644
@@ -69,18 +69,56 @@ J1939 concepts
 PGN
 ---
 
+The J1939 protocol uses the 29-bit CAN identifier with the following structure:
+
+  ============  ==============  ====================
+  29 bit CAN-ID                                     
+  --------------------------------------------------
+  Bit positions within the CAN-ID                   
+  --------------------------------------------------
+  28 ... 26     25 ... 8        7 ... 0             
+  ============  ==============  ====================
+  Priority      PGN             SA (Source Address) 
+  ============  ==============  ====================
+
 The PGN (Parameter Group Number) is a number to identify a packet. The PGN
 is composed as follows:
-1 bit  : Reserved Bit
-1 bit  : Data Page
-8 bits : PF (PDU Format)
-8 bits : PS (PDU Specific)
+
+  ============  ==============  =================  =================
+  PGN
+  ------------------------------------------------------------------
+  Bit positions within the CAN-ID
+  ------------------------------------------------------------------
+  25            24              23 ... 16          15 ... 8
+  ============  ==============  =================  =================
+  R (Reserved)  DP (Data Page)  PF (PDU Format)    PS (PDU Specific)
+  ============  ==============  =================  =================
 
 In J1939-21 distinction is made between PDU1 format (where PF < 240) and PDU2
 format (where PF >= 240). Furthermore, when using the PDU2 format, the PS-field
 contains a so-called Group Extension, which is part of the PGN. When using PDU2
 format, the Group Extension is set in the PS-field.
 
+  ==============  ========================
+  PDU1 Format (specific) (peer to peer)
+  ----------------------------------------
+  Bit positions within the CAN-ID
+  ----------------------------------------
+  23 ... 16       15 ... 8
+  ==============  ========================
+  00h ... EFh     DA (Destination address)
+  ==============  ========================
+
+  ==============  ========================
+  PDU2 Format (global) (broadcast)
+  ----------------------------------------
+  Bit positions within the CAN-ID
+  ----------------------------------------
+  23 ... 16       15 ... 8
+  ==============  ========================
+  F0h ... FFh     GE (Group Extenstion)
+  ==============  ========================
+
 On the other hand, when using PDU1 format, the PS-field contains a so-called
 Destination Address, which is _not_ part of the PGN. When communicating a PGN
 from user space to kernel (or vice versa) and PDU2 format is used, the PS-field
Signature · 1 line
2.17.0
#1 lore raw
Quoted 19 lines · On 11/4/20 4:57 PM, [email protected] wrote:

From: Yegor Yefremov <[email protected]>

Use table markup to show the structure of the CAN identifier, PGN, PDU1, and PDU2 formats. Also add introductory sentence.

---
 Documentation/networking/j1939.rst | 46 +++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 4 deletions(-)
Documentation/networking/j1939.rst +1 -0
index 0a4b73b03b99..19d9878d7194 100644
@@ -69,18 +69,56 @@ J1939 concepts
 PGN
 ---
 
+The J1939 protocol uses the 29-bit CAN identifier with the following structure:

Documentation/networking/j1939.rst J1939 concepts · line 82

Quoted 10 lines
Documentation/networking/j1939.rst +10 -0
+
+  ============  ==============  ====================
+  29 bit CAN-ID                                     
+  --------------------------------------------------
+  Bit positions within the CAN-ID                   
+  --------------------------------------------------
+  28 ... 26     25 ... 8        7 ... 0             
+  ============  ==============  ====================
+  Priority      PGN             SA (Source Address) 
+  ============  ==============  ====================

Here you introduce trailing whitespace. I've removed them while applying the patch to linux-can/testing

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |