Lolin ESP32-S3 reads 1 message every 2 message sent and it doesn't boot automatically

Hi,
I’m using a Lolin ESP32-S3 mini and I have two weird issue that doesn’t happen with ESP32.

1 issue:
to use the Serial.print() on the ESP32-S3 I need to add this build_flags:
‘-D ARDUINO_USB_MODE=1’
‘-D ARDUINO_USB_CDC_ON_BOOT=1’
to my platformio.ini.

If I add this flags I can correctly print to Serial but the microcontroller doesn’t “boot” automatically.
If I connect the microcontroller to a power bank, the sketch does not start,
if I connect it to the usb the sketch does not start until I open the Serial monitor.

how this is possible?

2 issue:
I have a PC software that sends messages over serial. I read this messages on the ESP by using the Serial.read() function.
This works perfectly well on ESP32, C3 and S2 but not on S3.

On S3 I have a weird behaviour. If I sent 10 message from the PC to the ESP I receive only 5 message, if I send 20 message, I receive only 10 message.
I receive half the message I send from the PC. Why S3 is so weird?

Hope that someone can help bringing some lights on this weird issues :smiley:

Is there any

while(!Serial) {}

construct in the sketch?

@maxgerhardt thanks for the answer, no. this is very weird.

Have you verified this with the most simple “Blinky” code?

Hi @maxgerhardt,
thanks for the answer… I finally found the solution to the Serial problem (2nd issue).

I don’t know why, but S3 has different defaults for the RxBufferSize over the S2 and C3…
increasing the buffer size fixed the problem…

Serial.setRxBufferSize(2048);
Serial.begin(baudRateToUse);

I still haven’t found a solution to the first issue.
any idea on how to solve the second issue I described in the first post?

I have found a duplicate issue here.

My problem was related to the fact that Serial.flush() is now blocking on ESP32-S3