Can anyone tell me why this behaves erratically on the ESP32S2 Mini?
Doesn't matter whether I use the Arduino serial port version:
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.println("Hello :-)");
delay(1000);
}
Or the USB CDC port version:
#include <USB.h>
USBCDC USBSerial;
void setup() {
// put your setup code here, to run once:
USB.begin();
USBSerial.begin();
}
void loop() {
// put your main code here, to run repeatedly:
USBSerial.println("Hello :-)");
delay(1000);
}
The ESP32 is directly connected to USB without a UART so its using its own native ESP32 CDC port.
The first example has sometimes displayed the output even after the ESP32S2 has been power cycled, but is unpredictable. For 90% of the time is shows no output at all. The second example displays nothing at all after a power cycle The exception is in Serial Monitor (IDE2.x.x) where both examples will display something, but only after reset has been pressed.
Both were compiled with 'Tools -> Use CDC on Boot: Enabled' set. I rather suspect the Espressif CDC code in the ESP32 firmware, but wondering why I can't get a stable USB connection on power up. Unlike the Serial Monitor, most applications just drop the serial connection on reset so I can't get a consistently working serial port.
