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
ZUBoard ZUBoard 1CG - Vitis debugging halts when communicating with GPIO over at PL side
  • 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 0 replies
  • Subscribers 352 subscribers
  • Views 47 views
  • Users 0 members are here
  • vivado
  • freeze
  • debugging
  • vitis
  • halt
Related

ZUBoard 1CG - Vitis debugging halts when communicating with GPIO over at PL side

tstern
tstern 1 day ago

I've setup a minimal project in Vivado, basically I only have the a GPIO block connected to one of the RGB LEDs on the board:

image

Next, I tried modifying an example code so I can toggle the LED, but once I execute a command that tried reading or writing to the PL side (AXI?) the debugging halts and I must stop debugging to reset the system. The hardware export from Vivado includes the bit file.

Here is the code that I'm running, it will hang on: XGpio_SetDataDirection(&Gpio, 1, 0);

I'll appreciate it greatly if anyone could point out what's wrong here. I'm using the latest Vivado & Vitis.

#include "xparameters.h"
#include "xgpio.h"
#include "xstatus.h"
#include "xplatform_info.h"
#include <xil_io.h>
#include <xil_printf.h>
#define XGPIOPS_BASEADDR    XPAR_XGPIO_0_BASEADDR

#define LED_DELAY       10000000

#define LED_MAX_BLINK       0x10    /* Number of times the LED Blinks */

#define printf          xil_printf  /* Smalller foot-print printf */

static int GpioOutputExample(void);
static int GpioInputExample(u32 *DataRead);
#ifndef SDT
int GpioPolledExample(u16 DeviceId, u32 *DataRead);
#else
int GpioPolledExample(UINTPTR BaseAddress, u32 *DataRead);
#endif

static u32 Input_Pin; /* Switch button */
static u32 Output_Pin; /* LED button */

XGpio Gpio; /* The driver instance for GPIO Device. */

/*****************************************************************************/
/**
*
* Main function to call the example.
*
*
* @return
*       - XST_SUCCESS if the example has completed successfully.
*       - XST_FAILURE if the example has failed.
*
* @note     None
*
******************************************************************************/
int main(void)
{
    int Status;
    u32 InputData;

    printf("GPIO Polled Mode Example Test \r\n");
#ifndef SDT
    Status = GpioPolledExample(GPIO_DEVICE_ID, &InputData);
#else
    Status = GpioPolledExample(XGPIOPS_BASEADDR, &InputData);
#endif
    if (Status != XST_SUCCESS) {
        printf("GPIO Polled Mode Example Test Failed\r\n");
        return XST_FAILURE;
    }

    printf("Data read from GPIO Input is  0x%x \n\r", (int)InputData);
    printf("Successfully ran GPIO Polled Mode Example Test\r\n");
    return XST_SUCCESS;
}

/*****************************************************************************/
/**
*
* The purpose of this function is to illustrate how to use the GPIO driver to
* turn on/off an LED and read the inputs using the pin APIs.
*
* @param    DeviceId is the XPAR_<GPIO_instance>_DEVICE_ID value from
*       xparameters.h
* @param    DataRead is the pointer where the data read from GPIO Input is
*       returned.
*
* @return
*       - XST_SUCCESS if the example has completed successfully.
*       - XST_FAILURE if the example has failed.
*
* @note     This function will not return if the test is running.
*
******************************************************************************/
#ifndef SDT
int GpioPolledExample(u16 DeviceId, u32 *DataRead)
#else
int GpioPolledExample(UINTPTR BaseAddress, u32 *DataRead)
#endif
{
    int Status;
    XGpio_Config *ConfigPtr;
    int Type_of_board;

    /* Initialize the GPIO driver. */
#ifndef SDT
    //ConfigPtr = XGpio_LookupConfig(GPIO_DEVICE_ID);
#else
    ConfigPtr = XGpio_LookupConfig(BaseAddress);
#endif
    Type_of_board = XGetPlatform_Info();
    switch (Type_of_board) {
        case XPLAT_ZYNQ_ULTRA_MP:
            Input_Pin = 1;
            Output_Pin = 0;
            break;

        case XPLAT_ZYNQ:
            Input_Pin = 14;
            Output_Pin = 10;
            break;
#ifdef versal
        case XPLAT_VERSAL:
            /* Accessing PMC GPIO by setting field to 1 */
            Gpio.PmcGpio =  1;
            Input_Pin    = 56;
            Output_Pin   = 52;
            break;
#endif
    }

    Status = XGpio_CfgInitialize(&Gpio, ConfigPtr,
                       ConfigPtr->BaseAddress);
    if (Status != XST_SUCCESS) {
        return XST_FAILURE;
    }

    Status = XGpio_Initialize(&Gpio, XPAR_XGPIO_0_BASEADDR);

    if (Status != XST_SUCCESS) {
        return XST_FAILURE;
    }
    
    /* Run the Output Example. */
    Status = GpioOutputExample();
    if (Status != XST_SUCCESS) {
        return XST_FAILURE;
    }

    return XST_SUCCESS;
}

/*****************************************************************************/
/**
*
* This function does a minimal test on the GPIO device configured as OUTPUT.
*
* @param    None.
*
* @return   - XST_SUCCESS if the example has completed successfully.
*       - XST_FAILURE if the example has failed.
*
* @note     None.
*
****************************************************************************/
static int GpioOutputExample(void)
{
    u32 Data;
    volatile int Delay;
    u32 LedLoop;

    /*
     * Set the direction for the pin to be output and
     * Enable the Output enable for the LED Pin.
     */

    XGpio_SetDataDirection(&Gpio, 1, 0);

    /* Set the GPIO output to be low. */
    XGpio_DiscreteWrite(&Gpio, 1, 0);


    for (LedLoop = 0; LedLoop < LED_MAX_BLINK; LedLoop ++) {

#ifndef __SIM__
        /* Wait a small amount of time so the LED is visible. */
        for (Delay = 0; Delay < LED_DELAY; Delay++);

#endif
        /* Set the GPIO Output to High. */
        XGpio_DiscreteWrite(&Gpio, 1, 0b111);
        /*
         * Read the state of the data and verify. If the data
         * read back is not the same as the data written then
         * return FAILURE.
         */
    

#ifndef __SIM__
        /* Wait a small amount of time so the LED is visible. */
        for (Delay = 0; Delay < LED_DELAY; Delay++);

#endif

        /* Clear the GPIO Output. */
        XGpio_DiscreteWrite(&Gpio, 1, 0);

        /*
         * Read the state of the data and verify. If the data
         * read back is not the same as the data written then
         * return FAILURE.
         */

    }
    return XST_SUCCESS;
}
 

  • Sign in to reply
  • 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