All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Neeli <sneeli@xilinx.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "Srinivas Goud" <sgoud@xilinx.com>,
	"Naveen Kumar Gaddipati" <naveenku@xilinx.com>,
	"Prasad Beer Prasad" <prasadbe@xilinx.com>,
	linux-can <linux-can@vger.kernel.org>,
	"Stefan Mätje" <stefan.maetje@esd.eu>,
	"Vincent MAILHOL" <mailhol.vincent@wanadoo.fr>
Subject: RE: Queries on CAN frame work
Date: Fri, 18 Mar 2022 10:15:02 +0000	[thread overview]
Message-ID: <DM6PR02MB53869D6C6A11B9D76B35E646AF139@DM6PR02MB5386.namprd02.prod.outlook.com> (raw)
In-Reply-To: <20220318091518.sxumfvkbj4c224im@pengutronix.de>

Hi marc,

> -----Original Message-----
> From: Marc Kleine-Budde <mkl@pengutronix.de>
> Sent: Friday, March 18, 2022 2:45 PM
> To: Srinivas Neeli <sneeli@xilinx.com>
> Cc: Srinivas Goud <sgoud@xilinx.com>; Naveen Kumar Gaddipati
> <naveenku@xilinx.com>; Prasad Beer Prasad <prasadbe@xilinx.com>; linux-
> can <linux-can@vger.kernel.org>; Stefan Mätje <stefan.maetje@esd.eu>;
> Vincent MAILHOL <mailhol.vincent@wanadoo.fr>
> Subject: Re: Queries on CAN frame work
> 
> On 18.03.2022 06:55:56, Srinivas Neeli wrote:
> > > I've updated the algorithm to prefer lower brp values. Can you check
> > > if these values make sense to you?
> >
> > Thanks for update.
> > Few more changes need to update in algorithm.
> > 1) Choose SJW as large as possible (we can assign " tseg2")
> 
> ACK - changes to SJW needs still to be done.
Already we are assigning sjw = tseg2 in manual mode. Automatic we are assigning 1.
https://elixir.bootlin.com/linux/latest/source/drivers/net/can/dev/bittiming.c#L158

