All of lore.kernel.org
 help / color / mirror / Atom feed
* sjw in can_calc_bittiming
@ 2021-11-02 15:03 Matthias Weißer
  2021-11-02 15:36 ` Oliver Hartkopp
  2021-11-05 12:07 ` Marc Kleine-Budde
  0 siblings, 2 replies; 5+ messages in thread
From: Matthias Weißer @ 2021-11-02 15:03 UTC (permalink / raw)
  To: linux-can

Hi

we recently had a case here where one member of a CAN bus couldn't receive
frames with data content of only zeros:

$ cansend can0 123#0000000000000000

After some investigation we found the root cause to be a slight difference
(about 1%) in actual bitrates of the two members. The one with showed the
RX errors had a sjw value of 1 and a lot of time quanta (40) due to the 40MHz
CAN clock.

This leads to a build up of phase error (as sjw is not able to compensate for
enough of the bitrate difference) which at some point leads to a framing
error due to missing a stuff bit. Playing around with the sample point can
improve or worsen the behavior.

We can fix this quite easily by specifying a higher sjw value.

Question is now:
Wouldn't it make sense to increase sjw in can_calc_bittiming() to something
like 5% of the total time quanta? This may increase the reliability of the CAN
network when there are differences in the bitrates of the single members. Are
there any arguments against such an arbitrary selection of sjw?

If you agree with such a change I can come up with a proper patch. If I wrote
totally nonsense please tell me :-)

Regards

Matthias

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-05 12:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 15:03 sjw in can_calc_bittiming Matthias Weißer
2021-11-02 15:36 ` Oliver Hartkopp
2021-11-02 15:59   ` Wolfgang Grandegger
2021-11-03  7:12   ` Matthias Weißer
2021-11-05 12:07 ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.