Page 1 of 1

ESP32-S3 USB CDC Console misses chunks for large serial data transmits

Posted: Tue Mar 12, 2024 10:06 pm
by BDesterBE
Hello,

I am creating a python script which serially connects to a esp32-s3 USB CDC console device with 115200 baud. I am sending a large command, the contents of a certificate, which is a ~2400 character string. I observe that the esp32 only receives in total ~250 characters.

What's interesting is that the esp32 will always receive ~90 characters from the beginning, as well as some bytes from the end of the certificate, indicating that data from the middle of the string is being missed. I also can observe this behavior occurring in real time on the secondary console port in picocom, e.g. the first ~90 bytes show up, a pause, and this repeating a couple more times until the end of the certificate is sent. Pasting the command directly into the console exhibits the same behavior, granted it is able to receive ~600 characters.

I have troubleshooted several different likely culprits, including increasing the console's max_cmdline_length and task_priority, and have looked for config options relating to the USB CDC buffer size with no luck.

If I split the command into multiple chunks on the python script side, sleeping in between chunk transmits, and I am able to send the entirety of the command. This should be a fine solution for now, however, I would expect that the esp32s3 would be capable of keeping up with this data size and rate.

I haven't been able to find documentation regarding flow control on the USB port, but I suspect it may be related to this issue.

Re: ESP32-S3 USB CDC Console misses chunks for large serial data transmits

Posted: Wed Mar 13, 2024 1:53 am
by ESP_Sprite
USB bulk transfers (as used by CDC) have integrated flow control: per the protocol it is impossible to loose data, when data isn't processed fast enough the host simply will wait until the buffers are empty again.