You are not logged in.

#1 2011-12-24 03:55:40

UQ-igor
Member
Registered: 2009-03-05
Posts: 42

UDEV rules for Xilinx FPGA devices

I recently purchased a Digilent Nexys3 FPGA board with a Xilinx Spartan 5 FPGA on it. I finally got around to finding some time to using it, and setting up the development environment under Arch linux.

After spending ages reading around about various problems and workarounds, I finally managed to get Xilinx ISE Webpack installed and working, as well as Digilent Adept software for downloading the designs to the development board. One issue still remains though. I am unable to download the designs to the FPGA as a normal user, but only as root.

I'm pretty sure this is a udev rules problem. Digilent supplies a rules file (attached below) which is supposed to grant permissions to all users to access the FPGA devices over USB. I placed this rule file under /etc/udev/rules.d, but I am still unable to access the devices as normal user due to the following error:

$ djtgcfg enum
libusb couldn't open USB device /dev/bus/usb/001/003: Permission Denied.
libusb requires write access to USB device nodes.
$

I believe that udev rules syntax changed since the last time I had a look at it, so maybe the supplied rules file still uses the old syntax? Any suggestions to fixing this rules file (attached below)?

###########################################################################
#                                                                         #
#  52-digilent-usb.rules -- UDEV rules for Digilent USB Devices           #
#                                                                         #
###########################################################################
#  Author: MTA                                                            #
#  Copyright 2010 Digilent Inc.                                           #
###########################################################################
#  File Description:                                                      #
#                                                                         #
#  This file contains the rules used by UDEV when creating entries for    #
#  Digilent USB devices. In order for Digilent's shared libraries and     #
#  applications to access these devices without root privalages it is     #
#  necessary for UDEV to create entries for which all users have read     #
#  and write permission.                                                  #
#                                                                         #
#  Usage:                                                                 #
#                                                                         #
#  Copy this file to "/etc/udev/rules.d/" and execute                     #
#  "/sbin/udevcontrol reload_rules" as root. This only needs to be done   #
#  immediately after installation. Each time you reboot your system the   #
#  rules are automatically loaded by UDEV.                                #
#                                                                         #
###########################################################################
#  Revision History:                                                      #
#                                                                         #
#  04/15/2010(MTA): created                                               #
#  02/28/2011(MTA): modified to support FTDI based devices                #
#                                                                         #
###########################################################################

# Create "/dev" entries for Digilent device's with read and write
# permission granted to all users.
SYSFS{idVendor}=="1443", MODE="666"

ACTION=="add", SYSFS{idVendor}=="0403", SYSFS{manufacturer}=="Digilent", MODE="666", RUN+="/usr/local/sbin/dftdrvdtch %s{busnum} %s{devnum}" 

# The following rules (if present) cause UDEV to ignore all UEVENTS for
# which the subsystem is "usb_endpoint" and the action is "add" or
# "remove". These rules are necessary to work around what appears to be a
# bug in the Kernel used by Red Hat Enterprise Linux 5/CentOS 5. The Kernel
# sends UEVENTS to remove and then add entries for the endpoints of a USB
# device in "/dev" each time a process releases an interface. This occurs
# each time a data transaction occurs. When an FPGA is configured or flash
# device is written a large number of transactions take place. If the
# following lines are commented out then UDEV will be overloaded for a long
# period of time while it tries to process the massive number of UEVENTS it
# receives from the kernel. Please note that this work around only applies
# to systems running RHEL5 or CentOS 5 and as a result the rules will only
# be present on those systems.

Thanks!
-Igor

Last edited by UQ-igor (2011-12-24 03:56:10)

Offline

#2 2011-12-24 09:43:45

Pieter-Jan
Member
Registered: 2011-11-20
Posts: 9

Re: UDEV rules for Xilinx FPGA devices

Try this
Use ATTR or ATTRS.

-SYSFS{idVendor}=="1443", MODE="666"
-ACTION=="add", SYSFS{idVendor}=="0403", SYSFS{manufacturer}=="Digilent", MODE="666", RUN+="/usr/sbin/dftdrvdtch %s{busnum} %s{devnum}"

+ATTRS{idVendor}=="1443", MODE="666"
+ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{manufacturer}=="Digilent", MODE="666", RUN+="/usr/sbin/dftdrvdtch %s{busnum} %s{devnum}"

+ATTR{idVendor}=="1443", MODE="666"
+ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Digilent", MODE="666", RUN+="/usr/sbin/dftdrvdtch %s{busnum} %s{devnum}"

Offline

#3 2011-12-24 12:01:34

UQ-igor
Member
Registered: 2009-03-05
Posts: 42

Re: UDEV rules for Xilinx FPGA devices

Hi Pieter-Jan,

Thanks for the help, using ATTRS works fine. Now normal users can use djtgcfg to program Digilent boards.

Cheers,
-Igor

Offline

Board footer

Powered by FluxBB