On 4/1/21 11:51 PM, Michael Balzer wrote:
It's 17 months after my report, and – lo & behold – Espressif just fixed the issue in their TWAI driver:
https://github.com/espressif/esp-idf/commit/2f5806092135e3d991057bc06225bdcf...
The commit includes three more workarounds for hardware bugs (see options added to Kconfig) probably worth checking for our driver:
1. "Add SW workaround for REC change during bus-off" – apparently the receive error counter can get stuck on a bus-off event preventing recovery 2. "Add SW workaround for TX interrupt lost errata" – apparently there's a race condition when reading the transmit interrupt 3. "Add SW workaround for invalid RX frame errata" – this already has been spotted by Craig, and he's added a counter for this, but it seems the fix also does a controller reset when this occurs → we probably should do so as well?
Issue #1 could be the cause for the occasional CAN1 freezes we see, with the CAN watchdog being our current workaround. #2 could cause a similar effect, especially on a polling-only bus.
So it could be worth porting those fixes to our driver. Craig, do you want to take this on?
I'll see what I can come up with this weekend. Craig