jiauka / NMEA2000_esp32xx

7 stars 4 forks source link

TWAI error state recovery? #1

Open phatpaul opened 11 months ago

phatpaul commented 11 months ago

I am getting a twai state error after a few seconds. twai_transmit() returns ESP_ERR_INVALID_STATE I am still troubleshooting why it reaches that error state, but that make me wonder Does this library provide any error state recovery for the TWAI controller? (like this one: https://github.com/sergei/NMEA2000_esp32_twai/blob/master/NMEA2000_esp32_twai.cpp )

Also, I'm wondering should this work with IDF version 4.4. (I edited the minimum version in idf_component.yml and it compiles and runs for a few seconds.)

jiauka commented 11 months ago

Hi, I have not tested it with idf 4.4. Have you tried idf 5.x?

phatpaul commented 11 months ago

Yeah, I just tried your example project with IDF 5.0.3 and I get the same CAN hangup after a few seconds, so I probably have some hardware issue.

But my original question still stands, is there any error recovery mechanism by design? (i.e. if the CAN network is unplugged and reconnected, will this recover automatically or does it require a reset?)

jiauka commented 11 months ago

No, no error recovery. But I have use this in 3 devices on my boat for several months without and issue.

Anyway, I'll have a look at git you mentioned, maybe it is worth to add some error recovery.