Hi Marc, > -----Original Message----- > From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> > Sent: Friday, March 18, 2022 4:21 AM > To: Srinivas Neeli <sneeli@xxxxxxxxxx> > Cc: Srinivas Goud <sgoud@xxxxxxxxxx>; Naveen Kumar Gaddipati > <naveenku@xxxxxxxxxx>; Prasad Beer Prasad <prasadbe@xxxxxxxxxx>; linux- > can <linux-can@xxxxxxxxxxxxxxx>; Stefan Mätje <stefan.maetje@xxxxxx>; > Vincent MAILHOL <mailhol.vincent@xxxxxxxxxx> > Subject: Re: Queries on CAN frame work > > On 21.02.2022 14:43:57, Srinivas Neeli wrote: > > > Can you also provide the hand calculated bit timing parameters for > > > the above scenarios? > > > > Baud rate 1/5Mbps > > ================ > > > > Hand configuration: > > --------------------------- > > ip link set can0 type can tq 12 prop-seg 29 phase-seg1 30 phase-seg2 > > 20 sjw 1 dtq 12 dprop-seg 5 dphase-seg1 6 dphase-seg2 4 dsjw 1 fd on > > (A/D: 1/5Mbps, Sample point=75%) > > > > Baud rate 1/4Mbps > > ================ > > > > Hand configuration: > > -------------------------- > > ip link set can0 type can tq 12 prop-seg 29 phase-seg1 30 phase-seg2 > > 20 sjw 1 dtq 12 dprop-seg 7 dphase-seg1 7 dphase-seg2 5 dsjw 1 fd on > > (A/D: 1/4Mbps, Sample point=75%) > > 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") 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. > | 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. > > 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 |