hello,
i am waiting for my costume board to come and mean while i am writing as code to it and i came across a doubt in my design.
i am using USB(gpio19-20) for programming and i connected uart0(gpio 39-40) to use a uart with device that work on uart.
my question is do i configure USB to use Serial.print() for debug and UART0 to communication with the device, i thought it should be Serial0.print().
because when choosing board: esp32-s3-usb-otg i get this error:
I moved your topic to a more appropriate forum category @wowpro71.
The Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.
In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.
I watched in YouTube an explanation that says when you use esp32 in usb otg mode the serial used for usb and serial0 for rx/tx.
If its not true how am i using rx/tx0?
can you give a link to your ESP32-S3-mini in particulat the pin out?
using a Espressif ESP32-S3-DevKitC-1 U0TXD and U0RXD appear to be Serial on USB connector labled COM
I used the following code to test Serial1 using pins GPIO17 U1TXD tand GPIO18 U1RXD
// ESP32-S3 DevkitC-1 Serial1 test - for loopback test connect pin GPIO17 U1TXD to pin GPIO18 U1RXD"
// ss https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/_images/ESP32-S3_DevKitC-1_pinlayout_v1.1.jpg
#define RXD1 18
#define TXD1 17
void setup() {
// initialize both serial ports:
Serial.begin(115200);
Serial1.begin(115200, SERIAL_8N1, RXD1, TXD1);
Serial.println();
Serial.println("\n\nESP32-S3 DevkitC-1 serial1 test pin GPIO17 U1TXD pin GPIO18 U1RXD");
Serial.write(" for loopback test connect pin GPIO17 U1TXD to pin GPIO18 U1RXD\n");
}
void loop() {
// read from port 1, send to port 0:
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}
// read from port 0, send to port 1:
if (Serial.available()) {
int inByte = Serial.read();
//Serial.write(inByte);
Serial1.write(inByte);
}
}
when I connected GPIO17 and 18 the loopback test worked - serial monitor output
ESP32-S3 DevkitC-1 serial1 test pin GPIO17 U1TXD pin GPIO18 U1RXD
for loopback test connect pin GPIO17 U1TXD to pin GPIO18 U1RXD
loopback test
12344567890
Mine uses:
usb : 19,20
Rx0,tx0=39,40
Usually gpio 39,40 using ftdi to program the esp32 but i used gpio 19,20 pins to directly connect to usb port for programming.
So based on your example i can hook 39,40pins to a serial1.begin and serial.begin will be used with usb?
If you look here in HardwareSerial.cpp you can see if ARDUINO_USB_CDC_ON_BOOT is set to 0 then Uart0 is set to the keyword Serial and if ARDUINO_USB_CDC_ON_BOOT is defined then you can use Uart0 as Serial0 and the USB as Serial.
This is set by your board options in the Arduino IDE but I use Pio so cant help with the specific options to select but it will be USB mode or something like that.
Also, it has been a while so I'm wondering, did you manage to sort out your issue? Please add your solution for completeness if you did.