Some time ago, I have added support to OpenOCD to be able to use Buspirate as JTAG interface.
This how-to will show you, how to setup all the things necessary.

Things you will need:
- Buspirate
- Computer with OpenOCD installed
- target with JTAG
- luck :)

The Buspirate can be bought various sources, like Seeed studio or SparkFun. You will need version v2go or v3. (There is a slight change in the pinout). You will also need to update your BP to v4 bootloader and upload fairly new firmware (v4.2 nightly build).
I will not go through the bootloader updating process, you can find tutorial HERE.
The firmware you want to download is HERE.

You will also need some cable to connect BP to the target. Again that depends on the version of BP you have. For v2go (the one I own) is the pinout HERE. You don’t need to connect the “WHITE” cable at all.

The second part is OpenOCD software. There is a patch for version 0.3.0-rc0, and there is a patch for the development branch in git. The first patch works, but has some bugs that were fixed in the later one. I suggest that you checkout the development branch and apply my patch.
Download the patch attached to THIS post.
Go ahead and clone the git repository and apply the patch you’ve downloaded:
Update: There is no need to patch. The patch is included in the git reprository.

git clone git://

I assume that you have “standard” development kit: gcc, make, autotools, etc. Running the next few commands should produce usable version of OpenOCD

./configure --enable-buspirate --enable-maintainer-mode
sudo make install

You need to enable maintainer mode, or else it will fail while making documentation. You can also add more interfaces, if you own more.

Next step is creating the correct configuration file. The confiuration file contains interface specification and target specification.
The interface is buspirate, of course. If defaults are Ok, you can just use

source [find interface/buspirate.cfg]

More advance way is to copy the content of the buspirate.cfg file and change it to needs.

interface buspirate
buspirate_port /dev/ttyUSB0
buspirate_speed normal # or fast
#buspirate_vreg 0 # or 1
#buspirate_mode normal # or open-drain
#buspirate_pullup 0 # or 1

These commands should be self explanatory. Fast speed mode switches the UART speed to 1Mbit upon connecting to BP, some BP revisions might not work, if this happens please report!
Next you need to add your target configuration. I use STM32 cpu.

source [find target/stm32.cfg]

This tells OpenOCD what TAPs are on the JTAG chain, and OpenOCD scans if the IDs match.
After you are done with the configuration file, save it, and run openocd in the same directory. If there is no fatal error, OpenOCD listens on 4444 port. Use telnet to connect to it, you will get simple console to send commands to OpenOCD.

About these ads