The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Device::Jtag::USB::FTCJTAG - Perl extension for communicating with JTAG devices using the FTDI FTCJTAG driver.

SYNOPSIS

  use Device::Jtag::USB::FTCJTAG;
  my $jtag = Device::Jtag::USB::FTCJTAG->new();
  $jtag->write_dev_ir({dev => $devnum, imn => 'user1'});
  $jtag->write_dev_dr({dev => $devnum, vec => Bit::Vector->new_Hex(32, "12345678")});
  my $readvec = $jtag->read_dev_dr({dev => $devnum, nbits => 32});
  

DESCRIPTION

A JTAG device driver for Perl using the FTDI Chip FTCJTAG driver (see http://ftdichip.com/Projects/MPSSE/FTCJTAG.htm). The driver is designed for use with the FTDI Chip FT2232 USB UART/FIFO IC (see http://ftdichip.com/Products/FT2232C.htm). A hardware device is required which incorporates the FT2232 chip in a form that (a) connects to a PC's USB port on one end and (b) connects to the JTAG interface of a target device (or devices). One such device is the Amontec JTAGKey (see http://www.amontec.com/jtagkey.shtml).

EXPORT

None by default.

CONSTRUCTOR

new()

Creates the JTAGUSB object. This routine initializes the JTAGKey and then autodetects the device(s) on the JTAG scan chain. Currently only the following devices are defined, others must be added to the idcode_lookup subroutine manually.

Currently supported devices: XC3S1000_FT256, XC3S1200E_FT256, XCF04S_V020.

The values for the IDCODE and the instruction register commands are defined in the target device's BSDL file. These are typically available for download from the manufacturer's website. For BSDL models from Xilinx, visit "/www.xilinx.com/xlnx/xil_sw_updates_home.jsp#BSDL Models" in http:. A regular expression is used for the device's IDCODE because a given devices IDCODE will vary based upon package type, etc.

METHODS

write_dev_ir({dev => DEVICE_NUM, imn => INSTRUCTION_MNEMONIC, [end => ENDSTATE]})

Writes INSTRUCTION_MNEMONIC to JTAG instruction register of device number DEVICE_NUM of the scan chain, leaving that device in ENDSTATE when done. The INSTRUCTION must be the hash key of one of the instructions defined for DEVICE. If no ENDSTATE is supplied in the function call, a default of RUN_TEST_IDLE is assumed.

write_dev_dr({dev => DEVICE_NUM, vec => BIT::VECTOR_OBJECT, [end => ENDSTATE]})

Writes data contained in Bit::Vector object to JTAG data register of device number DEVICE_NUM of the scan chain, leaving that device in ENDSTATE when done. If no ENDSTATE is supplied in the function call, a default of RUN_TEST_IDLE is assumed. The Bit::Vector object is constructed using one of the Bit::Vector constructor methods, such as Bit::Vector->new_Hex(32, "12345678"). See Bit::Vector documenation for more information. The length of the Bit::Vector must match the size of the register being written in the JTAG target device.

read_dev_dr({dev => DEVICE, nbits => NUMBER_OF_BITS, [end => ENDSTATE]})

Reads NUMBER_OF_BITS bits from JTAG data register from device number DEVICE of the scan chain, leaving that device in ENDSTATE when done. If no ENDSTATE is supplied in the function call, a default of RUN_TEST_IDLE is assumed. The read data is returned as a Bit::Vector object. One can convert the Bit::Vector object to a viewable data value using one of the Bit::Vector conversion methods, such as $vector->to_Hex(). See Bit::Vector documenation for more information.

SEE ALSO

http://ftdichip.com/Projects/MPSSE/FTCJTAG.htm FTDI Chip FTCJTAG driver page.

http://ftdichip.com/Products/FT2232C.htm FTDI Chip FT2232 device page.

http://www.amontec.com/jtagkey.shtml Amontec JTAGKey device page.

http://www.xilinx.com/bvdocs/appnotes/xapp139.pdf Information on JTAG tap controllers.

TO DO

Add auto-assignment of IDCODE value and INSTRUCTION definitions from BSDL files.

HISTORY

  • 0.11 Nov 3, 2008 Added support for Xilinx XC3S400 and XC3S500E devices.

  • 0.10 Aug 20, 2007 Incorporated Bit::Vector module to allow JTAG reads/writes of arbitary length. Modified function calls to take a single hash reference parameter, thus v0.10 is not compatible with previous FTCJTAG.pm versions.

  • 0.06 June 19 2007 Fixed bug with writing to data register of any device not located at scan chain position 1. Added debugging report levels 0-2. Added auto-detection of scan chain devices with auto-assignment of name and instruction register codes.

  • 0.05 May 27 2007 Removed Perl version requirement... trying to achieve success with PPM distribution.

  • 0.04 May 27 2007 Changed to .tar.gz archive type... trying to achieve success with PPM distribution.

  • 0.03 May 25 2007 Fixed prereqs in Makefile.PL... trying to achieve success with PPM distribution.

  • 0.02 May 21 2007 Removed autoloader from FTCJTAG.pm file... trying to achieve success with PPM distribution.

  • 0.01 May 20 2007 Original version.

AUTHOR

Toby Deitrich http://toby.deitrich.net/

COPYRIGHT AND LICENSE

Copyright (C) 2007 by Toby Deitrich

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.