I am using an ESP32-C3 SuperMini Board and have run Serial (GPIO18 - USB_N, GPIO19 - USBD_P) and Serial0 (GPIO20 - U0RXD, GPIO21 - U0TXD).
But the diagram shows that there is another Serial (GPIO1 - U1RXD, GPIO0 - U1TXD), but it does not work. Serial1 compiles, but then Serial USB stops working.
Anyone know how to get Serial1 to work?
// ESP32-C3 SuperMini Board (Aliexpress 1.7$)
// (PlatformIO IDE)
/*
X1:
1 - GPIO5 / ADC2 / SCL / SPI_MISO
2 - GPIO6 / SPI_MOSI
3 - GPIO7 / SPI_SS
4 - GPIO8 / PWM / SDA
5 - GPIO8 / BOOT / SCL
6 - GPIO10
7 - GPIO20 / U0RXD (Serial0)
8 - GPIO21 / U0TXD (Serial0)
X2:
8 - VBUS (5V)
7 - GND
6 - 3.3V
5 - GPIO4 / ADC1 / SDA / SPI_SCK
4 - GPIO3
3 - GPIO2 - R10k - 3.3V
2 - GPIO1 / U1RXD (Serial1 - No Work)
1 - GPIO0 / U1TXD (Serial1 - No Work)
GPIO8 - LED (Blue) - R5k1 - 3.3V
GPIO9 - Button PROG (BOOT) - GND
GPIO18 - USBD_N (Serial)
GPIO19 - USBD_P (Serial)
*/
/* === platformio.ini ===
[env:seeed_xiao_esp32c3]
platform = espressif32
board = seeed_xiao_esp32c3
framework = arduino
*/
/*
RAM: [ ] 4.3% (used 14076 bytes from 327680 bytes)
Flash: [== ] 19.1% (used 250218 bytes from 1310720 bytes)
*/
#include <WiFi.h>
#define LED 8 // BUILTIN Invert
char data[250];
int tik = 0;
void setup() {
pinMode(LED, OUTPUT);
digitalWrite(LED, HIGH);
delay(100); // For start USB
Serial.begin(115200);
while(!Serial);
Serial.println("START USB");
Serial0.begin(115200);
while(!Serial0);
Serial0.println("START U0");
//Serial1.begin(115200);
//while(!Serial1);
//Serial1.println("START U1");
}
void loop() {
tik++;
digitalWrite(LED, LOW);
delay(100);
digitalWrite(LED, HIGH);
delay(1000);
if (Serial.available()) {
byte m = Serial.readBytesUntil('\n', data, sizeof (data)-1);
data[m] = '\0';
Serial.println(data);
}
if (Serial0.available()) {
byte m = Serial0.readBytesUntil('\n', data, sizeof (data)-1);
data[m] = '\0';
Serial0.println(data);
}
//if (Serial1.available()) {
// byte m = Serial1.readBytesUntil('\n', data, sizeof (data)-1);
// data[m] = '\0';
// Serial1.println(data);
//}
Serial.print("TIK USB: "); Serial.println(tik);
Serial0.print("TIK U0: "); Serial0.println(tik);
//Serial1.print("TIK U1: "); Serial1.println(tik);
}