Bus Pirate JTAG XSVF player

From DP

Jump to: navigation , search




XSVF is a set of instructions that tell a programmer how to wiggle pins in such a manner as to enter the firmware into a JTAG devices such as FPGAs and CPLDs.

The XSVF player is a bonus firmware for the Bus Pirate that 'plays' XSVF files to program JTAG devices. We also whipped up a PC utility that sends XSVF files to the Bus Pirate.

Load the alternate firmware using your normal firmware update procedure.


SVF (no X) is a common programming format used in manufacturing. It's a human-readable list of JTAG instructions that program a chip. The programmer doesn't actually know anything about the target device, the SVF file just tells it what JTAG instructions to execute and the reply to expect.

SVF is used with many devices, but is most commonly used with FPGAs, CPLDs, and other programmable logic. The compilers for many different chips can output a SVF file.


XSVF is a compressed version of SVF that works better with small devices (like the Bus Pirate). An SVF to XSVF converter is included in the XSVF player download.


You'll need:

Other resources:

Replace firmware

The XSVF player firmware is big and doesn't fit in the normal Bus Pirate release. Instead, we made a separate firmware that works with the small application included in the download. It doesn't have a user terminal, it only contains the XSVF player.

Use your favorite USB firmware update method to load the BPv3.XSVFplayer.vx.hex firmware file into your Bus Pirate with the bootloader.

When you're done using the Bus Pirate as an XSVF player, just load the latest BusPirate.firmware.vx.x firmware to get the normal Bus Pirate stuff back.


  • Bus: JTAG (Joint Test Action Group)
  • Connections: 4 connections (TDI, TCK, TDO, TMS) and ground
  • Output type: 3.3volt normal pin output
  • Maximum voltage: 5.5volts (5volt safe)
  • Power supplies: active at all times in this firmware
Bus PirateDir. JTAG Description
MOSI TDI Master Out, Slave In
MISO TDO Master In, Slave Out
CS TMS Chip Select
CLK TCK Clock signal
GND GND Signal Ground

Connect the Bus Pirate to the JTAG device as shown in the table. Don't forget to either power Vio or to set the Vio jumper on the board.

The Bus Pirate's power supplies are active, you can use them to power the JTAG device (150mA max).

There are two ways to power the CPLD development boards from the Bus Pirate:

  1. The easiest is to connect the Bus Pirate 3.3volt power supply pin to the to the 3.3volt pin of the JTAG header on the CPLD board (but this might be dangerous to the voltage regulator on the CPLD board)
  2. Alternately, connect the Bus Pirate 5volt power supply pin to the V+ pin of the breakout header on the side of the CPLD board

The XSVF player supports the minimum 4-wire JTAG connection. It does not support any of the reset signals used in many ARM processors. It is based on source code provided by FPGA manufacturer Xilinx and is intended primarily for use with FPGAs and CPLD.



E:\>BPXSVFPLAYER -p com5 -f c:\svf\xc2cprog.xsvf
File is 22846 bytes, read 22846 bytes
Opening Bus Pirate on com5 at 115200bps
Using XSVF file c:\svf\xc2cprog.xsvf
Entering XSVF Player Mode
Waiting for first data request...ok
Sending 4096 Bytes (1000)...ok
Sending 4096 Bytes (2000)...ok
Sending 4096 Bytes (3000)...ok
Sending 4096 Bytes (4000)...ok
Sending 4096 Bytes (5000)...ok
Sending 2366 Bytes (593E)...ok
End of operation reply 00
Thank you for Playing! :-)

Example XSVF programming session.

The programming app sends the XSVF file to the Bus Pirate in chunks, then waits for the programmer to ask for more data. At the end, the programmer replies with a success or error code.

BPXSVFPLAYER -p com5 -f c:\svf\xc2cprog.xsvf

Run the application with the Bus Pirate serial port (-p COM5) and XSVF file (-f) specified.

The application can also perform JTAG chain operations. A chain scan lists the IDs of all the devices in the chain. A reset is internal and applies only to the JTAG state machine.


  • -p the Bus Pirate serial port
  • -f location of the XSVF file to program
  • -x (optional) Perform a JTAG Chain Scan
  • -r (Optional) Perform a JTAG Reset

XSVF firmware protocol

  • 0x01 - JTAG RESET
  • 0x02 - JTAG chain scan
  • 0x03 - XSVF player


Resets the connected JTAG devices.

  1. Send 0x01
  2. Wait a little

Chain scan

Chain scan is a JTAG device detection method.

  1. Send 0x02 to perform a chain scan
  2. Wait for 1 byte, the number of bytes that will be returned
  3. Get that many bytes

Currently the firmware is hard-coded to use 4 byte JTAG IDs, so the IDs will be at 4 byte boundaries.

XSVF player

This mode plays XSVF formatted JTAG programming files, usually for programming FPGAs and CPLDs.

  1. Open the port and send 0x03 to enter XSVF player mode
  2. Wait for 0xFF, if <0xFF then it is finished or error codes (see below)
  3. Send 1 byte: the byte count of XSVF data you will send next (up to 255 bytes)
  4. Send up to 255 bytes of XSVF data
  5. Repeat from 2 until the return value is less than 0xff
XSVF packet format
byte count XSVF byte 1 XSVF byte 2
0x02 data1data2

Result codes