element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
ZedBoard Hardware Design Accessing LEDs and Switches in Xillinux
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 21 replies
  • Subscribers 333 subscribers
  • Views 2625 views
  • Users 0 members are here
Related

Accessing LEDs and Switches in Xillinux

Former Member
Former Member over 11 years ago

Hi there,

I've installed Xillinux on my ZedBoard, and I'm wanting to simply read switch values and write LED values, like in the ZedBoard Getting Started Guide, but I don't see anything in /sys/class/gpio, only export, unexport and gpiochip0. I've read and tried a lot of things to get it working, but don't seem to be getting anywhere.

Can anybody please explain to me how to go about achieving this?

Thanks

  • Sign in to reply
  • Cancel

Top Replies

  • jafoste4
    jafoste4 over 8 years ago +1
    Hi, You could try taking a look at these documents, especially lab 3 http://zynqhowto.blogspot.kr/search?updated-max=2014-04-02T19:44:00-07:00&max-results=7 --Josh
Parents
  • Former Member
    0 Former Member over 11 years ago

    Hello,

    Xillinux uses Linux' standard GPIO convention for accessing LEDs and switches (and PMODs for that matter)

    Please refer to the xillydemo.ucf file under verilog/src (or vhdl/src, they're the same). Even if you don't understand all the details, it's clear that the following segment

    <------- Cut here -------->

    # On-board LEDs. Note that only for LEDs are allocated, as opposed to
    # Digilent's eight, and all placements that follow are shifted by four.
    # There was no other choice, as the tools don't allow unplaced PS GPIO pins.

    NET  PS_GPIO[7] LOC = V22 | IOSTANDARD = LVCMOS33;    # LD4
    NET  PS_GPIO[8] LOC = W22 | IOSTANDARD = LVCMOS33;    # LD5
    NET  PS_GPIO[9] LOC = U19 | IOSTANDARD = LVCMOS33;    # LD6
    NET  PS_GPIO[10] LOC = U14 | IOSTANDARD = LVCMOS33;    # LD7

    <------- Cut here -------->

    tells us that one of the LEDs is mapped at GPIO7. In order to access the LED from Linux, the standard command line interface can be used. There is an offset between the GPIO number in the UCF file and the one used in Linux, and it's 54 on Xillinux. So in Linux, the GPIO number for this LED should be 54+7=61.

    Which means that the following sequence should turn the LED on and off.

    At shell prompt, try

    echo 61 > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio61/direction
    echo 1 > /sys/class/gpio/gpio61/value
    echo 0 > /sys/class/gpio/gpio61/value

    There is plenty of documentation on Linux GPIO interface. There's also a faster API for application programming.

    For example, see http://falsinsoft.blogspot.co.il/2012/11/access-gpio-from-linux-user-space.html

    Hope this helped,
       Eli

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to Former Member

    How do you determine the base offset to add to the number obtained from the UCF file. (the 54 in the Xillinux case)

    I searched everywhere but I wasn't able to find a reference for this information.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 11 years ago in reply to Former Member

    How do you determine the base offset to add to the number obtained from the UCF file. (the 54 in the Xillinux case)

    I searched everywhere but I wasn't able to find a reference for this information.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube