Programming Xilinx CPLD (XC9500XL, XC9536XL) with SVF Player over USB
I recently needed to program a XC9536XL device over USB. I had found the opendous-jtag project and UrJTAG, which together form the solution I need. Note the hardware I am using is specifically implemented on my Bora board.
Using Batch mode for Impact
Impact has a batch mode you can use. To do so you call impact as such:
impact -batch commandlist.cmd
For the commandlist.cmd you require the following entries:
setMode -bscan
setCable -p svf -file outputfile.svf
addDevice -p 1 -file inputfile.jed
erase -p 1
program -p 1
quit
This file does the following (in order):
- Set cabletype to ‘SVF Writer’
- Add the .jed file (or .bit for FPGA)
- Erase the device. It is critical you call this or the programming will fail, probably with odd errors like ‘TDO Mismatch’.
- Program the device.
- Quit
For example on Windows, I made a bat file called ‘jed2svf.bat’. This file has the following contents:
del commandToImpact.cmd
del %1.svf
echo setMode -bscan >> commandToImpact.cmd
echo setCable -p svf -file %1.svf >> commandToImpact.cmd
echo addDevice -p 1 -file %1.jed >> commandToImpact.cmd
echo erase -p 1 >> commandToImpact.cmd
echo program -p 1 >> commandToImpact.cmd
echo quit >> commandToImpact.cmd
impact -batch commandToImpact.cmd
Then you can just call it like this:
jed2svf.bat io_connections
Which converts io_connections.jed to io_connections.svf.
Playing with UrJTAG
I use UrJTAG to program the file. The commands to run are (you can put these in a file and call jtag with that file as an argument):
cable opendous
detect
svf outputfile.svf
quit
Again I made a batch file which calls the whole thing. Note it assumes you have urjtag in a directory called ‘urjtag-windows-dist’ as you can see, since it CDs to that.
del urjtagcmd.txt
echo cable opendous >> urjtagcmd.txt
echo detect >> urjtagcmd.txt
echo svf ../%1.svf progress >> urjtagcmd.txt
echo quit >> urjtagcmd.txt
cd urjtag-windows-dist
jtag.exe ../urjtagcmd.txt
cd ..
Putting it all together:
I make a final batch file which calls all of the above. It looks like this:
call C:\Xilinx\13.2\ISE_DS\settings32.bat
call jed2svf.bat io_connections
call urjtag_svf.bat io_connections
pause
You need to edit the path to your Xilinx tools depending on your install location & version. It again assumes you have a directory called urjtag-windows-dist which has the urjtag binary along with required DLLs in it.