[Ovmsdev] OVMS Poller module/singleton
Michael Balzer
dexter at expeedo.de
Sat Jan 25 02:52:23 HKT 2025
I was too quick on this conclusion:
Am 19.01.25 um 12:48 schrieb Michael Balzer via OvmsDev:
> Regarding CAN timing, our ESP32CAN/SJA1000 configuration is mostly
> according to the SAE/CiA recommendations, with one exception: we
> generally enable multi (triple) sampling, regardless of the bus speed
I trusted this CAN timing tool:
https://www.esacademy.com/en/library/calculators/sja1000-timing-calculator.html
…because it claims it applies the CiA recommendation. That turns out to
either be not true or to be different from the SAE recommendation.
I've had another look at the SAE J2284-3 spec.
TL;DR: our sampling point is too late and our tolerance for timing
variances of other devices on the bus is too low, at least for the usual
500 kbit/s bus speed.
For 500 kbit/s, SAE J2284-3 defines SJW=3 and TSEG2=3 at tq=125ns, or
SJW=3 and TSEG2=3…5 at tq=100ns, resulting in the sampling point being
in the range 75-85%.
Our driver currently uses tq=125ns with SJW=2 and TSEG2=2, sampling at
87.5%, so clearly outside the recommendation.
The ESP-IDF driver configuration uses the tq=100ns setup, and places
TSEG2 at 4:
#define CAN_TIMING_CONFIG_500KBITS() {.brp = 8, .tseg_1 = 15, .tseg_2
= 4, .sjw = 3, .triple_sampling = false}
→ bus clock = .brp / 80 MHz → tq=100ns, with sampling at tq 16 of 20 =
80% -- this is exactly as recommended by SAE.
I now test this configuration in my Mii, so far without issues.
To test this timing, apply the attached patch, this also includes the
SAE 500 kbit/s timing for can2/3.
Regards,
Michael
--
Michael Balzer * Am Rahmen 5 * D-58313 Herdecke
Fon 02330 9104094 * Handy 0176 20698926
-------------- next part --------------
A non-text attachment was scrubbed...
Name: can1-sae.diff
Type: text/x-patch
Size: 2378 bytes
Desc: not available
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20250124/d77573ed/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20250124/d77573ed/attachment-0001.sig>
More information about the OvmsDev
mailing list