Hi Michael,

I tried to fix the CAN Bus hang years ago, but failed.  It always seemed like the chip ended up an interrupt short, waiting to be notified of something that had already occurred.  That's consistent with what is described here.  In my past experience that sort of bug was usually caused by a race condition somewhere in the driver where an interrupt was acknowledged too broadly, thus acknowledging both the intended event and clearing the yet-to-be-seen interrupt before it's processed.  Unfortunately I wasn't able to identify that scenario in the code, nor find a way to detect and un-stick the chip.

I have a vague recollection about the choice of level vs edge triggering, but this was back in about 2019 and my memory is a bit foggy now.  I'll need to dig around my archives for my notes.  Will write back if I find anything.

Greg D


Michael Balzer via OvmsDev wrote:
Everyone,

Andreas Jansson found an issue with our MCP based CAN buses getting stuck occasionally on high bus load (see PR #1461 & #1462). The fix is based on changing the interrupt trigger from edge to level for the MCP buses, to assert all interrupt reasons get fully processed.

This in turn lead to the discovery that the custom module by Thomas Heuer for the Smart car actually isn't equipped with the second MCP2515, but also doesn't pull up the interrupt input pin. With interrupt trigger on level, that lead to an interrupt storm right on initialization of `can3`, fully blocking the boot process.

See https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/issues/1475 for details.

To fix that the MCP2515 driver now probes the device before actually enabling interrupts.

Both changes need to be tested thoroughly with vehicles actually using `can2` / `can3` / `can4`.

Regards,
Michael

PS: I remember there were still some open issues with MCP CAN buses, maybe the interrupt trigger change has an effect on those as well.


_______________________________________________
OvmsDev mailing list -- ovmsdev@lists.openvehicles.com
To unsubscribe send an email to ovmsdev-leave@lists.openvehicles.com