Esp32 debugging with onboard cp210

Hello,

I can upload my code to the esp board but when I try to debug the code, openocd within platformio tries to use a ftdi driver. How can I change this to the cp210 please?

Is a USB-UART bridge, not a JTAG debugger probe. What you want to do is impossible with that hardware. You need a supported JTAG debugger. See Espressif 32 — PlatformIO latest documentation.

2 Likes

Thank you, I did not Know that :slight_smile:

I have hooked up a ft232H now and connected this to the wroom board.

This message appears:

‘Error: unable to open ftdi device with vid 0403, pid 6010, description ‘’, serial '’ at bus location ‘*’’

How can I change the vid and pid please?

Found out thanks to thread here:

  1. Open with text editor or your IDE like Visua Studio: C:\Users\YOURUSERNAME.platformio\packages\tool-openocd-esp32\share\openocd\scripts\interface\ftdi

  2. replace VID and PID. the line with “before” is the original PID and VID

Driver for the FT2232H JTAG chip on the Espressif DevkitJ board

interface ftdi

#before ftdi_vid_pid 0x0403 0x6010

ftdi_vid_pid 0x0403 0x6014

interface 1 is the uart

ftdi_channel 0

just TCK TDI TDO TMS, no reset

ftdi_layout_init 0x0008 0x000b

reset_config none

Hello guys, I would debug thought CP210X, I did that with nanoFramework when I was testing it. It worked.
So why that’s not possible with platformIO?
Esp32DevKitV1 USB VID:PID=10C4:EA60

Thanks

1 Like

What? You say you have JTAG debugging through the CP210X? Could you prove to me that “it worked” please with a photo of your hardware setup and an openocd log?

Are you sure you are talking about actuall JTAG debugging, because nanoFramework also tells you to get a JTAG debugger to be able to do that

http://docs.nanoframework.net/articles/getting-started-guides/build-esp32.html#debugging-nanoclr

You can upload a new firmware through the CP210X and do printf()-style debug, but not actual JTAG style debugging (yes hacks exists for the esp8266 but I presume this is not what you’re talking about).

1 Like

Honestly, it’s my first approach to this, I don’t want to sound grumpy. As a first attempt, I used nanoFramework to program the ESP32 with C#, but then I found PlatformIO and I’m trying it.
But it was possible to debug (and I did with visual studio) without external hardware, only the esp32devkitv1 and a USB cable. I do not know anything else.

o_O Which documentation did you follow to get to this project and debugging setup? If it really is debugging the chip the way I see it, it might very well actually use a UART GDB server on the ESP32.

No documentation, no configuration. They told me about it on Discord: .NET nanoFramework
Support > #esp32: 05/08/2019

Interesting… they sneakily differentiate between being able to debug the application, and actual debugging of the firmware - firmware debugging requiring JTAG, but application debugging only requiring serial. It looks like they have their own debugger library here… so yeah, everything about about nanoframework smells of custom implementation… meaning it’s probably not happening without that platform being supported by platformio (if that happens). Since the platform seems to be specifically targeted at C# Visual Studio users… I won’t be holding my breath…

As I have confirmed in the discord

It really is a special case of an IL (intermediate langauge) interpreter running on the ESP32 interactiving via serial with the visual studio debugger. So you can only debug managed (that is, the IL generated from the C#) by it but not the actual IL interpreter or the native libraries itself, which is written in C/C++. So as @pfeerick already said, this is a custom implementation and not a general implementation of a GDB stub via serial.

2 Likes

just for completeness…

FT2232 has two “channels”, each can be used as UART (with the regular driver) or for bit banging. the bit banging allows it to “perform” JTAG.

OpenOCD can use FT2232 for proper JTAG debugging. On Windows, that requires the user to manually (e.g. with Zadig) set the driver for the JTAG “channel” from the FTDI default to WinUSB. Then OpenOCD can talk to it properly.

I do not know if CP210x could be made to do the same.

It’s just a USB-UART bridge.

Not just. GPIOs can be read and set.