ESP32 TWAI/CAN gets locked up and cannot recover
Posted: Fri Aug 19, 2022 6:36 am
I have multiple devices using TWAI/CAN bus. I am using TI ISO1042 as the transceiver and the bus is running at 250kbps. 2 of the devices are working fine but one of them locks up after a few days to 2 weeks. The device still receives frames without any issue but cannot be recovered using "twai_initiate_recovery()" or with a complete soft reset.
Recovery Logic:
Reset logic
Pulling power gets the device back online for another few days to 2 weeks.
The devices are identical, all chips are from the same batch. I swapped their position on the bus with no difference.
It's possible that that the traces were routed poorly (250mil difference in routing length) but I don't think this would be it because the other 2 devices are working fine for months.
Does anyone have any ideas?
Thanks!
Recovery Logic:
Code: Select all
twai_read_alerts(TWAI_ALERT_BUS_OFF);
// Coder to wait 5 seconds
twai_initiate_recovery();
twai_read_alerts(TWAI_ALERT_BUS_RECOVERED);
// Never gets past this
Code: Select all
twai_stop();
twai_driver_uninstall();
periph_module_reset(PERIPH_TWAI_MODULE);
twai_driver_install();
twai_start();
The devices are identical, all chips are from the same batch. I swapped their position on the bus with no difference.
It's possible that that the traces were routed poorly (250mil difference in routing length) but I don't think this would be it because the other 2 devices are working fine for months.
Does anyone have any ideas?
Thanks!