ESP32 Arduino CDC communication unreliable/dropouts on ESP32-S3
Posted: Tue Oct 28, 2025 4:27 pm
Hello. I've discovered a problem with errors and dropouts on CDC communication data transfers.
This simple demonstration code shows when data arrive out of order and drops out.
The time value should be steadily increasing, but where it first appears that it only dropped text that spans a few lines, you can see that a later timestamp value is sent before an earlier one.
I first discovered this potential problem while trying to debug errors in CSV data sent from the DUT, and commas and newlines would appear out of order.
You can readily replicate the problem with the following code:
This results in the time in micros and a sequence number. Here is a snippet showing the problem happening:
This simple demonstration code shows when data arrive out of order and drops out.
The time value should be steadily increasing, but where it first appears that it only dropped text that spans a few lines, you can see that a later timestamp value is sent before an earlier one.
I first discovered this potential problem while trying to debug errors in CSV data sent from the DUT, and commas and newlines would appear out of order.
You can readily replicate the problem with the following code:
Code: Select all
#include <Arduino.h>
void setup() {
Serial.begin(115200);
}
uint32_t counter = 0;
void loop() {
Serial.print(micros());
Serial.print(",");
Serial.print(counter++);
Serial.print("\n");
}
This results in the time in micros and a sequence number. Here is a snippet showing the problem happening:
Code: Select all
4445713,110809
4445746,110810
4445789,110811
4445829,110812
4445876,110813
4445917,110814
4445959,110815
4445992,110816
4446026,110817
4446071,110818
4446110,110819
4446151,110820
4446195,110821
4446228,110822
4446270,110823
4446310,110824
4446352,110825
4446396,110826
4446437,110827
4446471,110828
4446513,110829
4446554,110830
4446590,110831
4446633,110832
4446667,110833
4446710,110834
4446752,110835
4446785,110836
4446833,110837
44468664448636,110882
4448670,110883
4448713,110884
4448747,110885
4448795,110886
4448828,110887
4448876,110888
4448917,110889
4448959,110890
4448992,110891
4449026,110892
4449072,110893
4449113,110894
4449154,110895
4449196,110896
4449237,110897