[Ovmsdev] OVMS Poller module/singleton
Mark Webb-Johnson
mark at webb-johnson.net
Sat Jan 25 09:57:38 HKT 2025
Nice work. Thanks.
Mark
> On Jan 25, 2025, at 2:52 AM, Michael Balzer via OvmsDev <ovmsdev at lists.openvehicles.com> wrote:
>
> 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
>
> <can1-sae.diff>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
More information about the OvmsDev
mailing list