Debugging non-funct [OSX | VSC | ESP32 | Minimodule/FT2232H]

Hey. I am new to VSC and PIO, but getting used to them quickly and loving it.
PIO has worked fine for me so far, now I got a FT2232H board to start hardware debugging.
This is the board: GitHub - arm8686/FT2232HL-Board: USB to dual UART / SPI / I2C / JTAG / FIFO / Bit-Bang... - well built, has a case and all pins are broken out.

It was possible to upload a compile after some trial + error (turns out that only worked when I power-cycled the ESP32 and not just put it in BOOT mode via RST → GPIO01).
Trying to debug yields an Error how the board named “minimodule” is not found.

Turns out my FT2232H has a different name, so I changed that via FPROG.exe and also tried to get as close as possible to FTDI’s config of the minimodule as possible (most stuff is in the datasheet).

But still the real debugging-phase never starts…
I get the “progress-beam/line” in the debugging tab, I get the little hovering debugger palette (only active button is STOP tho), the debugging tab is empty, that’s it.
No timeout seems to happen, OSX Console only spits out this about 6 to 9 times, but it does that also when I open up any file, so I guess it is unrelated:
08.12.18 13:03:13,000 kernel[0]: CODE SIGNING: cs_invalid_page(0x108a82000): p=4206[python] final status 0x0, allowing (remove VALID) page

I did deinstall OSX’s stock FTDI drivers btw.
The board I use it a mhetesp32minikit with no further attached hardware.

Things that might help me:
#1 - an EEP dump from a genuine minimodule so I can set mine up 100% correctly (serial number doesn’t matter, just make it 123 in the .XML)
#2 - cables are double-checked, but do I need to connect the ESP32’s RST pin? I read somewhere that it is not needed, the official help page lists it as “to be connected”
#3 - is there some sort of extended logging I can activate for the connection process?

Currently it’s really messy, I get this on upload:
Error: libusb_claim_interface() failed with LIBUSB_ERROR_ACCESS Error: unable to open ftdi device with vid 0403, pid 6010, description 'FT2232H MiniModule', serial '*' at bus location '*' ** OpenOCD init failed ** shutdown command invoked

But a ls /dev/cu.* in bash returns the expected ports: /dev/cu.usbserial-13303DRXA and /dev/cu.usbserial-13303DRXB

ioreg -p IOUSB -w0 -l returns this info:

FT2232H MiniModule@fd120000 <class IOUSBDevice, id 0x100000c93, registered, matched, active, busy 0 (213 ms), retain 10>
{
“sessionID” = 9793361451502
“idProduct” = 24592
“bNumConfigurations” = 1
“iManufacturer” = 1
“bcdDevice” = 1792
“Bus Power Available” = 250
“bMaxPacketSize0” = 64
“USB Product Name” = “FT2232H MiniModule”
“iProduct” = 2
“iSerialNumber” = 3
“bDeviceClass” = 0
“IOUserClientClass” = “IOUSBDeviceUserClientV2”
“bDeviceSubClass” = 0
“USB Address” = 4
“bcdUSB” = 512
“locationID” = 18446744073660399616
“PortNum” = 2
“IOCFPlugInTypes” = {“9dc7b780-9ec0-11d4-a54f-000a27052861”=“IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle”}
“bDeviceProtocol” = 0
“USB Vendor Name” = “FTDI”
“Device Speed” = 2
“idVendor” = 1027
“USB Serial Number” = “13303DRX”
“Requested Power” = 250
“IOGeneralInterest” = “IOCommand is not serializable”
“Low Power Displayed” = No
}

my platformio.ini for the hello world example I made:

[env:mhetesp32minikit]
platform = espressif32
board = mhetesp32minikit
framework = arduino

monitor_speed = 2000000
monitor_port = /dev/cu.SLAB_USBtoUART

upload_port = /dev/cu.usbserial-13303DRXB
upload_protocol = minimodule

debug_port = /dev/cu.usbserial-13303DRXB
debug_tool = minimodule

So I made it work after some hassle…
This is my platformio.ini:

[env:mhetesp32minikit]
platform = espressif32
board = mhetesp32minikit
framework = arduino

# UPLOAD via SERIAL pins on board #
# upload_port = /dev/cu.SLAB_USBtoUART
# monitor_protocol = esptool
upload_speed = 921600

# UPLOAD via JTAG pins #
; /dev/cu.usbserial-FT2D6SDLAA is my FT2232H port_A - connected to the ESP32 JTAG pins
; change to your device name if needed [in OSX list them with ls /dev/{tty,cu}.* ]
upload_port = /dev/cu.usbserial-FT2D6SDLAA
upload_protocol = minimodule

# SERIAL MONTITOR #
; uncomment what you use.
; /dev/cu.SLAB_USBtoUART is the MH-ET-Mini onboard USB-UART
; /dev/cu.usbserial-FT2D6SDLAB is the name of my FT2232H port_B [ESP32 TX_pin &lt;-&gt; FT2232H BDBUS_0 | ESP32 RX_pin &lt;-&gt; FT2232H BDBUS_1]
; UART @ 2.000.000 baud seems exessive, but works fine for me on all ESP boards and the FT2232H
; monitor_port = /dev/cu.SLAB_USBtoUART
monitor_port = /dev/cu.usbserial-FT2D6SDLAB
monitor_speed = 2000000

# DEBUG SETTINGS #
# SUPER IMPORTANT: keep the [env:debug] on top of those settings!] #
[env:debug]
platform = espressif32
board = mhetesp32minikit
framework = arduino
; upload_port = /dev/cu.usbserial-FT2D6SDLAA
upload_protocol = minimodule
; debug_port = /dev/cu.usbserial-FT2D6SDLAA
debug_tool = minimodule

Following this guide https://www.instructables.com/id/ESP32-Cheap-Solution-for-in-Circruit-Debug/ I changed openOCD myminimodule config /Users/username/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/interface/minimodule.cfg to this [original values commented out]:

interface ftdi
# ftdi_device_desc "FT2232H MiniModule"
ftdi_vid_pid 0x0403 0x6010
# ftdi_layout_init 0x0018 0x05fb
ftdi_layout_init 0x0008 0x000b
ftdi_layout_signal nSRST -data 0x0020
ftdi_tdo_sample_edge falling

Another important part:
You need to both unload FTDI’s and APPLE’s drivers that hog the ports:

sudo kextunload -bundle-id com.apple.driver.AppleUSBFTDI
sudo kextunload -bundle-id com.FTDI.driver.FTDIUSBSerialDriver

Otherwise you will get some USBlib errors that your port is n/a.

The FTDI drivers can be deinstalled:

See detailed instruction in official application note (Page 16, Section 4: Uninstalling FTDI Drivers on OS X) AN134: FTDI Drivers Installation guide for MAC OS X

1 Like