9 Replies Latest reply on Feb 27, 2019 2:37 PM by jafoste4

    MiniZed SDK LED Blinking


      I cloned and went through the example "Prebuilt Platforms Using Hardware Definition Files (HDFs)" https://github.com/Avnet/hdl/tree/mz_petalinux_2018_2 .

      I can get the Hello World printf() statements to work and have been trying to blink the Red/Green LED's. I've tried to follow the only examples I can find but none of them are specific for the minized.

      The examples I can find write directly to a pin number and use XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID); to setup the I/O. I think I should be using  XPAR_AXI_GPIO_0_DEVICE_ID.

      Nothing works and I have no idea what to put for the pin number. My code is below.

      Help please!



      #include <stdio.h>

      #include <math.h>

      #include "platform.h"

      #include "xil_printf.h"

      #include "xgpiops.h"

      ////#include "xparameters_ps.h"

      #include "xparameters.h"


      int main()


          XGpioPs_Config *GPIO_Config;

          XGpioPs my_Gpio;

          int Status;

          int LED_ONOFF = 0;

          int i,j;

          int portpin = 0;

          float raddeg,deg,num;



          print("\n\rHello World\n\r");


          // Port Setup

           //GPIO_Config = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID);

          GPIO_Config = XGpioPs_LookupConfig(XPAR_AXI_GPIO_0_DEVICE_ID);

          Status = XGpioPs_CfgInitialize(&my_Gpio, GPIO_Config,GPIO_Config->BaseAddr);

          XGpioPs_SetDirection(&my_Gpio,portpin,1);        //Set Pin Direction. (1 == output)

          XGpioPs_SetOutputEnablePin(&my_Gpio,portpin,1);    //Enable output pin


          printf("GPIO Setup Completed\n\r");


         //Blink the LED 5 times and delay blink by printing to screen.



              for (i=0;i<=4000;i++)





              if(LED_ONOFF == 1)


                  LED_ONOFF = 0;

                  printf("LED is OFF\n\r");




                  LED_ONOFF = 1;

                  printf("LED is ON\n\r");







      return 0;