From 3722d331472336c169d22a930d3d6853091d76b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=85=A7?= Date: Fri, 15 May 2026 23:50:45 +0800 Subject: [PATCH 1/2] fix: only call _validate() when strict=True _validate() was called unconditionally, rejecting brp values > 64 even when strict=False. This is too restrictive for some peripherals like FYSETC UCAN which support brp up to 1024. Only call _validate() when strict=True, matching the behavior of _restrict_to_minimum_range(). Fixes #2061 --- can/bit_timing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/can/bit_timing.py b/can/bit_timing.py index 2bb04bfbe..4311ff9a4 100644 --- a/can/bit_timing.py +++ b/can/bit_timing.py @@ -74,8 +74,8 @@ def __init__( "sjw": sjw, "nof_samples": nof_samples, } - self._validate() if strict: + self._validate() self._restrict_to_minimum_range() def _validate(self) -> None: From 6efba033875f3c03587fa8cfd9724164d68a8eef Mon Sep 17 00:00:00 2001 From: zariiii9003 <52598363+zariiii9003@users.noreply.github.com> Date: Sat, 6 Jun 2026 12:48:22 +0200 Subject: [PATCH 2/2] add news fragment --- doc/changelog.d/2061.fixed.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/2061.fixed.rst diff --git a/doc/changelog.d/2061.fixed.rst b/doc/changelog.d/2061.fixed.rst new file mode 100644 index 000000000..48afb4c86 --- /dev/null +++ b/doc/changelog.d/2061.fixed.rst @@ -0,0 +1 @@ +Fix ``can.BitTiming`` rejecting bit rate prescaler values greater than 64 even when ``strict=False``. \ No newline at end of file