Re: Raspberry PI running 5.10.x Kernel and issues with Daul channel Waveshare based 2.1 MCP251xFD CAN HAT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 10 Aug 2022, at 11:36, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote:
> 
>> The embedded Linux device
>> root@Venus:~# ip -details link show can0
>> 3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 100
>>    link/can  promiscuity 0 minmtu 0 maxmtu 0 
>>    can state ERROR-ACTIVE (berr-counter tx 0 rx 83) restart-ms 100 
>> 	  bitrate 250000 sample-point 0.875 
>> 	  tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
>                                         ^^^^^^^^^^^^^^^^^^
> 
> Here the sjw is 50% of phase-seg2.
> 
>> 	  sun4i_can: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
>> 	  clock 24000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
>> 
>> 
>> RaspberryPI4 with the wave share dual can hat
>> root@Olaso-PI:~# ip -details link show can0
>> 5: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 100
>>    link/can  promiscuity 0 minmtu 0 maxmtu 0 
>>    can state ERROR-WARNING (berr-counter tx 0 rx 124) restart-ms 100 
>> 	  bitrate 250000 sample-point 0.875 
>> 	  tq 25 prop-seg 69 phase-seg1 70 phase-seg2 20 sjw 1
>                                          ^^^^^^^^^^^^^^^^^^^
> Can you try to configure sjw to 10 on the mcp251xfd for 250 kbit/s.

That did it. All stable and working great.

> Which tool are you using to configure the bitrate?

Ip command from iproute2

ip link set $dev up txqueuelen 100 type can bitrate $rate restart-ms 100

> 
>> 	  mcp251xfd: tseg1 2..256 tseg2 1..128 sjw 1..128 brp 1..256 brp-inc 1
>> 	  mcp251xfd: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..256 dbrp-inc 1
>> 	  clock 40000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
>> 
>> ip -details link show can1
>> 6: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 100
>>    link/can  promiscuity 0 minmtu 0 maxmtu 0 
>>    can state ERROR-WARNING (berr-counter tx 0 rx 125) restart-ms 100 
>> 	  bitrate 500000 sample-point 0.875 
>> 	  tq 25 prop-seg 34 phase-seg1 35 phase-seg2 10 sjw 1
>                                          ^^^^^^^^^^^^^^^^^^^
> 
> Try a sjw of 5 for 500 kbit/s.

That also worked.

Should I be manually setting the sow value or should it have been set automatically?

Thank you for the quick response, while it looks like an easy fix, the system has many different possible can hats that could be used so modifying the ip command could be challenging for just this HAT.

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



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux