I am trying to get serial print function working over the integrated USB.
I have an ESP32C3 connected over USB (IO18/IO19). I am able to load the program onto the device. however when I boot it I get nothing.
rst:0x15 (USB_UART_CHIP_RESET),boot:0xf (SPI_FAST_FLASH_BOOT)
Saved PC:0x42010738
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
SHA-256 comparison failed:
Calculated: 080c5cb68a075ced55f248b97bca965e3e5bd5da80a64e34e6a1638f89d6f64e
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x403ce000
I am using the base config, however as you can see I have also tried some other options. Debug also does not work.
[env:esp32-c3-devkitm-1]
platform = espressif32
board = esp32-c3-devkitm-1
framework = arduino
; build_flags = -D ARDUINO_USB_MODE=1
; -D ARDUINO_USB_CDC_ON_BOOT=1
; -D CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
;debug_server = pio pkg exec -p tool-openocd-esp32 -c "openocd -f board/esp32c3-builtin.cfg"
;debug_port = localhost:3333
;debug_init_break = break loop
It is curious that the expected hash is wrong.
I have confirmed that the device is running with a simple blink program. So the device is booting but the USB is not configured correctly.
I have solved my problem. The USB Serial must be defined as in the below code to target the CDC usb interface.
#include "Arduino.h"
#define SerialCDC USBSerial
void setup() {
pinMode(2, OUTPUT);
SerialCDC.begin(115200);
SerialCDC.println("Hello from SerialCDC");
}
void loop() {
delay(1000);
SerialCDC.println("Hello from SerialCDC111");
}