Thursday 2 December 2010

XSVF Player on MicroBlaze (JTAG Interface)

This post describes how to implement a JTAG configuration device using C and general purpose input/output (GPIO) on a MicroBlaze based embedded sytem. A Digilent NEXYS-2 board and Xilinx ISE/EDK 10.1.03 are used for this example.

The code is based on Xilinx Application Note XAPP058 and the code provided with it.

An example EDK project can be downloaded here.

The idea is to:
  • run the system provided on a NEXYS-2 board.
  • connect the JTAG port of a another FPGA/ FPGA board to GPIO of the first one.
  • download the configuration file for the devices on the second board in XSVF format to the RAM of the NEXYS-2 board.
  • run the XSVF player on the NEXYS-2 board in order to configure the devices on the second board.
Here are the steps to be taken in a bit more detail:

A. Prepare the configuration file for the device(s) you want to configure:

  1. Create BIT file(s) for the devices you want to configure.
  2. Use Xilinx IMPACT tool to create an XSVF file for the device(s) you want to configure. This works simply by running impact in GUI mode, setting up a project with all devices of the target board in the configuration chain and assigning BIT files.
    The final step is then to go to Output -> XSVF File -> Create XSVF File in order to generate the XSVF configuration file that can be used by the XSVF player.

B. Create the hardware and software for the NEXYS-2 board:
  1. download the example EDK project, unzip it and open it in EDK.
  2. use Device Configuration -> Update Bitstream to create the BIT file for the NEXYS-2 board, which contains the MicroBlaze based hardware system.
  3. go to a console and change into the "code" subfolder within the EDK project folder.
  4. open the "Makefile" in a text editor and adjust the two variables EDK_PROJECT_PATH and EDK_LIB_PATH to point to the EDK project paths where you have unzipped it to on your harddisk.
  5. go back to the console and type Make to build the XSVF Player software application. Note that you now should have an ELF file "xsvf_player.elf" in the "code" folder.

C. Download and run the hardware and software system / configuration files:
  1. connect a Xilinx programming cable to the NEXYS-2 board.
  2. connect a serial cable to the NEXYS-2 and your PC for MicroBlaze OS printfs.
  3. connect the GPIO used for the XSVF Player to the JTAG port of the second board you want to configure.
  4. go to the top-level folder of your EDK project and configure the Spartan FPGA on the NEXYS-2 board:
    impact -batch ./etc/download.cmd
  5. go to the "code" folder containing the compiled ELF file of the XSVF Player.
  6. run the Xilinx Embedded Debugger XMD: xmd and download/ run the ELF file:
  7. connect mb mdm -cable type xilinx_platformusb port usb21
  8. stop
  9. dow -data 0xcbf00000
  10. dow JTAG_SVF_Player_MBlaze/xsvf_player.elf
  11. run
  12. exit
  13. after exiting XMD:
  14. change the serial port specified in the Python script "comm_mblaze.py" to the one where your NEXYS-2 board is attached, save and
  15. run the Python skript, which communicates with the FPGA:
  16. ./comm_mblaze.py
  17. when you are asked for input, type "R" and "Enter". This will then run the XSVF Player that reads the configuration file for the target device(s) from RAM and configure them.

Notes:

  • The JTAG signals are written to a log-file on your computer if you specify the flag -DDEBUG_MODE in the Makefile (see Makefile).
  • In case you do not have a target device attached, which can deliver appropriate TDO signals, you can do a DUMMY run by specifying -DDEBUG_TDO_DONTCARE in the Makefile (see Makefile).
  • In the example above, you can store the XSVF configuration file wherever you want in the RAM, by specifying other addresses within the RAM (see item 9). Make sure to change the address in "defines.h" as well.

No comments:

Post a Comment