Debugger with FTDI C232

I have a working OpenOCD setup to do JTAG debugging on a ESP32 platform using the FTDI C232HM-DDHSL-0 cable, and I’d like to replicate this setup inside the Platformio debugger. Is there any documentation that would help me do this? I’ve tried reading through the official documentation and even tried “debug_tool = ftdi” as suggested at FTDI Chip — PlatformIO latest documentation, but I’m not having any success.

For reference, this is the OpenOCD config file I’m using for the cable:

#
# FTDI USB Hi-Speed to MPSSE Cable
#
# http://www.ftdichip.com/Products/Cables/USBMPSSE.htm
#
# C232HM-DDHSL-0 and C232HM-EDSL-0 provide 3.3V and 5V on pin 1 (Red),
# respectively.
#

interface ftdi
#ftdi_device_desc "C232HM-DDHSL-0"
#ftdi_device_desc "C232HM-EDHSL-0"
ftdi_vid_pid 0x0403 0x6014

ftdi_layout_init 0x0008 0x000b

It’s very easy to do that with PlatformIO. It seems that we should put this use case to docs:

  1. Create C232HM.cfg in project root, near platformio.ini with the next contents:
#
# FTDI USB Hi-Speed to MPSSE Cable
#
# http://www.ftdichip.com/Products/Cables/USBMPSSE.htm
#
# C232HM-DDHSL-0 and C232HM-EDSL-0 provide 3.3V and 5V on pin 1 (Red),
# respectively.
#

interface ftdi
#ftdi_device_desc "C232HM-DDHSL-0"
#ftdi_device_desc "C232HM-EDHSL-0"
ftdi_vid_pid 0x0403 0x6014

ftdi_layout_init 0x0008 0x000b
  1. Edit platformio.ini and set a custom debug_sever:
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev
monitor_speed= 115200
debug_server =
  $PLATFORMIO_HOME_DIR/packages/tool-openocd-esp32/bin/openocd
  -s
  $PLATFORMIO_HOME_DIR/packages/tool-openocd-esp32/share/openocd/scripts
  -f
  $PROJECT_DIR/C232HM.cfg
  -f
  board/esp-wroom-32.cfg

Does it work?

Thanks! This was pretty simple and it appears to work. Now I need to figure out how to use the debugger because it doesn’t exactly look as I would expect (I’m not seeing a call stack, or disassembly of my code, or memory, etc.) But I can confirm that OpenOCD is running and it shows that my CPU has been halted, so this is progress. :slight_smile: Thanks again.

Could you provide an output from “Debug Console”? Right click in console > Copy All and paste here.

Actually trying to do the same thing here with no success… however I want to use the espidf framework and not Arduino. Is it any difference for the debugger?

There is no realz difference between debugging with ESP-IDF and Arduino. You will need to make the same change to the OpenOCD configuation file esp32_devkitj_v1.cfg. Also see this Medium post (the section Generic FT232H board applies as your cable as the C232HM has a FT232H chip):

https://medium.com/@manuel.bl/low-cost-esp32-in-circuit-debugging-dbbee39e508b

The nice-to-have is to this line platformio.ini (with ESP-IDF you want to stop in main as there is no setup):

debug_init_break = tbreak main

But your previous questions indicates that you have another problem: either GPIO15 pin is already in use by your firmware or it’s not properly connected to the debug probe.

In any case: Post the platformio.ini file and the log output you get. Then chances are higher that we can help you.