Saturday, December 27, 2008

Xilinx JTAG hassle

I'm currently working on a (commercial) XC3S400AN based video processing project.
One doesn't need external flash for the FPGA configuration since the -AN have integrated flash.

The problem is writing that flash. I'm usually using linux for development and xilprg for volatile FPGA configuration via JTAG.

Though xilprg doesn't support the -AN series out of the box it's easy add. Since the programming algorithm is the same for the other Spartan3 devices I only had to add it to the list of known devices for the same treatment as "usual" Spartan3 devices.

Programming the flash isn't that easy to add. Basically it works this way: Load a volatile configuration connecting the SPI-Flash & User JTAG instances which allows accessing the flash via the User1/2 instruction. (I figured that out reading the commands of an svf file)

The flash programming algorithm via User1/2 needs to be added to xilprg.

That's step 2. First I gotta get my Amontec JTAGkey supported. There's no svfplayer for linux yet and the windows svfplayer fails at the flash verify step. One probably has to blame Xilinx for writing an incorrect svffile since reducing the clock doesn't help.

I also tried to use the SVF with the SVN version of Urjtag, but Urjtag didn't work at all. It seems to have problems with the Amontec cable.

But basically, I already got my Amontec working with xilprg. Volatile loading of the 230kbyte bitfile takes about 1 second with my current messy & slightly buggy implementation.
Though loading & starting the bitfile did work it won't detect the hi DONE pin. Gotta fix that and clean up the code, then I'll upload the patches for xilprg.

Also, I'm thinking about adding a Xilinx USB Cable -> Amontec JTAGkey translation layer to the libusb-driver. This translation layer would allow Impact support for the Amontec cable which will then look like an original Xilinx cable to Impact.

Hooked up a Xilinx Spartan3AN develboard, enabled debug for the libusb-driver, hacked a tiny perlscript for analyzing the output and had a closer look at the Xilinx commands. Here's a description for most of the commands. (Sent as the value of ep0 vendor requests)
00 50 init? (idx 258, size 2) R
00 20 bit reverse? (idx 0..255, size 1) R
00 40 init? (idx 0, size 2) R
00 28 init? (idx 17, size 0)
00 30 write GPIO (idx 8, size 0)
00 50 read firmware/CPLD version (idx 0/1, size 2) R
( 52) select GPIO
00 18 output enable (idx 0, size 0) R
XX a6 shift - XX: MSB of idx
send (idx+1)/2 bytes to pipe 2 for shift
read (idx+1)/2 bits from pipe 0x86 afterwards
max. chunksize: 206598 bytes
00 38 read GPIO (idx 0, size 1) R (res. 0x41) - used afterwards too
00 7e - idx: N - used during eeprom write only
00 84 - read afterwards?? used during eeprom write only
00 10 output disable (idx 0, size 0)
The values are in hex. I wasn't able to find a description of the 7e and 84 commands in Urjtag. No idea what they're used for yet. The 7e is used with an index value of 2249. Maybe some kind of "do X TCK cycles" for run test?

So the next steps are
1) fix the DONE/TDO thing
2) clean up & optimize the xilprg code
3) maybe work on the translation layer

No comments:

 
Politiker-Stopp - Diese Seite ist geschützt vor Internet-Ausdruckern.