I'm mixing idf and arduino.
First, I'm not familiar with concepts like usb-jtag/openocd. I wanted the esp32c3 to get configuration input from the serial tool, but once I used Serial.begin (Serial1.begin as well), the logs I output with log_x could not be displayed in the console (idf monitor). They seemed to be mutually exclusive. finally, I used idf's uart_driver_install to initialize gpio20,21 as UART_NUM_1.
This works and does not affect my log_x output, but then I need an extra connector to connect to this uart1. I tried usb_serial_jtag_read_bytes, but because there is no process like usb_serial_jtag_driver_install, this produced an exception.
The document records very few details, and it seems that reading data through usb is possible:
Bidirectional serial console, which can be used with IDF Monitor or another serial monitor.
Finally, I was very confused. gpio20, gpio21 are shown as u0rx, u0tx in the datasheet, but it allows me to initialize them as uart1. I was completely confused.
esp32 c3 read input from usb
esp32 c3 read input from usb
- Attachments
-
- sdkconfig.txt
- (64.39 KiB) Downloaded 40 times
-
- Posts: 112
- Joined: Thu Oct 03, 2019 10:52 pm
- Contact:
Re: esp32 c3 read input from usb
ESP32C3 has two UARTs.
One is UART0 and is assigned as stdin/stdout.
The other one is free to use on UART1.
UART0 uses GPIO20/21 by default,
There are no restrictions on GPIO that can be used as UART.
Any GPIO can be used as a UART.
>I used idf's uart_driver_install to initialize gpio20,21 as UART_NUM_1.
This causes UART0 to lose GPIO.
If you use uart_driver_install to initialize gpio0,1 as UART_NUM_1, you can use both UART0/1.
UART0--GPIO20/21
UART1--GPIO0/1
ESP32C3 has USB Serial/JTAG Controller Console function.
ESP32C3's USB Serial/JTAG Controller Console uses GPIO18/19 and cannot be changed.
The function of USB Serial/JTAG Controller Console is to replace UART0 input/output with USB input/output.
It does not add a serial port.
If you want to add a serial port, Dedicated GPIO is a better choice.
Using Dedicated GPIO adds one more UART port in addition to UART0/1.
https://github.com/espressif/esp-idf/tr ... /soft_uart
One is UART0 and is assigned as stdin/stdout.
The other one is free to use on UART1.
UART0 uses GPIO20/21 by default,
There are no restrictions on GPIO that can be used as UART.
Any GPIO can be used as a UART.
>I used idf's uart_driver_install to initialize gpio20,21 as UART_NUM_1.
This causes UART0 to lose GPIO.
If you use uart_driver_install to initialize gpio0,1 as UART_NUM_1, you can use both UART0/1.
UART0--GPIO20/21
UART1--GPIO0/1
ESP32C3 has USB Serial/JTAG Controller Console function.
ESP32C3's USB Serial/JTAG Controller Console uses GPIO18/19 and cannot be changed.
The function of USB Serial/JTAG Controller Console is to replace UART0 input/output with USB input/output.
It does not add a serial port.
If you want to add a serial port, Dedicated GPIO is a better choice.
Using Dedicated GPIO adds one more UART port in addition to UART0/1.
https://github.com/espressif/esp-idf/tr ... /soft_uart
Who is online
Users browsing this forum: Bing [Bot] and 140 guests