2 Replies Latest reply on Oct 31, 2018 5:15 PM by rykowski

    Vivado_Workshop exercise 5

    100z3ro

      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[*]}]

        • Please be more specific.
          bhfletcher

          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

          • FWIW
            rykowski

            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.