ESP32 Debugging with ESP-Prog not working on Mac

Hi,

I have a Feather ESP32 with a ESP-Prog and I’m trying to get the debugger to work. I’ve installed the FTDI drivers and I can see two usb drivers in the /dev directory. When I launch the debugger, I get the following error

PlatformIO Unified Debugger -> http://bit.ly/pio-debug

PlatformIO: debug_tool = esp-prog

PlatformIO: Initializing remote target...

Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)

Licensed under GNU GPL v2

For bug reports, read

http://openocd.org/doc/doxygen/bugs.html

none separate

adapter speed: 20000 kHz

Info : Configured 2 cores

esp32 interrupt mask on

Info : tcl server disabled

Info : telnet server disabled

Error: libusb_claim_interface() failed with LIBUSB_ERROR_ACCESS

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

Warn : Flash driver of esp32.flash does not support free_driver_priv()

Warn : Flash driver of irom does not support free_driver_priv()

Warn : Flash driver of drom does not support free_driver_priv()

.pioinit:11: Error in sourced command file:

Remote connection closed

Can anyone help diagnose what I’m doing wrong, I’m sort of at a loss now having tried everything I could.

Thanks
Michael

There’s no need to install any drivers. In fact, they are most likely the problem as they will turn your Esp-Prog into a dumb USB-to-serial adapter and prevent PlatformIO / OpenOCD from communicating with the adapter.

So try to unload the drivers:

sudo kextunload /Library/Extensions/FTDIUSBSerialDriver.kext

This is valid until the next reboot and needs to be repeated after that.

Also see:

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

1 Like

I tried unloading the drivers and it didn’t work, so I removed the drivers by deleting the
/Library/Extensions/FTDIUSBSerialDriver.kext directory and rebooted and I get the same error. If I look at the /dev directory, I see the following devices

crw-rw-rw- 1 root wheel 20, 15 Sep 6 00:14 /dev/cu.SLAB_USBtoUART
crw-rw-rw- 1 root wheel 20, 11 Sep 6 00:13 /dev/cu.usbserial-1433200
crw-rw-rw- 1 root wheel 20, 13 Sep 6 00:13 /dev/cu.usbserial-1433201

and in System report, it shows

Dual RS232-HS:

  Product ID:	0x6010
  Vendor ID:	0x0403  (Future Technology Devices International Limited)
  Version:	7.00
  Speed:	Up to 480 Mb/sec
  Manufacturer:	FTDI
  Location ID:	0x14332000 / 3
  Current Available (mA):	500
  Current Required (mA):	500
  Extra Operating Current (mA):	0

But the driver isn’t loaded as it’s been removed. Is there anything else to try?

Thanks
Michael

I was able to unload the AppleFTDI drivers so there are no devices in the /dev directory and now when I try and debug I get the following error

Info : Configured 2 cores

esp32 interrupt mask on

Info : tcl server disabled

Info : telnet server disabled

Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"

Info : clock speed 20000 kHz

Error: JTAG scan chain interrogation failed: all ones

Error: Check JTAG interface, timings, target power, etc.

Error: Trying to use configured scan chain anyway...

Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01

Warn : Bypassing JTAG setup events due to errors

Info : accepting 'gdb' connection from pipe

Error: No symbols for FreeRTOS

Error: Target not examined yet

Error: Target not halted

Error: auto_probe failed

Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.

Error: attempted 'gdb' connection rejected

Ignoring packet error, continuing...

warning: unrecognized item "timeout" in "qSupported" response

I’m not sure if this is getting closer to making it work?

Thanks
Michael

You definitely have made progress. OpenOCD is now able to talk to ESP-Prog.

The problem now is that ESP-Prog is not able to talk to the ESP32. JTAG scan chain interrogation failed: all ones is a clear indication. So check the wiring between ESP-Prog and ESP32 board. Make sure you haven’t accidentially switched two wires and that they all make good contact. And use short cables (max 30cm).

If it doesn’t help it’s possible to lower the adatper speed. But I don’t have the preise instructions ready.

I tried adding

ftdi_tdo_sample_edge falling to esp32_devkitj_v1.cfg and that made no change

I don’t think ftdi_tdo_sample_edge is helpful. I’ve never used it when debugging an ESP32.

Try to lower the speed by modifying the file /Users/user/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/board/esp-wroom-32.cfg:

adapter_khz 10000

Which pins did you connect?

  • GPIO12 — TDI
  • GPIO13 — TCK
  • GPIO14 — TMS
  • GPIO15 — TDO
  • GND — GND

Anything else like Vcc or RST?

Does your software use any of these pins? Do you use the red LED connected to GPIO13? If so, change the software.

See instruction for macOS here ESP-Prog — PlatformIO latest documentation

hi, i am running in similar issue, i can see ports

crw-rw-rw- 1 root wheel 9, 11 Jul 10 00:24 /dev/cu.usbserial-401100
crw-rw-rw- 1 root wheel 9, 13 Jul 10 00:24 /dev/cu.usbserial-401101

but when i run upload using PIO i get following error

esp32 interrupt mask on
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway…
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway…
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors

i am not sure how i diagnose it further. I double check wire connections. i have nodmcu32 borad and i connected power from esp-prog to 3v3 pin on the nodemcu

Please read the other threads first on common errors.

It pretty much always comes down to these issues:

  • wrong target chip / board = .. selected in the platformio.ini
  • incorrect wiring between adapter and target board
  • target power supply unstable
  • using a breadboard (bad signal integrity)
  • JTAG speed too high / cables too bad or long
  • wrong flash voltage (1.8V vs 3.3V) selected

Open a new thread with your specific board and debugger setup if none of those helped.

2 Likes