# Can't get Flyswatter2 probe to work with OpenOCD

I've got a Flyswatter2 flash/debug probe from the company Tin Can Tools (see https://www.tincantools.com/product/flyswatter2). Unfortunately, I can't get it to work with OpenOCD. Below is a detailed description of the steps I've taken.

## 1. Flyswatter2 Installation

To install the probe, I read the following on their website:

For Linux, the RS232 driver for the FT2232 is part of the main kernel tree and is provided in most standard Linux distributions. In Windows, you have to load the Windows driver for the FT2232. Once the driver is loaded, Windows will assign a virtual COM port to the Flyswatter’s serial port. It operates just like a standard COM port.

I'm working on Windows 10. The COM-port for the FT2232 chip (the one in the Flyswatter) was immediately visible when I plugged in the Flyswatter:

So I believe there's no need to download a driver. Basically, there's no installation needed on Windows 10.

## 2. Connection to target chip

I connect the Flyswatter2 probe to an STM32F767ZI target-chip on a self-made board:

My board has a 10-pin Cortex Debug Connector, so I use an adapter to connect it to the traditional 20-pin ARM connector on the Flyswatter. I got the adapter board from 1BitSquared (see https://1bitsquared.de/products/20pin-jtag-adapter or https://1bitsquared.com/collections/supporting-hardware/products/20pin-jtag-adapter):

So now I'm ready to start flashing/debugging.

## 3. Launch OpenOCD

I've got a quite recent version of OpenOCD, compiled in July 2019 (see https://www.playembedded.org/blog/building-openocd-under-windows-using-msys2/ for instructions on how to compile OpenOCD for Windows):

Open On-Chip Debugger 0.10.0+dev-00921-gef8c69ff9 (2019-07-06-01:00)

I launch OpenOCD this way in my Windows 10 console:

openocd -f probe_flyswatter_v2.cfg
-f chip_stm32f767zi.cfg
-s "C:/.../scripts"
-c "init; reset halt"


Note: this command is of course on a single line in my console, but I split it here over several lines for readability.

Let's go over the parameters one-by-one:

-f probe_flyswatter_v2.cfg
I pass this config file probe_flyswatter_v2.cfg to OpenOCD. It's a simple file I've made myself. It contains two lines:

source [find interface/ftdi/flyswatter2.cfg]
transport select swd


-f chip_stm32f767zi.cfg
I also pass this config file chip_stm32f767zi.cfg to OpenOCD. It's also a simple file with only two lines:

source [find target/stm32f7x.cfg]
reset_config srst_only


-s "C:/.../scripts"
I give OpenOCD the full path to the scripts folder in my OpenOCD installation. It's a long path, so I didn't fill it in completely here (hence the three dots).

-c "init; reset halt"
I give two commands to OpenOCD, namely init and reset halt, that must be executed immediately when OpenOCD acquires connection to the probe and target chip.

## 4. OpenOCD crash

After entering the command (see above) in my console, I get the following output:

Open On-Chip Debugger 0.10.0+dev-00921-gef8c69ff9 (2019-07-06-01:00)
http://openocd.org/doc/doxygen/bugs.html
Info : FTDI SWD mode enabled
swd
srst_only separate srst_nogate srst_open_drain connect_deassert_srst

Error: libusb_open() failed with LIBUSB_ERROR_NOT_FOUND
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description 'Flyswatter2', serial '*' at bus location '*'


Something seems wrong with the connection to the ftdi chip inside the Flyswatter2. That's weird, because I do see the Flyswatter as a virtual COM port in my device manager.

What should I do?

## 5. Notes

Note 1: For those wondering what my goal is: I'm in a team, working on a new IDE for microcontrollers (see https://embeetle.com). We want to support as many probes as possible.

Note 2: The problem is not related to my self-made board. I managed to flash/debug the target chip on that board with other probes, like the STLinkV2, Black Magic Probe, SWDAP, ...

Note 3: Thank you @ChrisStratton to provide me the link to the Tin Can Tools webpage about libusb: https://ldevices.com/libusb-device-filter/
However, the webpage states:

This guide assumes that you already have libusb-win32 installed on Windows, and that you have the libusb-win32 binary version 1.2.2.0 in a folder called libusb-win32-bin-1.2.2.0. If not, see Compiling Openocd for information on installing libusb.

The only webpage I find on Tin Can Tools about "Compiling Openocd" for Windows is this one:
https://ldevices.com/compiling-openocd-for-windows-7-using-ftd2xx-pre-june-2011-2/
However, this webpage states that it's out of date:

This guide is out of date. Because of the recent addition of a cross-compiler to Cygwin, these instructions apply only to a user with Cygwin already installed, and last updated before June 2, 2011. An up-to-date guide will be available soon. For an up-to-date guide to an alternative libFTDI build, see Compiling OpenOCD for Windows 7 (LibFTDI).

Clicking on the link brings me to: https://www.tincantools.com/wiki/Compiling_OpenOCD_for_Windows_7_(LibFTDI

But that link gives a 404 error. In other words: the Tin Can Tools documentation that should help me to fix this problem is broken...

• First you are going to have to figure out if openocd should be interacting with this device as a serial port or as a USB device. Much as with your previous questions of this type, this is something you should pursue with the manufacturer of the probe. Once again you seem to be taking wild guesses rather than following documentation. – Chris Stratton Nov 21 '19 at 20:45
• Hi @ChrisStratton, in fact I called the manufacturer Tin Can Tools today, and told them I'd send a mail with the question. I then wrote this question here on StackOverflow and sent them the link to it. – K.Mulier Nov 21 '19 at 22:04
• I'm not "taking wild guesses". The documentation on the Flyswatter2 probe is simply not complete. I checked it first before writing my question down here. – K.Mulier Nov 21 '19 at 22:07
• See this page linked form the overall directions ldevices.com/libusb-device-filter – Chris Stratton Nov 21 '19 at 22:44
• The error message makes it clear that your openocd was built with libusb. What you need, as that link explains, is to set up libusb for your device. – Chris Stratton Nov 22 '19 at 17:48