summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2025-01-08 12:11:34 +1100
committerDamien George <damien@micropython.org>2025-01-17 12:13:17 +1100
commit221a4ecf300d903d6043418a9980aa239dcd2879 (patch)
tree17227db02dbb78490f62eeb417f3f4b40626aafc
parente8d3df51dc036337803fbe047fff77266b3b69f4 (diff)
stm32/pyb_can: Include requested CAN baudrate in matching error.
This is redundant for bxCAN, but for CAN-FD with BRS it's otherwise unclear which set of parameters (baudrate & sample_point or brs_baudrate & brs_sample_point) failed to match. This makes finding a valid combination extra annoying. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
-rw-r--r--ports/stm32/pyb_can.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ports/stm32/pyb_can.c b/ports/stm32/pyb_can.c
index 723ff6f9d..181b31738 100644
--- a/ports/stm32/pyb_can.c
+++ b/ports/stm32/pyb_can.c
@@ -222,7 +222,7 @@ static void pyb_can_get_bit_timing(mp_uint_t baudrate, mp_uint_t sample_point,
}
}
- mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("couldn't match baudrate and sample point"));
+ mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("couldn't match baudrate %u and sample point %u"), baudrate, sample_point / 10);
}
// init(mode, prescaler=100, *, sjw=1, bs1=6, bs2=8)