papakpmartin
papakpmartin

Reputation: 323

Native USB debugging on ESP32 in PlatformIO without ESP-IDF toolchain?

I have a custom ESP32-S2-based circuit board with USB-C which does not have a USB-serial converter IC like a common dev board might. On this board, USB(-) is on GPIO19, and USB(+) is on GPIO20. USB works great for powering the board and for uploading firmware.

The board works well and I have access to good old-fashioned serial console via a USB-to-logic level serial interface, but it would be nice to be able to get serial out to USB along with the firmware upload (like a dev board).

I’m using PlatformIO in Visual Studio Code, and writing with arduino-esp32 rather than ESP-IDF.

I understand by these instructions from Espressif that when using ESP-IDF I can configure log output to go to USB CDC rather than UART, and this has been done successfully on my custom board. But I would like to be able to do this without having to switch over to ESP-IDF.

I’m presuming that one of the partitions that PlatformIO is building for me is this configuration with some nice common sense defaults, but I can’t see how I might alter those defaults to do what I’m looking for.

Any thoughts or pointers?

Upvotes: 1

Views: 1165

Answers (1)

papakpmartin
papakpmartin

Reputation: 323

Hearing nothing here I asked over on the GitHub project and got an excellent answer. In short, use a custom board config file with...

"extra_flags": [
  "-DARDUINO_USB_CDC_ON_BOOT=1"
 ]

...in it. Go read the answer there, though. It's more complete than that little tidbit.

Upvotes: 2

Related Questions