ESP32 TWAI/CAN gets locked up and cannot recover

CraftyMyner
Posts: 3
Joined: Fri Aug 19, 2022 3:20 am

ESP32 TWAI/CAN gets locked up and cannot recover

Postby CraftyMyner » 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:

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
Reset logic

Code: Select all

twai_stop();
twai_driver_uninstall();

periph_module_reset(PERIPH_TWAI_MODULE);
twai_driver_install();
twai_start();
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!

ESP_Dazz
Posts: 308
Joined: Fri Jun 02, 2017 6:50 am

Re: ESP32 TWAI/CAN gets locked up and cannot recover

Postby ESP_Dazz » Fri Sep 09, 2022 5:00 am

@ CraftyMyner

If you're on the ESP32, could you check that you have enabled all of the TWAI driver's Hardware Errata workarounds in menuconfig?

Who is online

Users browsing this forum: No registered users and 51 guests