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
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • 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 Vivado_Workshop exercise 5
  • 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 Not Answered
  • Replies 2 replies
  • Subscribers 354 subscribers
  • Views 332 views
  • Users 0 members are here
Related

Vivado_Workshop exercise 5

Former Member
Former Member over 10 years ago

Hello all,
I am in the process of guide, which I downloaded from this site and came across a simple problem which i'm not able to fix. I did a processing system with quad spi and gpio in the PL. I was able to properly configure the GPIO but as I try to read the values of the keys but XGpio_DiscreteRead(&my_Gpio,1) is always getting 0xEA00003D value, regardless of the buttons state. GPIO is connected to the leds and buttons on ZedBoard. Can anybody help work this out? Thank you in advance.

C code:
#include <stdio.h>
#include "platform.h"
#include "xgpio.h"
#include "xparameters.h"



int main()
{
tXGpio_Config *GPIO_Config;
tXGpio my_Gpio;
tint status = 0;
tunsigned int DIP_value = 0;
tunsigned int LED_value = 0;
    init_platform();

    GPIO_Config = XGpio_LookupConfig(XPAR_GPIO_0_DEVICE_ID);
    status = XGpio_CfgInitialize(&my_Gpio, GPIO_Config, GPIO_Config->DeviceId);
    status = XGpio_SelfTest(&my_Gpio);

    if(status==0)
    tprintf("Status GPIO ok
r");
    else {
    tprintf("Status GPIO nok
t");
    twhile(1);
    }

    XGpio_SetDataDirection(&my_Gpio, 1, 0x000000FF);

    while(1) {
    tDIP_value = XGpio_DiscreteRead(&my_Gpio,1);
    tLED_value = DIP_value << 8;
    tprintf("DIP = 0x%04X, LED = 0x%04X
r", DIP_value, LED_value);
    }

    cleanup_platform();
    return 0;
}

and this is my constrains.

set_property PACKAGE_PIN AA11 [get_ports spi_rtl_io0_io]
set_property PACKAGE_PIN Y10 [get_ports spi_rtl_io1_io]
set_property PACKAGE_PIN AA9 [get_ports spi_rtl_sck_io]
set_property PACKAGE_PIN Y11 [get_ports {spi_rtl_ss_io[0]}]
set_property PACKAGE_PIN F22 [get_ports {gpio_rtl_tri_io[0]}]
set_property PACKAGE_PIN G22 [get_ports {gpio_rtl_tri_io[1]}]
set_property PACKAGE_PIN H22 [get_ports {gpio_rtl_tri_io[2]}]
set_property PACKAGE_PIN F21 [get_ports {gpio_rtl_tri_io[3]}]
set_property PACKAGE_PIN H19 [get_ports {gpio_rtl_tri_io[4]}]
set_property PACKAGE_PIN H18 [get_ports {gpio_rtl_tri_io[5]}]
set_property PACKAGE_PIN H17 [get_ports {gpio_rtl_tri_io[6]}]
set_property PACKAGE_PIN M15 [get_ports {gpio_rtl_tri_io[7]}]
set_property PACKAGE_PIN T22 [get_ports {gpio_rtl_tri_io[8]}]
set_property PACKAGE_PIN T21 [get_ports {gpio_rtl_tri_io[9]}]
set_property PACKAGE_PIN U22 [get_ports {gpio_rtl_tri_io[10]}]
set_property PACKAGE_PIN U21 [get_ports {gpio_rtl_tri_io[11]}]
set_property PACKAGE_PIN V22 [get_ports {gpio_rtl_tri_io[12]}]
set_property PACKAGE_PIN W22 [get_ports {gpio_rtl_tri_io[13]}]
set_property PACKAGE_PIN U19 [get_ports {gpio_rtl_tri_io[14]}]
set_property PACKAGE_PIN U14 [get_ports {gpio_rtl_tri_io[15]}]
set_property IOSTANDARD LVCMOS25 [get_ports {spi_rtl_*}]
set_property IOSTANDARD LVCMOS25 [get_ports {gpio_rtl_tri_io[*]}]
set_property PULLDOWN true [get_ports {spi_rtl_*}]
set_property PULLDOWN true [get_ports {gpio_rtl_tri_io[*]}]

  • Sign in to reply
  • Cancel
  • bhfletcher
    0 bhfletcher over 10 years ago

    Please be more specific. Which workshop are you running? Which version of Xilinx tools are your running? Typically we see problems with our workshops when someone tries to use a different version than the one for which it was written.

     

    You could always try generated a Peripheral Test using a hardware platform you have generated in your version. That will have the proper code for reading back a GPIO button or dip switch.

     

    Bryan

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

    I know it's been a while since this was posted, but for the record:In the line

    status = XGpio_CfgInitialize(&my_Gpio, GPIO_Config, GPIO_Config->DeviceId);

    DeviceId is incorrect as an address is expected. Usually 'BaseAddress' is used.

    • 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 © 2026 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