twai can't receive messages

t23319222
Posts: 11
Joined: Tue Mar 04, 2025 6:29 pm

twai can't receive messages

Postby t23319222 » Fri May 23, 2025 1:13 pm

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?

DrMickeyLauer
Posts: 209
Joined: Sun May 22, 2022 2:42 pm

Re: twai can't receive messages

Postby DrMickeyLauer » Sat May 24, 2025 2:34 pm

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.

Who is online

Users browsing this forum: Bing [Bot], ChatGPT-User and 5 guests