ESP32-S3 using TINYUSB, method for interrupt?

mowglihaha
Posts: 10
Joined: Tue Feb 28, 2023 8:42 am

ESP32-S3 using TINYUSB, method for interrupt?

Postby mowglihaha » Wed Mar 15, 2023 8:29 am

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 ?
Last edited by mowglihaha on Fri Mar 24, 2023 9:16 am, edited 2 times in total.

MicroController
Posts: 1704
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

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

Postby MicroController » Thu Mar 16, 2023 9:33 pm

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.

Who is online

Users browsing this forum: Bing [Bot] and 99 guests