ESP32-S3 USB Port uploads but serial comms are not working.
Posted: Fri Aug 30, 2024 12:54 pm
Hi. Below is a test program I am using for a project that uses am ESP32-S3 device. I am using the USB-to-Serial internal support (pins 19 & 20) for both uploading the code as well as serial communications when the application is running. Oddly, the code uploads fine. The odd thing is that I cannot establish serial comminications over the port. Windows10 sees the port as open and the serial terminal opens for that port but the application itself does not open a port (Serial fails).
What makes this odder (for me anyway) is that I used an ESP32-C3-Mini on another project and was able to both upload the code and use the USB port for serial communications just fine. It is my understanding that both the C3 and S3 have internal USB-to-Serial support.
FYI: I am using Visual Studio 2023 with the VisualMicro extension for the IDE.
Any insight is most appreciated.
What makes this odder (for me anyway) is that I used an ESP32-C3-Mini on another project and was able to both upload the code and use the USB port for serial communications just fine. It is my understanding that both the C3 and S3 have internal USB-to-Serial support.
FYI: I am using Visual Studio 2023 with the VisualMicro extension for the IDE.
Any insight is most appreciated.
Code: Select all
/*
Name: USBComTest.ino
Created: 8/29/2024
*/
/*********************************************************************
This is the code is just to test the ability to program and
communicate over the USB port on the ESP32-S3.
*********************************************************************/
#include <Arduino.h>
/********************REVISION HISTORY********************************
0.0 08/29/24
Inital unreleased development
*********************************************************************/
// Define the command terms
constexpr auto CmdArraySize = 8; // Maximum number of parameters in any command elements
String Cmd[CmdArraySize]; // The command array received
bool CmdIsValid; // The command received is valid
/////////////////////////////////////////// SETUP ////////////////////////////////////////////////////////
void setup() {
// Setup the serial com port
Serial.begin(115200);
Serial.setTimeout(20);
//while (!Serial);
delay(500);
Serial.println("---------------------");
Serial.println(" USB Serial Com Test");
Serial.println("---------------------");
}
//////////////////////////////////////////// LOOP /////////////////////////////////////////////////////////////
void loop() {
// Check to see if there is a serial command was received
byte i = 0;
byte ch;
char charSerial[127];
// Serial data available
while (Serial.available()) {
ch = Serial.read();
if ((ch == '\r') || (ch == '\n')) {
charSerial[i] = '\0';
Serial.println(charSerial);
i = 0;
}
else {
charSerial[i] = (char)ch;
i++;
}
}
delay(10); // Slow things down just a bit
}