Thank you very much, this did the trick! Seems to be working stable now.DrMickeyLauer wrote: ↑Thu Apr 04, 2024 10:03 amI'm not sure I entirely understand your code, but: Here's a way to serve TWAI efficiently:
1. CONFIG_TWAI_ISR_IN_IRAM=y
2. When calling twai_driver_install(), the intr_flags member of twai_general_config_t should set the ESP_INTR_FLAG_IRAM set.
3. Create a mid-high priority TWAI receiver task that blocks in twai_receive until cancelled. Upon receiving a frame, put it into a FreeRTOS queue with sufficient number of elements (I use 558 to accommodate for a complete ISOTP frame). Put this code in IRAM.
4. In your "normal" code, have a task that blocks on the FreeRTOS queue forever and handles the arriving frames.
5. Don't print anything other than, say, an accumulated number of frames arriving per second. Printing is SLOW
[SOLVED] Avoid blocking code execution (erase flash) for TWAI
Re: Avoid blocking code execution (erase flash)
Who is online
Users browsing this forum: acsoprana, Baidu [Spider], Bing [Bot] and 81 guests