Espressif ESP32-C6-DevKitM-1 does not have on-board debug probe and IS NOT READY for debugging
However the C6 DevKitM-1 comes with two USB-C ports, one UART and one JTAG, according to Espressif’s manual:
The USB Type-C port on the ESP32-C6 chip […] is used for power supply to the board, for flashing applications to the chip, for communication with the chip using USB protocols, as well as for JTAG debugging.
To me this sounds like I should be able to use that USB port directly to debug the application, however I can’t get the debugger connected. I don’t really know what to use as debug_tool though. I’ve tried esp-bridge and esp-builtin as those sounded most promising, but that didn’t seem to do anything.
I haven’t tried it (I don’t make bugs, so I don’t need a debugger - ya, right - but you should be able to follow the better documented trail for the S2 and S3 variants. There are a number of posts like
…and many more. There are even a few YouTube videos on the topic.
It SHOULD work like S3 and S3, but given the current state of support for the newer Espressif parts, I wouldn’t die of shock if some needed configuration file in platformio itself hasn’t added it to a table of targets to start openocd or whatever.
I don’t have a C6, so I can really only cheerlead.
So I’ve got this working (more or less) by manually pointing to the latest open ocd release. I downloaded the release, copied the package.json from the current version into the new one and then added this entry to the platform.ini:
This works as long as I attach the debugger via “PIO Debug (without uploading)”, otherwise it fails.
Another annoyance with this with the C6 dev kit that I noticed is that the serial output goes through the UART port and the JTAG is on the other port, so you can’t debug and look at the serial output via the same connection. I’ve not yet figured out how to make this nicer other than manually switching the port in VSCode every time depending on what I want to do.
Yay. That sounds right for a new-ish chip like this - you need cutting edge code. Thanks for researching that.
The annoyance of serial debugging being whereever your’e NOT connected is pretty well known on S3/C3 and I’d expect it to be similar on C6. From one of my projects:
custom_c3.ini: -DARDUINO_USB_CDC_ON_BOOT=1 ;; use on-chip serial & debug
There seems to be a lot of folklore/wive’s tales around this flag and its close cousins. It seems the ARDUINO and “real” ESP-IDF flags interact strangely. Brush up on the CDC/ACM flags and don’t be totally shocked if there’s some strange interaction where the ESP-IDF stuff (leaks out|is required by) the Arduino layer. Since the Platformio and Espressif stopped playing nicely with each other before C6 became the hotness, I’d expect bumps in this area.
The pioarduino fork might actually be a happier place for C6 dev.
I know that, some time ago, I had single-cable JTAG/serial console/power running on S3 (without PlatformIO) and while no longer have the notes on that, I’d expect C6 to be vary similar in this regard.
Personally, before I manually switched ports in a build, I’d just add a second cable back until I figured it out. But since I run as little within PlatformIO as I can, I tend to use little script that invoke tio instead of monitor and a different little script to run && upload && debug, having those scripts point to deifferent port names isn’t terrible. I’m all about automating the things I do a hundred times an day. Holding buttons, moving jumpers, etc. drives me crazy.