<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><blockquote type="cite"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">@Mark, do you remember where you got the MCP 125 kbit timing from? (introduced in commit eb78f8ec8509fe20f501bfb4946e809d29e2bb1d)</span></blockquote><div><font color="#000000"><span style="caret-color: rgb(0, 0, 0);"><br></span></font></div><div><font color="#000000">Sorry, I can’t remember. I would either have been from some other open source driver, or from an online calculator.</font></div><div><font color="#000000"><span style="caret-color: rgb(0, 0, 0);"><br></span></font></div><div><font color="#000000">I think it would be probably safe to go with the Arduino library settings, as that library should have had extensive real world use. So long as they use the same oscillator as us.</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Regards, Mark.<br id="lineBreakAtBeginningOfMessage"></font><div><br><blockquote type="cite"><div>On 19 Jan 2025, at 9:54 PM, Michael Balzer via OvmsDev <ovmsdev@lists.openvehicles.com> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div style="position: relative;"><div class="protected-part-F5C0C5A0-48A8-4B39-9207-DF4B3BA8D723" style="padding-top: 0px; position: relative; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div class="protected-title-F5C0C5A0-48A8-4B39-9207-DF4B3BA8D723" style="position: absolute; margin-top: -5px; background-color: rgb(255, 255, 255); margin-left: 20px; font-weight: bold;">Signed PGP part</div><div class="protected-content-F5C0C5A0-48A8-4B39-9207-DF4B3BA8D723" style="border: 3px solid rgb(204, 204, 204); padding: 16px 16px 16px 20px;">OK, here's my analysis & comparison of our 125 kbit timing for the MCP2515:<br><br>We currently use:<br><br><font face="monospace">mcp2515::Start()</font><br>[…]<br><font face="monospace">  case CAN_SPEED_125KBPS:<br>    cnf1=0x03; cnf2=0xf0; cnf3=0x86;<br>    // BRP=3, PRSEG=0, PS1=6, PS2=6, SJW=0, BTLMODE=1, SAM=1, SOF=1, WAKFIL=0 → Sample point at 9/16 = 56,25%<br>    break;</font><br><br>That results in this timing, with a very early sample point and a narrow sync jump width of 500 ns:<br><span id="cid:part1.OnugfupX.Y4AdwDGQ@expeedo.de"><125kbit-ovms-current-03-f0-86.png></span><br><br>The Arduino MCP_CAN library uses this config:<br>  #define MCP_16MHz_125kBPS_CFG1 (0x43)     /* Increased SJW       */<br>  #define MCP_16MHz_125kBPS_CFG2 (0xE5)<br>  #define MCP_16MHz_125kBPS_CFG3 (0x83)     /* Sample point at 75% */<br><br>Which results in this timing:<br><span id="cid:part2.52iT1h0y.rfJ0nnjK@expeedo.de"><125kbit-arduino-mcp-can-43-e5-83.png></span><br><br>This sets the sample point later and doubles the SJW. This has<span class="Apple-converted-space"> </span><br><br>The CiA recommendation of sampling at 87.5% and SJW 2 would require this config:<br><font face="monospace">  case CAN_SPEED_125KBPS:<br></font><font face="monospace">    cnf1=0x43; cnf2=0xbc; cnf3=0x81;<br></font><br>Timing:<br><span id="cid:part3.0JSXI05B.t1vxQ9XF@expeedo.de"><125kbit-cia-recommend-43-bc-81.png></span><br><br><br>IOW, our timing seems to be quite far off.<br><br>The 125 kbit configuration is only used by the Tesla Model S adapter currently, maybe it's OK for the Tesla, but not generally?<br><br>@Mark, do you remember where you got the MCP 125 kbit timing from? (introduced in commit eb78f8ec8509fe20f501bfb4946e809d29e2bb1d)<br><br>@Simon, you could test these alternative setups on can2:<br><br>a)<br><font face="monospace">    // CiA recommendation: PROP=5, PS1=8, PS2=2, SJW=2, sampling 1x @87.5%<br></font><font face="monospace">    cnf1=0x43; cnf2=0xbc; cnf3=0x81;<br><br></font>b)<br><font face="monospace">    // Arduino MCP_CAN: PROP=6, PS1=5, PS2=4, SJW=2, sampling 3x @75%:<br></font><font face="monospace">    cnf1=0x43; cnf2=0xe5; cnf3=0x83;<br></font><br>Regards,<br>Michael<br><br><br><div class="moz-cite-prefix">Am 19.01.25 um 13:39 schrieb Simon Ehlen via OvmsDev:<br></div><blockquote type="cite" cite="mid:7a2f013a-9a03-4a4b-8f88-3bf32f66e283@highteq.de"><div class="moz-cite-prefix">Hi,<br><br>Am 19.01.2025 um 12:48 schrieb Michael Balzer via OvmsDev:<br></div><blockquote type="cite" cite="mid:86bfcd71-4def-4c31-b60a-063ef4fd7665@expeedo.de">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><font face="monospace">esp32can::InitController():<br>[…]<br> <span class="Apple-converted-space"> </span>/* Set sampling<br>  <span class="Apple-converted-space"> </span>* 1 -> triple; the bus is sampled three times; recommended for low/medium speed buses     (class A and B) where filtering spikes on the bus line is beneficial<br>  <span class="Apple-converted-space"> </span>* 0 -> single; the bus is sampled once; recommended for high speed buses (SAE class C)*/<br> <span class="Apple-converted-space"> </span>MODULE_ESP32CAN->BTR1.B.SAM=0x1;</font><br><br>SAE defines "high speed" (class C) as speeds >= 125 kbit/s. See SAE J2284-1, -2 & -3, section 6.10.8 Data Sample Mode: "The data sampling shall always be set to single sample mode."<br><br>If setting SAM=0 for 500 kbit/s, our timing setup is exactly as recommended by two tested SJA1000 timing calculators on the web.<br><br>Maybe we should give that a try? I.e.<br><br><font face="monospace"> <span class="Apple-converted-space"> </span>MODULE_ESP32CAN->BTR1.B.SAM = (MyESP32can->m_speed < CAN_SPEED_125KBPS) ? 1 : 0;</font><br><br>Simon, can you try if that helps?<br></blockquote><br>I have adjusted the corresponding line.<br>I will check tomorrow whether this has an effect on the active mode.<br>I tried your recommendation and set the CONFIG_OVMS_VEHICLE_CAN_RX_QUEUE_SIZE to both 200 and 400. I have not yet checked whether the bus also crashes in active mode. However, I can see in listening mode that when I abort a running loading process (there are currently no overflows), many overflow messages are received.<br><br><blockquote type="cite" cite="mid:86bfcd71-4def-4c31-b60a-063ef4fd7665@expeedo.de">But as you also use can2, I wouldn't rule out a timing issue with the MCP2515 configuration. At which speed do you have can2, and did you have some indication from the vehicle error codes regarding a specific bus?<br></blockquote><div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: rgb(220, 220, 170);">RegisterCanBus</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(181, 206, 168);">1</span><span style="color: rgb(212, 212, 212);">, CAN_MODE_LISTEN, CAN_SPEED_500KBPS);</span></div><div><span style="color: rgb(220, 220, 170);">RegisterCanBus</span><span style="color: rgb(212, 212, 212);">(</span><span style="color: rgb(181, 206, 168);">2</span><span style="color: rgb(212, 212, 212);">, CAN_MODE_LISTEN, CAN_SPEED_125KBPS);
</span></div></div>I do not receive any feedback from the car as to which bus is affected, unfortunately no error code is saved for the incident. Do you have the option of specifying the affected bus in the overflow logging?<br><br>Cheers,<br>Simon<br><blockquote type="cite" cite="mid:86bfcd71-4def-4c31-b60a-063ef4fd7665@expeedo.de"><br><br><div class="moz-cite-prefix">Am 17.01.25 um 17:49 schrieb Michael Balzer via OvmsDev:<br></div><blockquote type="cite" cite="mid:6b478377-d2f1-4e41-8f2d-bbb1bb1c5e37@expeedo.de">OK, I've got a new idea: CAN timing.<br><br>Comparing our esp32can bit timing to the esp-idf driver's, there seem to be some differences:<br><a class="moz-txt-link-freetext" href="https://github.com/espressif/esp-idf/blob/master/components/hal/include/hal/twai_types_deprecated.h#L75" moz-do-not-send="true">https://github.com/espressif/esp-idf/blob/master/components/hal/include/hal/twai_types_deprecated.h#L75</a><br><br>Transceivers are normally tolerant to small timing offsets. Maybe being off a little bit has no effect under normal conditions, but it has when the transceiver has to cope with a filled RX queue. That could be causing the transceiver to slide just out of sync. If the timing gets garbled, the transceiver would signal errors in the packets to the bus, possibly so many the vehicle ECUs decide to raise an error condition.<br><br>Is that plausible?<br><br>On why the new poller could be causing this (in combination with too slow processing by the vehicle): as mentioned, the standard CAN listener mechanism doesn't care about queue overflows. The poller does. `OvmsPollers::Queue_PollerFrame()` does a log call when Tx/Rx tracing is enabled, that could even block, but tracing is optional and only meant for debugging. Not optional is the overflow counting using an atomic uint32.<br><br>The atomic types are said to be fast, but I never checked their actual implementation on the ESP32. Maybe they can block as well?<br><br>@Simon: it would be an option to try commenting out the overflow counting, to see if that's causing the issue.<br><br>Regards,<br>Michael<br><br><br><div class="moz-cite-prefix">Am 17.01.25 um 15:37 schrieb Chris Box via OvmsDev:<br></div><blockquote type="cite" cite="mid:010b019474b30c0d-45366923-5cdc-4a4b-a59d-cedf24ac5d5d-000000@eu-west-2.amazonses.com"><p>Yes, I can confirm I've had one experience of the Leaf switching to Neutral while driving, with a yellow warning symbol on the dash. It refused to reselect Drive until I had switched the car off and back on. Derek wasn't so lucky and he need to clear fault codes before the car would work.</p><p>On returning home, I found OVMS was not accessible over a network. I didn't try a USB cable. Unplugging and reinserting the OBD cable caused OVMS to rejoin Wi-Fi. However the SD logs showed nothing from the time of the event. CAN writes are enabled, so it can perform SOC limiting.</p><p>My car has been using this firmware since 21st November, based on the git master of that day. As a relatively new user of OVMS (only since October) I don't have much experience of older firmware.</p><p>Perhaps a safeguard should be implemented before releasing a new stable firmware that will be automatically downloaded by Leaf owners. But I don't have the expertise to know what that safeguard should be. Derek's suggestion of 'only CAN write when parked' appears to be a good idea.</p><p>Chris</p><p><br></p><p id="reply-intro">On 2025-01-15 18:18, Derek Caudwell via OvmsDev wrote:</p><blockquote type="cite" style="padding: 0px 0.4em; border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin: 0px;"><div id="replybody1"><div dir="auto">Since the following email I have high confidence the issue on the Leaf is related/caused by the poller as there has been no further occurrence and Chris has also experienced the car going to neutral on the new poller firmware. <div dir="auto"><br><div dir="auto">....</div><div dir="auto">I haven't ruled out it being a fault with my car yet. Shortly after it faulted the car was run into so has been off the road for sometime, my first step was to replace 12V battery. The ovms unit is now unplugged and if it does not fault over the next month while driving I'll be reasonably confident it's ovms related.</div><div dir="auto"> </div><div dir="auto">Not sure which firmware version the poller updates were included in but it was only after upgrading to it that the errors occurred (which could be coincidental however it has faulted twice more both on version 3.3.004-141-gf729d82c). For periods where I reverted to 3.3.003 it was fine.</div><div dir="auto"> </div><div dir="auto">It might be useful to have an extra option on the enable can write to only enable it when the car is parked/charging.</div></div></div><br><div class="v1gmail_quote v1gmail_quote_container"> </div></div></blockquote><p><br></p><br><fieldset class="moz-mime-attachment-header"></fieldset><pre wrap="" class="moz-quote-pre">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:OvmsDev@lists.openvehicles.com" moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre></blockquote><br><pre class="moz-signature" cols="72">-- 
Michael Balzer * Am Rahmen 5 * D-58313 Herdecke
Fon 02330 9104094 * Handy 0176 20698926</pre><br><fieldset class="moz-mime-attachment-header"></fieldset><pre wrap="" class="moz-quote-pre">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:OvmsDev@lists.openvehicles.com" moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre></blockquote><br><pre class="moz-signature" cols="72">-- 
Michael Balzer * Am Rahmen 5 * D-58313 Herdecke
Fon 02330 9104094 * Handy 0176 20698926</pre><br><fieldset class="moz-mime-attachment-header"></fieldset><pre wrap="" class="moz-quote-pre">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:OvmsDev@lists.openvehicles.com" moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre></blockquote><br><br><fieldset class="moz-mime-attachment-header"></fieldset><pre wrap="" class="moz-quote-pre">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre></blockquote><br><pre class="moz-signature" cols="72">-- 
Michael Balzer * Am Rahmen 5 * D-58313 Herdecke
Fon 02330 9104094 * Handy 0176 20698926</pre></div></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">OvmsDev mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><a href="mailto:OvmsDev@lists.openvehicles.com" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">OvmsDev@lists.openvehicles.com</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><a href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a></div></div></blockquote></div><br></div></body></html>