diff mbox series

can: j1939: convert PGN structure to a table

Message ID 20201022102946.18916-1-yegorslists@googlemail.com
State New
Headers show
Series can: j1939: convert PGN structure to a table | expand

Commit Message

Yegor Yefremov Oct. 22, 2020, 10:29 a.m. UTC
From: Yegor Yefremov <yegorslists@googlemail.com>

Use table markup to show the PGN structure.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 Documentation/networking/j1939.rst | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Marc Kleine-Budde Oct. 22, 2020, 10:33 a.m. UTC | #1
On 10/22/20 12:29 PM, yegorslists@googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> Use table markup to show the PGN structure.
> 
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
>  Documentation/networking/j1939.rst | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/networking/j1939.rst b/Documentation/networking/j1939.rst
> index faf2eb5c5052..f3fb9d880910 100644
> --- a/Documentation/networking/j1939.rst
> +++ b/Documentation/networking/j1939.rst
> @@ -71,10 +71,14 @@ PGN
>  
>  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
> +  ----------------------------------------------------------------
> +  25            24              23 ... 16        15 ... 8

ICan you add a row description that indicated that these numbers are. They are
probably bit positions within the CAN-ID?

> +  ============  ==============  ===============  =================
> +  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
> 

Marc
Kurt Van Dijck Oct. 22, 2020, 12:24 p.m. UTC | #2
On Thu, 22 Oct 2020 12:33:45 +0200, Marc Kleine-Budde wrote:
> On 10/22/20 12:29 PM, yegorslists@googlemail.com wrote:

> > From: Yegor Yefremov <yegorslists@googlemail.com>

> > 

> > Use table markup to show the PGN structure.

> > 

> > Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>

> > ---

> >  Documentation/networking/j1939.rst | 12 ++++++++----

> >  1 file changed, 8 insertions(+), 4 deletions(-)

> > 

> > diff --git a/Documentation/networking/j1939.rst b/Documentation/networking/j1939.rst

> > index faf2eb5c5052..f3fb9d880910 100644

> > --- a/Documentation/networking/j1939.rst

> > +++ b/Documentation/networking/j1939.rst

> > @@ -71,10 +71,14 @@ PGN

> >  

> >  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

> > +  ----------------------------------------------------------------

> > +  25            24              23 ... 16        15 ... 8

> 

> ICan you add a row description that indicated that these numbers are. They are

> probably bit positions within the CAN-ID?


This is true for up to 99.9%, depending on who you ask.
this maps indeed to the bit positions in the CAN-ID, as in J1939-21.
The trouble is that PGN's are also communicated as such in the payload,
e.g. in the TP and ETP (see J1939-81 if i remember correctly).
Since only PGN is written there, without SA, the bit position relative
to the CAN-ID are ... making things look fuzzy.

So I the best I can propose is to add a 2nd row :-)

> 

> > +  ============  ==============  ===============  =================

> > +  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

> > 

> 

> Marc

> 

> -- 

> 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 |

>
Yegor Yefremov Oct. 27, 2020, 11:27 a.m. UTC | #3
On Thu, Oct 22, 2020 at 2:25 PM Kurt Van Dijck
<dev.kurt@vandijck-laurijssen.be> wrote:
>
> On Thu, 22 Oct 2020 12:33:45 +0200, Marc Kleine-Budde wrote:
> > On 10/22/20 12:29 PM, yegorslists@googlemail.com wrote:
> > > From: Yegor Yefremov <yegorslists@googlemail.com>
> > >
> > > Use table markup to show the PGN structure.
> > >
> > > Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> > > ---
> > >  Documentation/networking/j1939.rst | 12 ++++++++----
> > >  1 file changed, 8 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/Documentation/networking/j1939.rst b/Documentation/networking/j1939.rst
> > > index faf2eb5c5052..f3fb9d880910 100644
> > > --- a/Documentation/networking/j1939.rst
> > > +++ b/Documentation/networking/j1939.rst
> > > @@ -71,10 +71,14 @@ PGN
> > >
> > >  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
> > > +  ----------------------------------------------------------------
> > > +  25            24              23 ... 16        15 ... 8
> >
> > ICan you add a row description that indicated that these numbers are. They are
> > probably bit positions within the CAN-ID?
>
> This is true for up to 99.9%, depending on who you ask.
> this maps indeed to the bit positions in the CAN-ID, as in J1939-21.
> The trouble is that PGN's are also communicated as such in the payload,
> e.g. in the TP and ETP (see J1939-81 if i remember correctly).
> Since only PGN is written there, without SA, the bit position relative
> to the CAN-ID are ... making things look fuzzy.
>
> So I the best I can propose is to add a 2nd row :-)

I have sent v2. Should I also include the tables for PDU1 and PDU2
formats as well as the general table with ID and Data? See Wiki [1]

[1] https://de.wikipedia.org/wiki/SAE_J1939#/media/Datei:J1939_Aufsplittung_CAN-Identifier.png

Best regards,
Yegor

> >
> > > +  ============  ==============  ===============  =================
> > > +  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
> > >
> >
> > Marc
> >
> > --
> > 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 |
> >
>
>
>
Marc Kleine-Budde Oct. 27, 2020, 12:15 p.m. UTC | #4
On 10/27/20 12:27 PM, Yegor Yefremov wrote:
>>> Can you add a row description that indicated that these numbers are. They are

>>> probably bit positions within the CAN-ID?

>>

>> This is true for up to 99.9%, depending on who you ask.

>> this maps indeed to the bit positions in the CAN-ID, as in J1939-21.

>> The trouble is that PGN's are also communicated as such in the payload,

>> e.g. in the TP and ETP (see J1939-81 if i remember correctly).

>> Since only PGN is written there, without SA, the bit position relative

>> to the CAN-ID are ... making things look fuzzy.

>>

>> So I the best I can propose is to add a 2nd row :-)


Sounds reasonable.

> I have sent v2. Should I also include the tables for PDU1 and PDU2

> formats as well as the general table with ID and Data? See Wiki [1]


Make it so.

> [1] https://de.wikipedia.org/wiki/SAE_J1939#/media/Datei:J1939_Aufsplittung_CAN-Identifier.png


regards,
Marc

-- 
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 |
diff mbox series

Patch

diff --git a/Documentation/networking/j1939.rst b/Documentation/networking/j1939.rst
index faf2eb5c5052..f3fb9d880910 100644
--- a/Documentation/networking/j1939.rst
+++ b/Documentation/networking/j1939.rst
@@ -71,10 +71,14 @@  PGN
 
 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
+  ----------------------------------------------------------------
+  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