> 
> >  For CANFD CIA recommendations :
> >  Recommendation 1:
> >     Choose the highest available CAN clock frequency (20 MHz, 40 MHz,
> > 80 MHz) Recommendation 2:
> >     Set the BRPA bit-rate pre-scaler equal BRPD Recommendation 3:
> >     Choose BRPA and BRPD as low as possible.
> > Recommendation 4:
> >     Configure all CAN FD nodes to have the same arbitration phase
> > Sample point (SP) and the same data phase SP Recommendation 5:
> >     Choose SJWD and SJWA as large as possible (best is the max
> > possible value) Recommendation 6:
> >     Enable TDC when needed
> >      If we enable TDC feature ,please try to configure brp value 1 in
> algorithm(TDC feature support brp 1/2 but observed good results with 1).
> > >
> > > | $ ./can-calc-bit-timing --alg=can-next xilinx_dwnstrm -c 79999999
> > > | Bit timing parameters for xilinx_dwnstrm with 79.999999 MHz ref
> > > | clock (cmd-
> > > line) using algo 'can-next'
> > > |  nominal                                  real  Bitrt    nom   real  SampP
> > > |  Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP  Bitrate  Error  SampP  SampP
> Error
> > > |  1000000     12  29   30   20   1   1   999999   0.0%  75.0%  75.0%   0.0%
> >
> > Observed different BRP values for 1Mbps in here and below list for
> > same sampling point.
> 
> Yes. Seems I should update the table to clarify what they output.
> 
> The 1st table uses the CAN-2.0 bit timing constants, the 2nd table is using
> the CAN-FD data bit timing constants.
> 
> > > |   800000     12  39   40   20   1   1   799999   0.0%  80.0%  80.0%   0.0%
> > > |   666666     12  47   48   24   1   1   666666   0.0%  80.0%  80.0%   0.0%
> > > |   500000     12  69   70   20   1   1   499999   0.0%  87.5%  87.5%   0.0%
> > > |   250000     25  69   70   20   1   2   249999   0.0%  87.5%  87.5%   0.0%
> > > |   125000     50  69   70   20   1   4   124999   0.0%  87.5%  87.5%   0.0%
> > > |   100000     50  87   87   25   1   4    99999   0.0%  87.5%  87.5%   0.0%
> > > |    83333     50 104  105   30   1   4    83333   0.0%  87.5%  87.5%   0.0%
> > > |    50000    100  87   87   25   1   8    49999   0.0%  87.5%  87.5%   0.0%
> > > |    33333    125 104  105   30   1  10    33333   0.0%  87.5%  87.5%   0.0%
> > > |    20000    250  87   87   25   1  20    19999   0.0%  87.5%  87.5%   0.0%
> > > |    10000    500  87   87   25   1  40     9999   0.0%  87.5%  87.5%   0.0%
> > > |
> > > | Bit timing parameters for xilinx_dwnstrm with 79.999999 MHz ref
> > > | clock
> > > (cmd-line) using algo 'can-next'
> > > |  nominal                                  real  Bitrt    nom   real  SampP
> > > |  Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP  Bitrate  Error  SampP  SampP
> Error
> > > | 12000000     12   2    2    2   1   1 11428571   4.8%  75.0%  71.4%   4.8%
> > > | 10000000     12   2    3    2   1   1  9999999   0.0%  75.0%  75.0%   0.0%
> > > |  8000000     12   3    3    3   1   1  7999999   0.0%  75.0%  70.0%   6.7%
> > > |  5000000     12   5    6    4   1   1  4999999   0.0%  75.0%  75.0%   0.0%
> > > |  4000000     12   7    7    5   1   1  3999999   0.0%  75.0%  75.0%   0.0%
> > > |  2000000     12  14   15   10   1   1  1999999   0.0%  75.0%  75.0%   0.0%
> > > |  1000000     25  14   15   10   1   2   999999   0.0%  75.0%  75.0%   0.0%
> >
> > Here brp =2 and in above list brp =1.
> 
> According to the "ip" command's output, these are you timing parameters:
> 
> | 		.bittiming_const = {
> | 			.name = "xilinx_dwnstrm",
> | 			.tseg1_min = 1,
> | 			.tseg1_max = 256,
> | 			.tseg2_min = 1,
> | 			.tseg2_max = 128,
> | 			.sjw_max = 128,
> | 			.brp_min = 1,
> | 			.brp_max = 256,
> | 			.brp_inc = 1,
> | 		},
> | 		.data_bittiming_const = {
> | 			.name = "xilinx_dwnstrm",
> | 			.tseg1_min = 1,
> | 			.tseg1_max = 32,
> | 			.tseg2_min = 1,
> | 			.tseg2_max = 16,
> | 			.sjw_max = 16,
> | 			.brp_min = 1,
> | 			.brp_max = 256,
> | 			.brp_inc = 1,
> | 		},
> 
> Note that for the data bit timing the tseg1_max is 32.
> 
> > > |  nominal                                  real  Bitrt    nom   real  SampP
> > > |  Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP  Bitrate  Error  SampP  SampP
> Error
> > > |  1000000     12  29   30   20   1   1   999999   0.0%  75.0%  75.0%   0.0%
> <-- CAN-2.0
> > > |  1000000     25  14   15   10   1   2   999999   0.0%  75.0%  75.0%   0.0%
> <-- CAN-FD (data)
>                        \_____/
>                         tseg1
> 
> tseg1 = 14 + 15 = 29
> 
> With brp == 1 the tseg1 would be 29 + 30 = 59, which means it's too large.
Accepted, Thanks for clear explanation.
 
> 
> 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 |

  reply	other threads:[~2022-03-18 10:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DM6PR02MB538645C4ECE3BBBD3CE92A17AF539@DM6PR02MB5386.namprd02.prod.outlook.com>
2022-01-13 20:30 ` Queries on CAN frame work Marc Kleine-Budde
2022-01-13 21:10   ` Marc Kleine-Budde
2022-01-14 10:16     ` Vincent MAILHOL
2022-01-17 11:48       ` Marc Kleine-Budde
2022-01-15 23:26     ` Marc Kleine-Budde
2022-02-21 14:43       ` Srinivas Neeli
2022-02-21 20:27         ` Marc Kleine-Budde
2022-02-22  0:40           ` Srinivas Neeli
2022-03-06 14:30             ` Srinivas Neeli
2022-03-06 14:47               ` Marc Kleine-Budde
2022-03-17 22:00         ` Marc Kleine-Budde
2022-03-18  6:12           ` Srinivas Neeli
2022-03-18  8:30             ` Marc Kleine-Budde
2022-03-18  9:54               ` Srinivas Neeli
2022-03-18 10:01                 ` Marc Kleine-Budde
2022-03-17 22:50         ` Marc Kleine-Budde
2022-03-18  6:55           ` Srinivas Neeli
2022-03-18  9:15             ` Marc Kleine-Budde
2022-03-18 10:15               ` Srinivas Neeli [this message]
2022-03-18 12:03                 ` Marc Kleine-Budde
2022-03-18 13:57               ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR02MB53869D6C6A11B9D76B35E646AF139@DM6PR02MB5386.namprd02.prod.outlook.com \
    --to=sneeli@xilinx.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=naveenku@xilinx.com \
    --cc=prasadbe@xilinx.com \
    --cc=sgoud@xilinx.com \
    --cc=stefan.maetje@esd.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.