ESP32 CAN fast receive-check

ThomasK
Posts: 25
Joined: Wed Mar 20, 2019 2:33 am

ESP32 CAN fast receive-check

Postby ThomasK » Wed Dec 18, 2019 10:24 pm

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

ThomasK
Posts: 25
Joined: Wed Mar 20, 2019 2:33 am

Re: ESP32 CAN fast receive-check

Postby ThomasK » Thu Dec 19, 2019 1:46 pm

Can I directly read the status register from the CAN-controller whether a new message has arrived? If yes - how ?
Thank you.

CollinK
Posts: 18
Joined: Mon Apr 16, 2018 11:38 pm

Re: ESP32 CAN fast receive-check

Postby CollinK » Thu Dec 19, 2019 2:21 pm

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.

ThomasK
Posts: 25
Joined: Wed Mar 20, 2019 2:33 am

Re: ESP32 CAN fast receive-check

Postby ThomasK » Thu Dec 19, 2019 5:22 pm

Very simple and it works...
Thank you

Who is online

Users browsing this forum: No registered users and 46 guests