cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Baffled_As_Ever
Visitor
Visitor
216 Views
Registered: ‎03-24-2021

XGpio_DiscreteWrite - not recognised.

Jump to solution

Using Vivado and Vitis 2020.2.

I've created a platform design on the microzed (zynq 7010) where I'm writing to couple of LED's via the PS and PL.

I'm able to control the LED using Xgpsio driver etc, and I've included as instance of the Xgpio driver.

However whenever I build the application, I get undefined reference 'Gpio_DiscreteWrite', though I've included the 'xgpio.h' in the application.

Any thoughts - suspect something's wrong in my build settings but help search generally shows the SDK setting not Vitis.

Any thoughts?

Code below:

/* Include Files */
#include "xparameters.h"
#include "xgpiops.h"
#include "xgpio.h"
#include "xstatus.h"
#include "xil_printf.h"

/* Definitions */
#define XPAR_XGPIOPS_NUM_INSTANCES 1

#define XPAR_PS7_GPIO_0_DEVICE_ID 	0
#define XPAR_PS7_GPIO_0_BASEADDR 	0xE000A000
#define XPAR_PS7_GPIO_0_HIGHADRR	0xE000AFFF
#define LED_DELAY 50000000
#define printf xil_printf							/* smaller, optimised printf */
#define ledpin 47

#define GPIO_DEVICE_ID  XPAR_AXI_GPIO_0_DEVICE_ID	/* GPIO device that LEDs are connected to */
#define LED_CHANNEL 1
#define PB_CHANNEL 2



XGpioPs Gpsio;											/* GPsIO Device driver instance */
XGpio Gpio;												/* GPIO Device Driver Instance */


/* Prototype Declarations */
int initialisation ();

/* Main function. */
int main(void)
{

	int response;
	int led = 0x1;
	int bled = 0xAA;
	volatile int delay;

	response = initialisation();
	xil_printf(response);

	while(1)
	{
		XGpioPs_WritePin(&Gpsio, ledpin, led);
		Gpio_DisceteWrite(&Gpio,LED_CHANNEL,bled);
		led = ~led;
		bled = ~bled;
		for (delay =0; delay< LED_DELAY; delay++);
	}



	return 0;
}

int initialisation()
{
	int Status;
	XGpioPs_Config *GPIOConfigPtr;

		GPIOConfigPtr = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID);
		Status = XGpioPs_CfgInitialize(&Gpsio, GPIOConfigPtr, GPIOConfigPtr ->BaseAddr);
		if (Status != XST_SUCCESS)
		{
			xil_printf("GPsIO output to the LEDs failed!\r\n");
			return XST_FAILURE;
		}

		XGpioPs_SetDirectionPin(&Gpsio, ledpin, 1);
		XGpioPs_SetOutputEnablePin(&Gpsio, ledpin, 1);

		/* GPIO driver initialisation LED's */
		Status = XGpio_Initialize(&Gpio, GPIO_DEVICE_ID);
		if (Status != XST_SUCCESS)
		{
			return XST_FAILURE;
		}

		/*Set the direction for the LEDs to output. */
		XGpio_SetDataDirection(&Gpio, LED_CHANNEL, 0x0);

		/*Set the direction for the PBs to input. */
		XGpio_SetDataDirection(&Gpio, PB_CHANNEL, 0x1);

		return Status;
}

 

0 Kudos
1 Solution

Accepted Solutions
derekm_
Voyager
Voyager
192 Views
Registered: ‎01-16-2019

The function is not Gpio_DisceteWrite, but XGpio_DiscreteWrite():

void XGpio_DiscreteWrite(XGpio *InstancePtr, unsigned Channel, u32 Mask);

 

View solution in original post

3 Replies
derekm_
Voyager
Voyager
193 Views
Registered: ‎01-16-2019

The function is not Gpio_DisceteWrite, but XGpio_DiscreteWrite():

void XGpio_DiscreteWrite(XGpio *InstancePtr, unsigned Channel, u32 Mask);

 

View solution in original post

Baffled_As_Ever
Visitor
Visitor
178 Views
Registered: ‎03-24-2021

Oh, flippin eck... I've spent ages trying to resolve that one. Obviously got myself mixed-up over the XGpio instance name and the function. Duh!

derekm_
Voyager
Voyager
170 Views
Registered: ‎01-16-2019

I wouldn't worry, we've all been there!

0 Kudos