Hello,
I have configured a ESP32-S3, to pop up as RNDIS device, everything works i can receive and transmit. But after i have built a web-server on top, that sends data from a websocket, some stability issues have occured.
My question is, is there a way to setup a interrupt or something very fast, so no packages are getting lost ?
ESP32-S3 using TINYUSB, method for interrupt?
-
- Posts: 10
- Joined: Tue Feb 28, 2023 8:42 am
ESP32-S3 using TINYUSB, method for interrupt?
Last edited by mowglihaha on Fri Mar 24, 2023 9:16 am, edited 2 times in total.
-
- Posts: 1708
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ESP32-S3 using TINYUSB, method for interrupt?
I recommend using a proper buffer between the callback handler and the task, e.g. https://docs.espressif.com/projects/esp ... ng-buffers
Your code now requires that the task processes one chunk of tud_rx_len bytes every time any data is received, and finishes before the next chunk arrives. While the task has not yet finished processing the chunk, no new data can be received. The problem becomes worse if you receive many small chunks. The task may be able to handle, say, one chunk of 500 bytes quickly enough but not 50 chunks of 10 bytes. Using a proper buffer will reduce or eliminate the timing dependency between receiving and sending of data. As long as the sender gets rid of the data fast enough on average it will work, instead of very fast for every piece of data.
Your code now requires that the task processes one chunk of tud_rx_len bytes every time any data is received, and finishes before the next chunk arrives. While the task has not yet finished processing the chunk, no new data can be received. The problem becomes worse if you receive many small chunks. The task may be able to handle, say, one chunk of 500 bytes quickly enough but not 50 chunks of 10 bytes. Using a proper buffer will reduce or eliminate the timing dependency between receiving and sending of data. As long as the sender gets rid of the data fast enough on average it will work, instead of very fast for every piece of data.
Who is online
Users browsing this forum: Bing [Bot] and 138 guests