Page 1 of 1

twai can't receive messages

Posted: Fri May 23, 2025 1:13 pm
by t23319222
I have a esp that received and logs twai messages. To send the messages, I use a PCAN dongle. I use an infinite loop to send messages to the esp forever. The esp receives the messages fine when I start sending the messages AFTER the esp has booted up. But the esp doesn't receive anything when I start sending the messages BEFORE the esp has booted up

I checked the twai state in a loop and it says TWAI_STATE_RUNNING. I use TWAI_MODE_NORMAL.

What could be the problem here?

Re: twai can't receive messages

Posted: Sat May 24, 2025 2:34 pm
by DrMickeyLauer
Your PCAN dongle might just go off-bus, because no one is ACKnowledging its messages. CAN is designed in a way that devices automatically leave the bus if there are errors (like, no one is ACKnowledging messages for some time.). Make sure that you have always at least two participants on the bus.