pi3j The Raspberry Pi JTAG programmer
This is a Linux program for the Raspberry Pi that allows one to program a Digilent.inc Digilab 2 FPGA board via the parport with JTAG.
Source code is released under the GPL.
The Digilent.inc Digilab 2 has on it a Xilinx Spartan 2, and it can be programmed via JTAG or via a Xilinx parallel port cable from a PC.
As I do not always have a PC with a parport around (even bought a PCI parport card a while ago for one),
and still want to use this board, but then with a laptop,
and do not think the control lines in USB to serial adaptors are that much supported (not sure),
I decided to use the ethernet port of the laptop, connect a Raspberry Pi, ssh -Y to it,
and use its GPIO port to drive the parport on the Digilab 2, while doing the webpack stuff on a more powerful PC.
Of course you can also drive any JTAG chip directly, just write the soft :-)
This software is based on previous work by Rudolf Usselmann and Reinoud Lamberts,
in the past I changed it for direct I/O in Linux,
and now made a new version for the Raspberry Pi that uses the GPIO I/O pins.
The program takes a Xilinx bitfile (from webpack in my case) as input, use it like this
It works, that is all I can say about it.
pi3j in action:
Pi_breakout board close up:
Full source in C, compile it on the Raspberry Pi (NOT on the PC, the Raspberry has an ARM processor!) with:
gcc -o pi3j pi3j-0.2.c
cp pi3j /usr/local/bin/
Par port cable connections and signals as I used in this software version, and the Raspberry Pi version is board revision 2:
|signal||Pi P1 header||Pi GPIO||direction||parport signal||parport pin|
Used a little breakout board for testing, need to make a nice new cable sometime.
root@raspberrypi:~/compile/pantel/pi3j# ./pi3j frequency_counter.bit
Design Name: p1.ncd
Date: 2007/ 9/26
Bitstream Length: 1335840 bits
Device ID: 8061c093
Manuf: 49, Part Size: 1c, Family Code: 3, Revision: 8
Programming ... *****
Programmed 1335840 bits
Scripting it all
A simple way to send .bit files from a laptop could be like this:
On the Raspberry Pi put the folling in /usr/local/sbin/jtag_programmer
echo "listening for connections on port 1234"
while [ 1 ]; do netcat -l 1234 | pi3j /dev/stdin; done
echo "user abort"
Make it executable with:
chmod +x /usr/local/sbin/jtag_programmer
On the laptop put the following in /usr/local/sbin/prog_jtag
if [ "$1" == "" ]
echo "Usage: prog_jtag file.bit"
echo "Programming device."
cat $1 | netcat -c $IP_OF_RASPBERRY_PI 1234
Change the 192.168.178.70 for the IP address of your Raspberry Pi
Make the file executable by typing:
chmod +x /usr/local/sbin/prog_jtag
Now to use it all (use your Raspberry Pi's IP address):
ssh -Y email@example.com
login with pasword
Change to root account
sudo su -
The Raspberri Pi is now a jtag programmer, always listening on TCP port 1234 for bitfiles (a ctrl C, or a power down on it will stop this script).
Now on the laptop, to program a bit file, in an other xterm, simply type:
This example gives no feedback if the file actually arrived or programmed correctly,
but if you leave the ssh link open then you will see DONE=1 if OK, and DONE=0 if not OK.
This is just a simple example using netcat to automate things, it may need some more work.
return to main page