Arrow USB Programmer Hardware Library for Linux, 64 bit
Version 2.5

This is the readme file for the 64-bit Linux programmer hardware library
for BeMicro boards and other Arrow USB Programmer compatible hardware.

Installation
------------

Be sure you have the right permissions for doing as follows.

(1) Copy the file libjtag_hw_arrow.so to the directory linux64
    of the Quartus installation directory e.g.
    /usr/local/intelFPGA_lite/18.0/quartus/linux64 .

(2) Unbind the the programmer hardware from SIO because the programmer
    hardware library uses FTDI's D2XX driver.

FTDI's application note AN_220 explains why topic 2 is important.

In Linux, the VCP driver and D2XX driver are incompatible with each other.
When a FTDI device is plugged in, the VCP driver must be unloaded before
a D2XX application can be run. Use the remove module (rmmod) command to do this:
sudo rmmod ftdi_sio
sudo rmmod usbserial
When the FTDI device is power cycled or reset the VCP driver will be reloaded.
The rmmod process must be repeated each time this occurs. It is possible to
write a simple script that unloads the VCP driver before running the D2XX application.
End quote.

However, when doing so, all FTDI USB controllers connected to the PC loose their
virtual COM port. One way to cope with that is to use a rules file for the
programmer like this:

1. Create a file named /etc/udev/rules.d/51-arrow_usb_blaster.rules
2. In this file, write the following lines:
===8<-----
# Arrow-USB-Programmer
 SUBSYSTEM=="usb",\
 ENV{DEVTYPE}=="usb_device",\
 ATTR{idVendor}=="0403",\
 ATTR{idProduct}=="6010",\
 MODE="0666",\
 NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}",\
 RUN+="/bin/chmod 0666 %c"
 
# Interface number zero is a JTAG.
 SUBSYSTEM=="usb",\
 ATTRS{idVendor}=="0403",\
 ATTRS{idProduct}=="6010",\
 ATTR{interface}=="Arrow USB Blaster*",\
 ATTR{bInterfaceNumber}=="00",\
 RUN="/bin/sh -c 'echo $kernel > /sys/bus/usb/drivers/ftdi_sio/unbind'"
===8<-----


JTAG TCK Frequency
------------------

The frequency of the JTAG clock TCK can be configured using an additional
configuration file. The programmer hardware library searches the configuration
data using different file names at two different locations.
1. as ".arrow_usb_blaster.conf" in the home directory of the user who has 
   started the JTAG demon. This possibility is intended to set the frequency
   for an individual user or project.
2. as "arrow_usb_blaster.conf" under "/etc" if it was not found in the home
   directory. This is to change the settings globally.
If no configuration file is found the default setting is used which is 20 MHz.

If there is the need to change the JTAG clock frequency, copy the file
"arrow_usb_blaster.conf" and adjust the frequency to your needs.


Miscellaneous
-------------
The programmer shared library uses the FTDI library libftd2xx version 1.4.8
which is staticaly linked.

The programmer shared library for Linux has been developed and tested under
Ubuntu 16.04 LTS. However it should also work with other Linux distributions.

Depending on the system it might be neccessary to run Quartus as root.

-----
Known issues:

(1) During the enumeration process, the FTDI USB controller performs a reset.
Depending on the hardware used, this might remove the power from the FPGA and
therefore might erase the contents of the FPGA.

(2) udev rules has default priority 50 for usb device. You should check if usb 
devices has RW rights with following command: "ls -la /dev/bus/usb/001/*". In 
case of trouble increase priority of your own udev rules file. 
 
