UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Observer luminal101
Observer
1,833 Views
Registered: ‎02-10-2017

Dual AXI GPIO design not working

Jump to solution

I have a Microblaze design with two AXI GPIO instances attached, each with the dual channel option attached.

 

In Xilinx SDK, my code is as follows:

 

#define GPIO0_DEVICE_ID XPAR_GPIO_0_DEVICE_ID
#define GPIO1_DEVICE_ID XPAR_GPIO_1_DEVICE_ID
#define DIRMASK_GPIO0_CHAN1 0x1800FFFF /* 0: Out, 1: in; bits 27 & 28: STATUS_LD inputs) */
#define DIRMASK_GPIO0_CHAN2 0x0001E0F8 /* */
#define DIRMASK_GPIO1_CHAN1 0x0000FF00
#define DIRMASK_GPIO1_CHAN2 0xFFFFFFFF

 

XGpio Gpio0; /* The instance of the Gpio Device */
XGpio Gpio1;

 

int MyGpio_Initialize()
{

int Status;
u32 DataDirection;

 

Status = XGpio_Initialize(&Gpio0, GPIO0_DEVICE_ID);
if (Status != XST_SUCCESS) {

return XST_FAILURE;

}

 

Status = XGpio_Initialize(&Gpio1, GPIO1_DEVICE_ID);
if (Status != XST_SUCCESS) {

return XST_FAILURE;

}

 

Status = XGpio_SelfTest(&Gpio0);
if (Status != XST_SUCCESS) {

return XST_FAILURE;

}

 

Status = XGpio_SelfTest(&Gpio1);

if (Status != XST_SUCCESS) {

return XST_FAILURE;

}

 

XGpio_SetDataDirection(&Gpio0, 1, DIRMASK_GPIO0_CHAN1);
XGpio_SetDataDirection(&Gpio0, 2, DIRMASK_GPIO0_CHAN2);
XGpio_SetDataDirection(&Gpio1, 1, DIRMASK_GPIO1_CHAN1);
XGpio_SetDataDirection(&Gpio1, 2, DIRMASK_GPIO1_CHAN2);

 

DataDirection = XGpio_GetDataDirection(&Gpio0, 1);
if (DataDirection != DIRMASK_GPIO0_CHAN1) {

return XST_FAILURE;

}

 

DataDirection = XGpio_GetDataDirection(&Gpio0, 2);
if (DataDirection != DIRMASK_GPIO0_CHAN2) {

return XST_FAILURE;

}

 

DataDirection = XGpio_GetDataDirection(&Gpio1, 1);
if (DataDirection != DIRMASK_GPIO1_CHAN1) {

return XST_FAILURE;

}

 

DataDirection = XGpio_GetDataDirection(&Gpio1, 2);
if (DataDirection != DIRMASK_GPIO1_CHAN2) {

return XST_FAILURE;

}

 

return XST_SUCCESS;

}

 

I can set the data direction for the Gpio0 instance, but not for the Gpio1 instance (the XGpio_GetDataDirection return value for Gpio1 is always zero). Also, the XGpio_DiscreteWrite function works for Gpio0, but not for Gpio1 (register value after writing a non-zero value is still zero). What am I doing wrong?

 

(Using Vivado 2017.2 and Xilinx SDK 2017.2).

0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
2,718 Views
Registered: ‎09-12-2007

Re: Dual AXI GPIO design not working

Jump to solution

Are you able to manually read/write the second GPIO from XSCT?

so, the commands are

connect

targets

ta X

where X is the microblaze

stop

mrd 0x<address>

mwr 0x<address>+0x4 0xffffffff

 

ect..

 

Reference: See the register map here

https://www.xilinx.com/support/documentation/ip_documentation/axi_gpio/v2_0/pg144-axi-gpio.pdf 

 

 

3 Replies
Moderator
Moderator
2,719 Views
Registered: ‎09-12-2007

Re: Dual AXI GPIO design not working

Jump to solution

Are you able to manually read/write the second GPIO from XSCT?

so, the commands are

connect

targets

ta X

where X is the microblaze

stop

mrd 0x<address>

mwr 0x<address>+0x4 0xffffffff

 

ect..

 

Reference: See the register map here

https://www.xilinx.com/support/documentation/ip_documentation/axi_gpio/v2_0/pg144-axi-gpio.pdf 

 

 

Explorer
Explorer
1,785 Views
Registered: ‎06-19-2015

Re: Dual AXI GPIO design not working

Jump to solution

Hi @luminal101

 

Check in AXI_GPIO ip.. Make sure you havenot fixed the direction either input/output.. Uncheck the input/output checkbox in your AXI_GPIO ip configuaration... And check the GPIO width also...Screenshot (13).png

 

----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------

 

Thanks

Madhu

0 Kudos
Observer luminal101
Observer
1,717 Views
Registered: ‎02-10-2017

Re: Dual AXI GPIO design not working

Jump to solution

To be honest, I can no longer repeat the behaviour described above. The xgpio driver now works for both AXI GPIO instances, but i'm not aware of any changes that could explain it.

 

Anyway, thank you for your help! I will use the manual read/writes via XSCT in future debugging sessions.

0 Kudos