Hello
I fiddle to figure out how I can use both USB as Output
I have no success. Any clue how to do it. Seems easy but no.
My Board is the ESP32-S3-DevKidC-1
Hello
I fiddle to figure out how I can use both USB as Output
I have no success. Any clue how to do it. Seems easy but no.
My Board is the ESP32-S3-DevKidC-1
With the ESP32-S3-DevKitC-1 board, one of the two USB ports is connected to a USB-to-TTL converter, while the second port connects directly to the microcontroller, leveraging the ESP32's ability to act as a host.
When you enable USB CDC on Boot, Serial0 is connected to the converter, while Serial or SerialUSB becomes the CDC device.
I usually set the board options like this:
this works now no 115200 speed for me
#include <Arduino.h>
#include <USB.h>
// 1. Native USB-CDC (erscheint als COM-Port im PC)
USBCDC USBSerial;
// 2. Echter Hardware-UART auf GPIO43 (TX) + GPIO44 (RX)
HardwareSerial ExtSerial(2); // UART2 → frei auf beliebige Pins legen
void setup() {
// ───── Native USB für Debug (PlatformIO Monitor) ─────
USB.begin();
USBSerial.begin(115200);
while (!USBSerial) { delay(10); }
delay(10000);
// ───── Externer UART auf GPIO43/44 mit deiner funktionierenden Baudrate ─────
ExtSerial.begin(57600, SERIAL_8N1, 44, 43); // RX=44, TX=43
delay(500);
// Beide Ports begrüßen
USBSerial.println("\n" "==========================================");
USBSerial.println(" ESP32-S3 DUAL SERIAL – LÄUFT!");
USBSerial.println(" USB-CDC → dieser Monitor");
USBSerial.println(" GPIO43 (TX) + GPIO44 (RX) → 9600 Baud");
USBSerial.println("==========================================\n");
ExtSerial.println("Hallo vom echten UART auf GPIO43/44!");
ExtSerial.println("Das siehst du nur am externen Adapter (9600 Baud)");
}
void loop() {
static uint32_t last = 0;
if (millis() - last >= 2000) {
last = millis();
// ───── Ausgabe auf BEIDEN Ports gleichzeitig ─────
String msg = "Dual-Alive: " + String(millis()) +
" ms | Heap: " + String(ESP.getFreeHeap());
USBSerial.println(msg); // → PlatformIO Monitor
ExtSerial.println(msg); // → GPIO43/44 (9600 Baud)
// Extra Lebenszeichen nur auf externem Port
ExtSerial.println("<<< Nur auf GPIO43/44 sichtbar >>>");
}
// ───── Loopback: was an GPIO44 reinkommt → auf USB ausgeben ─────
if (ExtSerial.available()) {
while (ExtSerial.available()) {
char c = ExtSerial.read();
USBSerial.write(c);
}
USBSerial.println();
}
// ───── Optional: was du in PlatformIO eingibst → an externen Port weiterleiten ─────
if (USBSerial.available()) {
while (USBSerial.available()) {
char c = USBSerial.read();
ExtSerial.write(c);
}
}
}