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 & Tria 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 & Tria Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Avnet Boards General How can I control PS MIO GPIOs under PYNQ?
  • 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 3 replies
  • Subscribers 348 subscribers
  • Views 823 views
  • Users 0 members are here
  • Software Application Development
  • ultra96
  • pynq
Related

How can I control PS MIO GPIOs under PYNQ?

kevinkeryk
kevinkeryk over 5 years ago

Hello Everyone,

 

I see lots of great examples out there of how to control all sorts of hardware under PYNQ using Jupyter Notebooks.

 

How can I control something seemingly very simple like PS MIO GPIOs from a Jupyter Notebook?

 

Thanks,

 

-Kevin

  • Sign in to reply
  • Cancel

Top Replies

  • kevinkeryk
    kevinkeryk over 5 years ago +1 verified
    Well after searching around for a while and getting some information from Mario B and Fred K, I compiled a Jupyter Notebook to help illustrate how this all works: https://github.com/zedhed/ultra96 Long…
  • kevinkeryk
    kevinkeryk over 5 years ago in reply to clem57 +1
    Thanks clem57 ! It seemed like the information should be more accessible, so I did the writeup. I didn't realize it was the same for Raspberry Pi, I need to spend more time experimenting with mine. Have…
  • kevinkeryk
    0 kevinkeryk over 5 years ago

    Well after searching around for a while and getting some information from Mario B and Fred K, I compiled a Jupyter Notebook to help illustrate how this all works:

     

    https://github.com/zedhed/ultra96

     

    Long story short, you have to export a particular GPIO so that a control for it appears within sysfs under the /sys/ folder.

     

    Here are the shortcut commands to control the MIO45 that I wanted to use:

     

     

    # Find out what you have for GPIO controllers (I have seen numbers change quite a bit from one Linux kernel release to another)
    ls /sys/class/gpio/
    
    
    # Export controls for the specific GPIO that you want to use, after you translate the MIO45 number to logical Linux GPIO number (in this case it is 338 + 45 = 383)
    echo 383 > /sys/class/gpio/export
    
    # Set the MIO controller to operate in the output mode
    echo out > /sys/class/gpio/gpio383/direction
    
    # Next try setting the output state to logic high
    echo 1 > /sys/class/gpio/gpio383/value
    
    
    # Finally, try setting the output state back to logic low
    echo 0 > /sys/class/gpio/gpio383/value

     

    Please read through the ultra96/ultra96-gpio/ultra96_control_ps_mio_gpios.ipynb Notebook for a much more thorough writeup on this topic.

     

    Best Regards,

     

    -Kevin

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • clem57
    0 clem57 over 5 years ago in reply to kevinkeryk

    kevinkeryk This is the same way to handle GPIO under the Raspberry Pi except where it is located in the tree since the pin numbers are different...

    Thanks for the pointer.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • kevinkeryk
    0 kevinkeryk over 5 years ago in reply to clem57

    Thanks clem57!  It seemed like the information should be more accessible, so I did the writeup. I didn't realize it was the same for Raspberry Pi, I need to spend more time experimenting with mine.

     

    Have a safe and happy holiday season!

     

    -Kevin

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
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