element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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
  • 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
Using Xilinx Tools Forum MIO Pushbuttons GPIO
  • 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 8 replies
  • Subscribers 338 subscribers
  • Views 2120 views
  • Users 0 members are here
Related

MIO Pushbuttons GPIO

Former Member
Former Member over 13 years ago

How can the pushbutton switches on the MIO be accessed from Software?
I have enabled the GPIO on the MIO in the Zynq tab in EDK. (The UART1 is also enabled, so the GPIOs fil up the rest of the MIO)

I have tried reading from pins 50 and 51 (for the pushbuttons on the Zedboard but can't read the value from the pushbuttons. e.g.

pushButton= XGpioPs_ReadPin(&Gpio,50);
pushButton= XGpioPs_ReadPin(&Gpio,51);

I've also tried reading the memory locations directly around the address 0xe000a000 but can't see any changes when I press the push buttons.



I'm initialising the pointer like the example, and it seems to give the correct base address:
ConfigPtr = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID);
Status = XGpioPs_CfgInitialize(&Gpio, ConfigPtr, ConfigPtr->BaseAddr);
tt

On a related issue, I routed the dipswitches on the board through the EMIO, and found the driver functions did not work correctly. e.g. XGpioPs_ReadPin(&Gpio, pin);
I found the switches were mapped to the memory address  Gpio.GpioConfig.BaseAddr+16, not Gpio.GpioConfig.BaseAddr which I think the XGpioPs_ReadPin was trying to read from. I could work around this because I could see where the GPIO were mapped in memory, but I can't see where the pushbuttons are mapped, or even if they are conneted properly.

Have I missed a step somewhere, or am I trying to use the GPIO in the wrong way? Any help or advice appreciated.

  • Sign in to reply
  • Cancel
  • zedhed
    0 zedhed over 13 years ago

    Hi 1372899,

    I think this may be something that is covered by the "Zynq Concepts, Tools, and Techniques on ZedBoard v14.1" document in the Support-->Reference Designs section.

    I recommend looking through that document since it should contain information on accessing the MIO pushbuttons.

    Regards,

    -Kevin

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

    Hi Kevin,
    Thanks for the reply. I haven't followed this guide in detail as it is for the ZC702 board, but I did use it as the basis for what I was trying. I think it only covers the EMIO and AXI GPIO, not the MIO. I can get these working, but not the GPIO on the MIO.

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

    I am facing the same problem.
    I followed the example in the "Zynq Concepts, Tools, and Techniques on ZedBoard v14.1" document and added instructions to read from pins 50 and 51 and the value returned is constantly one.

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

    And I found the solution.
    In the XPS were you instantiate the PS system.
    In the system assembly viem click on the I/O peripherals.The make on MIO 50 and 51 on the Pullup column select disabled and the Direction Column select in.
    Hope that solves your problem

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

    I see the GPIO driver read function has an error with operator precedence, adding parentheses in return statement would be one way to fix the function:


    u32 XGpioPs_ReadPin(XGpioPs *InstancePtr, u32 Pin)
    {
           u8 Bank;
           u8 PinNumber;

           Xil_AssertNonvoid(InstancePtr != NULL);
           Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
           Xil_AssertNonvoid(Pin < InstancePtr->MaxPinNum);

           /* Get the Bank number and Pin number within the bank. */
           XGpioPs_GetBankPin((u8)Pin, &Bank, &PinNumber);

           return ( ( XGpioPs_ReadReg(InstancePtr->GpioConfig.BaseAddr,
                               ((u32)(Bank) * XGPIOPS_DATA_BANK_OFFSET) +
                               XGPIOPS_DATA_RO_OFFSET) >> (u32)PinNumber) ) & (u32)1;

    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • sivatt
    0 sivatt over 7 years ago

    Hello,

    I am trying to execute the program from 


    https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/gpiops/examples/xgpiops_intr_example.c

    https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/gpiops/examples/xgpiops_polled_example.c

    I changed input pin number to 26 and output pin to 31. I am able to control PS LED through output pin 31 . But not getting any data from input pin 26. I referred http://zedboard.org/sites/default/files/documentations/UltraZed%20IOCC-UG%201v1-1.pdf for pin numbers.

    I am using Ultrazed EG starrer Kit. Please let me know how to map the pin number

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • jafoste4
    0 jafoste4 over 7 years ago

    Hello,

    I am unfamilair with the program you are referencing.

    Can you share your contraint file with me so I can double check your pin assignments.

    Also please ask this question at the Xilinx support forum as they are the creators of the GPIO example ypi are referencing.

    --Josh

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • sivatt
    0 sivatt over 7 years ago in reply to jafoste4

    Hello Josh,

    I have not used any constraint files. Constraint file downloaded from avnet do not have mapping for JX3 pins. Pin number 26 and 31 are connected to JX3 as per the pdf I mentioned in the question.

    Thanks

    • Cancel
    • Vote Up 0 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