
I recently bought
OpenOCD USB Adapter. The adapter arrived as a kit which comprises of the assembled adapter board, two IDC male connectors (ten and twenty pins) and one D-type 9 pin male connector.
One feature which is missing in this adapter from my point of view is an option to power up a target from USB. A USB port can provide up to 500 mA. The adapter should not consume more then 250 mA according to
FT2232D datasheet. This would leave approximately 250 mA for a target board. For example,
Olimex LPC2103 prototype header board would consume about a hundred mA.
Fortunately, there is a place on the adapter board for four pin header right behind D-type serial connector. Two pins in the center are serial's TTL TX and RX and pins on both sides are Ground and +5V straight from USB's Vbus. (Note, there is no ferrite bead on the adapter board.) I assembled
a little board with MOSFET (
FDN302P) to control power output. I used schematic of "Bus Powered Circuit with Power Control" (Figure 12) from FT2232D datasheet. The most challenging for me was to solder a wire to PWREN# pin (41) of FT2232D. The chip comes in the LQFP-48 package with leads on a 0.5mm pitch. Finally, since I do not need standard serial interface and only two pins in the second row of the serial connector are utilized, I decided to put a two pin polarized header in the first row to serve as a power connector for a target.
Well... As it turned out when OpenOCD (
see update below about version 0.2.0) initializes interface FT2232 pulls PWREN# pin to high level for several hundred mS. This switches power off for the target. Meanwhile, OpenOCD attempts to communicate to the powered off target. I had to add a one second delay in
openocd.c between
jtag_interface_init and
jtag_init calls to make the modification work.