You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been having some issues with CAN communications between a handful of devices.
I started looking in to how the baudrate is calculated, and it seems to be slightly wrong.
SJW is not actually part of the bit-time calculation, I suspect this has been confused with SYNC_SEG (which is always 1).
The following is from the STM32F72xxx reference manual, but applies to all bxCAN peripherals.
I believe the calculation below should be calcBaudrate = (frequency / (prescaler * (1 + bs1 + bs2))).
Separately, to improve interoperability SJW can be increased from the default value of 1 - this will allow the next transition to arrive earlier than the node expects it - up to min(BS2, 4) time quanta.
In many cases, this can be safely set higher than 1 - and in other cases it's even necessary to avoid error frames and wider disruption on the bus.
Please can you let me know if you agree with this, or if you think I'm mistaken?
I'd be happy to prepare a PR to adjust this accordingly.
The text was updated successfully, but these errors were encountered:
We've been having some issues with CAN communications between a handful of devices.
I started looking in to how the baudrate is calculated, and it seems to be slightly wrong.
SJW
is not actually part of the bit-time calculation, I suspect this has been confused withSYNC_SEG
(which is always1
).The following is from the STM32F72xxx reference manual, but applies to all bxCAN peripherals.
I believe the calculation below should be
calcBaudrate = (frequency / (prescaler * (1 + bs1 + bs2)))
.STM32_CAN/STM32_CAN.cpp
Lines 707 to 717 in ae6ccad
Separately, to improve interoperability SJW can be increased from the default value of
1
- this will allow the next transition to arrive earlier than the node expects it - up tomin(BS2, 4)
time quanta.In many cases, this can be safely set higher than
1
- and in other cases it's even necessary to avoid error frames and wider disruption on the bus.Please can you let me know if you agree with this, or if you think I'm mistaken?
I'd be happy to prepare a PR to adjust this accordingly.
The text was updated successfully, but these errors were encountered: