Hey all
I was working with EMIO and kept a pin to external . (A20) . I read that it was pin 54 in Zync boards.
So to access first emio we set the pin 54 to high or low whatsoever you want .
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xgpiops.h"
#include "xparameters.h"
XGpioPs_Config *gpio_config;
XGpioPs gpio;
void init(){
int status;
gpio_config = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID);
status = XGpioPs_CfgInitialize(&gpio, gpio_config, XPAR_PS7_GPIO_0_BASEADDR);
if(status == XST_SUCCESS)
xil_printf("Device Init Successful\n");
else
xil_printf("Device Init Failed\n");
}
int main()
{
u32 sw= 0;
init_platform();
init();
print("Starting GPIO EMIO Test\n\r");
/////////Setting 51 as input
XGpioPs_SetDirectionPin(&gpio, 51, 0);
/////////Setting 51 and 54 as Output
XGpioPs_SetDirectionPin(&gpio, 47, 1);
XGpioPs_SetDirectionPin(&gpio, 54, 1);
XGpioPs_SetOutputEnablePin(&gpio ,47 , 1);
XGpioPs_SetOutputEnablePin(&gpio ,54 , 1);
while(1){
sw = XGpioPs_ReadPin(&gpio,51);
XGpioPs_WritePin(&gpio, 47 , sw);
XGpioPs_WritePin(&gpio,54,sw);
xil_printf("Value read sw0 : %0d \n ",sw);
sleep(1);
}
cleanup_platform();
return 0;
}
Btn is at mio pin 51 .
Internal user led is at pin 47 .
and A20 external pin connection has been put at 54 .
But on scope it does not show the pin going high or low .
Thanks .