ESP32C6 - Using USB Serial without logging

niels.1234
Posts: 2
Joined: Mon Jul 08, 2024 1:50 pm

ESP32C6 - Using USB Serial without logging

Postby niels.1234 » Mon Jul 08, 2024 2:02 pm

Hi,

For my application I'd like to send data over the USB-serial port. However, I cannot find a way of enabling the USB-UART bridge without also enabling logging over this port. Ideally, I'd like to have the following sdkconfig fields to completely disable the ESP_LOGx functions logging to UART/USB.

Code: Select all

CONFIG_ESP_CONSOLE_NONE=y
CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
But, when I am in this mode I seem unable to init the driver/usb_serial_jtag peripheral to manually send data over the USB-serial bridge. Is there a way of doing this? This is my current code to initialize and send data over the usb_serial_jtag driver.

Code: Select all

printf("Configuring USB\n");

usb_serial_jtag_driver_config_t usbConfig = USB_SERIAL_JTAG_DRIVER_CONFIG_DEFAULT();
esp_err_t usbRet = usb_serial_jtag_driver_install(&usbConfig);

printf("USB Configured: %d\n", usbRet);

const char* prompt = "1234567890abcdef\n";
int s = usb_serial_jtag_write_bytes((uint8_t*)prompt, strlen(prompt), portMAX_DELAY);
printf("Bytes send: %d\n", s); 
Which outputs:

Code: Select all

Configuring USB
USB Configured: 0
Bytes send: 17
Any help or pointers would be appreciated!

Thanks in advance,
Niels

ESP_Sprite
Posts: 9727
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32C6 - Using USB Serial without logging

Postby ESP_Sprite » Tue Jul 09, 2024 2:49 am

FWIW, on latest master this works just fine, including the sdkconfig you want to set. What ESP-IDF version are you on?

niels.1234
Posts: 2
Joined: Mon Jul 08, 2024 1:50 pm

Re: ESP32C6 - Using USB Serial without logging

Postby niels.1234 » Wed Jul 10, 2024 3:25 pm

This is ESP-IDF v5.2.1.

However, I found that if I call `usb_serial_jtag_ll_txfifo_flush` (from `hal/usb_serial_jtag_ll.h`) it also works.

But thanks for checking anyway!

Who is online

Users browsing this forum: Google [Bot], Orange_Murker and 104 guests