Page 1 of 1

ESP32-S3 using TINYUSB, method for interrupt?

Posted: Wed Mar 15, 2023 8:29 am
by mowglihaha
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 ?

Re: ESP32-S3 using TINYUSB, method for interrupt?

Posted: Thu Mar 16, 2023 9:33 pm
by MicroController
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.