ESP_LOGE and log_e broken with USB-CDC on ESP32-S2 (and others?) if #include <Arduino.h> [[includes diagnosis!]] #10121
Labels
Chip: ESP32-S2
Issue is related to support of ESP32-S2 Chip
Chip: ESP32-S3
Issue is related to support of ESP32-S3 Chip
Board
any board with ESP32-S2 and USB-CDC, possibly other cores
Device Description
any board which uses on-chip USB as its primary serial port (i.e. running with
-DARDUINO_USB_CDC_ON_BOOT=1
)Hardware Configuration
n/a
Version
latest master (checkout manually)
IDE Name
any
Operating System
any
Flash frequency
any
PSRAM enabled
yes
Upload speed
any
Description
On the ESP32-S2 (and probably some other cores), if using USB-CDC as the primary serial console,
Serial.printf
text will show up butlog_*
andESP_LOG*
reports will not. This severely hampers debugging as much of the system uses those macros to report important diagnostics.I believe this is why:
esp32_hal_log.h
is included indirectly byArduino.h
ESP_LOG*
is replaced withlog_*
, andlog_*
callslog_printf(...)
log_printf(...)
is defined inesp32_hal_uart.c
; it callslog_printfv
which includes this code:ets_write_char_uart
, which (per its name) writes directly to the UART, even if the console is otherwise configured to use USB-CDC.Sketch
Debug Message
Lots of...
...but I never see
This is a log_e error
orThis is an ESP_LOGE error
, even though these should absolutely show up.Other Steps to Reproduce
This happens for me on an ESP32-S2 board. I am using this FQBN:
esp32:esp32:esp32s2:CDCOnBoot=cdc,UploadMode=cdc,PSRAM=enabled,DebugLevel=debug
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: