Page 1 of 1

ESP32 CAN fast receive-check

Posted: Wed Dec 18, 2019 10:24 pm
by ThomasK
Hello,
I need a quicker query whether a new message has arrived. 3ms, even one ms is too long. When a message arrives, I have enough time to evaluate it or wait until the queue is full ... but not for the check in the working-loop.
What is a faster alternative to the standard question:
if (xQueueReceive(CAN_cfg.rx_queue, &rx_frame, 3 * portTICK_PERIOD_MS) == pdTRUE)
{.....}
???
Thanx

Re: ESP32 CAN fast receive-check

Posted: Thu Dec 19, 2019 1:46 pm
by ThomasK
Can I directly read the status register from the CAN-controller whether a new message has arrived? If yes - how ?
Thank you.

Re: ESP32 CAN fast receive-check

Posted: Thu Dec 19, 2019 2:21 pm
by CollinK
You are allowed to specify a wait time of 0. In that case if there are no pending messages to receive then the function just immediately terminates. So, you can poll for CAN frames that way.

Re: ESP32 CAN fast receive-check

Posted: Thu Dec 19, 2019 5:22 pm
by ThomasK
Very simple and it works...
Thank you