Thursday, October 30, 2008

Number zero

Number zero (N0) is my first attempt to build a robot. This toy tractor is built from LEGO® Technic parts. (back view) The toy is driven by Java ME™ MIDlet on a mobile phone via Bluetooth (JSR82). Small board on the tractor comprise of BlueSMiRF Bluetooth class 1 module and Atmel's ATmega88 controller. Two 71427 LEGO® 9V motors are controlled by TI's SN754410 configured as a dual H-bridge.

Saturday, July 12, 2008

OpenOCD and FT2232's default VID/PID

I spent quite a bit of time today trying to get OpenOCD work with OpenOCD-USB Adapter on MacOSX (10.5). There are two hints which might save your time:

1) Since the adapter comes with no EEPROM, FT2232D uses default VID/PID (0x0403/0x6010). If FTDIUSBSerialDriver (aka VCP) is installed on your machine, you will need to comment out or remove FT2232C_A section of driver's Info.plist file located at

This would prevent the FTDI VCP driver from conflicts with OpenOCD on attempt to use the port A of FT2232D on the adapter board. You also might want to reload the FTDI VCP driver after modification with following commands:

$sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext
kextunload: unload kext /System/Library/Extensions/FTDIUSBSerialDriver.kext succeeded
$sudo kextload -c /System/Library/Extensions/FTDIUSBSerialDriver.kext
kextload: /System/Library/Extensions/FTDIUSBSerialDriver.kext loaded successfully

2) Since the adapter comes with no EEPROM, you will need to use default device descriptor in OpenOCD configuration file:
  ft2232_device_desc "Dual RS232 A"

Missing EEPROM on OpenOCD-USB Adapter board

As it turned out OpenOCD-USB Adapter does not have EEPROM which is on the adapter schematic (see the bottom of this page). The EEPROM chip (93LC46BT SOT-23-6) was removed from the board after manufacturing. It is clearly can be seen on the picture (6 pads on the right of USB connector). I guess, the EEPROM chip was removed because of an error on the adapter PCB (EEPROM's CLK and Vcc pins are swapped). The same adapter is also available form So be aware of this defect.

Friday, July 11, 2008

5V for a target from OpenOCD USB Adapter

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.

UPDATE: OpenOCD version 0.2.0 seems to fix the issue above. I was able to flash and debug code on Olimex STM32-H103 board powered from the JTAG adapter.