ESP-IDF TWAI Queue implementation advice
Posted: Thu Mar 30, 2023 4:18 pm
Hello fellow programmers,
I'm wondering what would be the best approach in getting "CAN/TWAI" messages fast. This is buffer handling, overflow, receiving messages without any losses.
I was thinking of running a high priority RX TWAI (xTaskCreatePinnedToCore) that would be polling forever for messages to come in that calls "twai_receive(&rx_msg, 0)" which would then "xQueueSend" to another task that would be instructed to parse the message and do what ever means it needs.
Is this ideal? Is this a good way to handle high fast CAN messages? Or is there a better approach.
Any help or suggestions would be great!
For buffer management a ring buffer could also be added in the "Parser Queue" task.
I'm wondering what would be the best approach in getting "CAN/TWAI" messages fast. This is buffer handling, overflow, receiving messages without any losses.
I was thinking of running a high priority RX TWAI (xTaskCreatePinnedToCore) that would be polling forever for messages to come in that calls "twai_receive(&rx_msg, 0)" which would then "xQueueSend" to another task that would be instructed to parse the message and do what ever means it needs.
Is this ideal? Is this a good way to handle high fast CAN messages? Or is there a better approach.
Any help or suggestions would be great!
For buffer management a ring buffer could also be added in the "Parser Queue" task.