<div dir="ltr">I think this is kinda what it's always done with Ioniq5, but this is with the timing patch applied.. if I go from State=0 .. so no polling which means NOTHING received on the CAN bus, to State=1 (Vehicle on - lotsa polling including every second) where it starts polling, I get:<div><br><div>E (36101885) can: can1: intr=18642 rxpkt=11924 txpkt=6700 errflags=0x8000d9 rxerr=0 txerr=8 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0 errreset=1<br>E (36101885) can: can1: intr=18646 rxpkt=11924 txpkt=6700 errflags=0x8000d9 rxerr=0 txerr=40 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0 errreset=1<br>E (36101885) can: can1: intr=18648 rxpkt=11924 txpkt=6700 errflags=0x8000d9 rxerr=0 txerr=56 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0 errreset=1<br>E (36101885) can: can1: intr=18650 rxpkt=11924 txpkt=6700 errflags=0x8000d9 rxerr=0 txerr=72 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0 errreset=1<br>E (36101885) can: can1: intr=18652 rxpkt=11924 txpkt=6700 errflags=0x8000d9 rxerr=0 txerr=88 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0 errreset=1<br>E (36101885) can: can1: intr=18654 rxpkt=11924 txpkt=6700 errflags=0x8040d9 rxerr=0 txerr=104 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0 errreset=1<br>E (36101885) can: can1: intr=18655 rxpkt=11924 txpkt=6700 errflags=0x8040d9 rxerr=0 txerr=112 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0 errreset=1<br>E (36101885) can: can1: intr=18659 rxpkt=11924 txpkt=6700 errflags=0x204800 rxerr=0 txerr=128 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=1 wdgreset=0 errreset=1</div><div><br></div><div>.... followed by</div><div>E (36145665) esp32can: can1 stuck bus-off error state (errflags=0x00040c00) detected - resetting bus</div><div><br></div><div>And then things seem to be good from there. I have bus 1 registered as active 500kbps</div><div><br></div><div> <b>RegisterCanBus(1, CAN_MODE_ACTIVE, CAN_SPEED_500KBPS);</b><br></div><div><br></div><div>//.ichael</div></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, 25 Jan 2025 at 09:58, Mark Webb-Johnson via OvmsDev <<a href="mailto:ovmsdev@lists.openvehicles.com">ovmsdev@lists.openvehicles.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Nice work. Thanks.<br>
<br>
Mark<br>
<br>
> On Jan 25, 2025, at 2:52 AM, Michael Balzer via OvmsDev <<a href="mailto:ovmsdev@lists.openvehicles.com" target="_blank">ovmsdev@lists.openvehicles.com</a>> wrote:<br>
> <br>
> I was too quick on this conclusion:<br>
> <br>
>> Am 19.01.25 um 12:48 schrieb Michael Balzer via OvmsDev:<br>
>> 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<br>
> <br>
> I trusted this CAN timing tool: <a href="https://www.esacademy.com/en/library/calculators/sja1000-timing-calculator.html" rel="noreferrer" target="_blank">https://www.esacademy.com/en/library/calculators/sja1000-timing-calculator.html</a><br>
> …because it claims it applies the CiA recommendation. That turns out to either be not true or to be different from the SAE recommendation.<br>
> <br>
> I've had another look at the SAE J2284-3 spec.<br>
> <br>
> 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.<br>
> <br>
> 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%.<br>
> <br>
> Our driver currently uses tq=125ns with SJW=2 and TSEG2=2, sampling at 87.5%, so clearly outside the recommendation.<br>
> <br>
> The ESP-IDF driver configuration uses the tq=100ns setup, and places TSEG2 at 4:<br>
> #define CAN_TIMING_CONFIG_500KBITS() {.brp = 8, .tseg_1 = 15, .tseg_2 = 4, .sjw = 3, .triple_sampling = false}<br>
> → bus clock = .brp / 80 MHz → tq=100ns, with sampling at tq 16 of 20 = 80% -- this is exactly as recommended by SAE.<br>
> <br>
> I now test this configuration in my Mii, so far without issues.<br>
> <br>
> To test this timing, apply the attached patch, this also includes the SAE 500 kbit/s timing for can2/3.<br>
> <br>
> Regards,<br>
> Michael<br>
> <br>
> --<br>
> Michael Balzer * Am Rahmen 5 * D-58313 Herdecke<br>
> Fon 02330 9104094 * Handy 0176 20698926<br>
> <br>
> <can1-sae.diff><br>
> _______________________________________________<br>
> OvmsDev mailing list<br>
> <a href="mailto:OvmsDev@lists.openvehicles.com" target="_blank">OvmsDev@lists.openvehicles.com</a><br>
> <a href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" rel="noreferrer" target="_blank">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a><br>
<br>
_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.openvehicles.com" target="_blank">OvmsDev@lists.openvehicles.com</a><br>
<a href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" rel="noreferrer" target="_blank">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a><br>
</blockquote></div>