Re: [PATCH] can: netlink: Fix TDCO calculation using the old data bittiming

From: Marc Kleine-Budde
Date: Wed Feb 21 2024 - 09:27:41 EST


On 21.02.2024 15:14:02, Oliver Hartkopp wrote:
> I have an old PCAN USB adapter (Classical CAN) which uses the pcan_usb
> driver and wanted to set a 50kbit/s bitrate:
>
> ip link set can0 up txqueuelen 500 type can bitrate 50000 sjw 4
>
> First it complained about the SJW having a higher value than some phase-seg
> value which was 2.
>
> Error: sjw: 4 greater than phase-seg2: 2.
>
> I always thought the driver automatically adapts the SJW value to the
> highest possible and SJW=4 could always be set. Did this change at a certain
> point?

Yes, that changed with b5a3d0864ee7 ("can: bittiming: can_sjw_check():
check that SJW is not longer than either Phase Buffer Segment")

See discussion in https://lore.kernel.org/all/20220907103845.3929288-3-mkl@xxxxxxxxxxxxxx/

> Anyway, then I reduced the given SJW value and the ip command did not give
> any error message.
>
> But finally there was not CAN traffic possible with my "always working
> setup".
>
> I'm running 6.8.0-rc4-00433-g92a355464776 from Linus' tree.
>
> Reverting this patch fixed my issue.

But what has the tdco calculation to do with non CAN-FD controllers?

Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |

Attachment: signature.asc
Description: PGP signature