Part 2: Implementation of GPIO via MIO on ZedBoard by using Vivado

Abstract: In this tutorial, ZedBoard is used to implement GPIO via MIO. Here, the GPIOs i.e., two buttons, one LED, and Pmod E which are directly accessible in PS of ZedBoard are used to implement the MIO concept.

Implementation : There are following two ways to implement the above-mentioned GPIOs in Zedboard.

  1. Go to following GitHub link Click here for GitHub Link and follow the instructions given in this link.
  2. The second way is explained here:

Open Vivado, select the zedboard from Boards, and click on finish.


Create block design and click OK.


Select Zynq7 Processor System from search box and run Run Block Automation and click Ok


Double click on processing_system7_0, deselect the reset, AXI interface, clock and some peripherals (PS-PL configuration>General>Enable Clock Reset>FCLOCK_RESET0_N, PS-PL configuration>GP Master AXI Interface> M AXI GPO interface, Clock Configuration>PL Fabric Clocks>FCLK_CLK0, Peripheral I/O Pins>TTC0, and USB0), and click Ok. You would have the following beautiful figure.


validate you design, generate output products and create HDL wrapper


Lastly, export hardware and launch the SDK. In SDK environment create application project and select hello world and finish it. Copy the code following code and paste it into helloworld.c file

/***************************** Include Files ********************************/
#include “xparameters.h”
#include “xgpiops.h”
#include “xstatus.h”
#include <xil_printf.h>
#include “sleep.h”
/************************** Variable Definitions **************************/
XGpioPs Gpio;    /* The driver instance for GPIO Device. */
XGpioPs_Config *ConfigPtr;
int main(void)
int Status;
u32 InputData;
/* Initialize the GPIO driver. */
ConfigPtr = XGpioPs_LookupConfig(XPAR_XGPIOPS_0_DEVICE_ID);
Status = XGpioPs_CfgInitialize(&Gpio, ConfigPtr,
if (Status != XST_SUCCESS) {
XGpioPs_SetDirectionPin(&Gpio, 50, 0);
XGpioPs_SetOutputEnablePin(&Gpio, 50, 0);
XGpioPs_SetDirectionPin(&Gpio, 7, 1);
XGpioPs_SetOutputEnablePin(&Gpio, 7, 1);
XGpioPs_SetDirectionPin(&Gpio, 0, 1);
XGpioPs_SetOutputEnablePin(&Gpio, 0, 1);
XGpioPs_SetDirectionPin(&Gpio, 9, 1);
XGpioPs_SetOutputEnablePin(&Gpio, 9, 1);
XGpioPs_SetDirectionPin(&Gpio, 10, 1);
XGpioPs_SetOutputEnablePin(&Gpio, 10, 1);
XGpioPs_SetDirectionPin(&Gpio, 11, 1);
XGpioPs_SetOutputEnablePin(&Gpio, 11, 1);
XGpioPs_SetDirectionPin(&Gpio, 12, 1);
XGpioPs_SetOutputEnablePin(&Gpio, 12, 1);
XGpioPs_SetDirectionPin(&Gpio, 13, 1);
XGpioPs_SetOutputEnablePin(&Gpio, 13, 1);
XGpioPs_SetDirectionPin(&Gpio, 14, 1);
XGpioPs_SetOutputEnablePin(&Gpio, 14, 1);
XGpioPs_SetDirectionPin(&Gpio, 15, 1);
XGpioPs_SetOutputEnablePin(&Gpio, 15, 1);
InputData = XGpioPs_ReadPin(&Gpio, 50);
XGpioPs_WritePin(&Gpio, 7, InputData);
XGpioPs_WritePin(&Gpio, 0, 1);
XGpioPs_WritePin(&Gpio, 9, 1);
XGpioPs_WritePin(&Gpio, 10,1);
XGpioPs_WritePin(&Gpio, 11,1);
XGpioPs_WritePin(&Gpio, 12,0);
XGpioPs_WritePin(&Gpio, 13,0);
XGpioPs_WritePin(&Gpio, 14,0);
XGpioPs_WritePin(&Gpio, 15,0);
XGpioPs_WritePin(&Gpio, 0, 0);
XGpioPs_WritePin(&Gpio, 9, 0);
XGpioPs_WritePin(&Gpio, 10,0);
XGpioPs_WritePin(&Gpio, 11,0);
XGpioPs_WritePin(&Gpio, 12,1);
XGpioPs_WritePin(&Gpio, 13,1);
XGpioPs_WritePin(&Gpio, 14,1);
XGpioPs_WritePin(&Gpio, 15,1);

Finally, on the run icon click Run As> Launch On Hardware (System Debugger). Congratulation, you are able to control or monitor external signals via MIO on PS of Zedboad.

One thought on “Part 2: Implementation of GPIO via MIO on ZedBoard by using Vivado

  • I looked at your code and I want to know how you found the pin numbers that you reference? In the video, you mention a “manual”, however, the Zynq development board references many manuals. Can you please tell me the exact name of the manual you utilized and the page number to find your pin numbers on the zedboard? If you used the Vivado or SDK IDE to find your pin numbers, please let me know how you found them. Thank you.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s