01-07-2015 02:27 AM
Hello
I have the axi_gpio added to my zynq design and it synthesis fine and creates a working bit file. What I can't figure out is where to find the pin number for the function:
XGpioPs_SetDirectionPin(&ControlGpioPs, ?, 1);
I've looked every where and google but can't find the solution, if it helps the pin on the VHDL side goes into custom code and not onto a external pin.
Thanks
Bren Pierce
01-07-2015 02:36 AM
Each Bit in die Dataregister is for one GPIO.
The SetDirection-Function looks like this:
XGpioPs_SetDirectionPin(Instance, Channel, Data);
In your example you set the direction of the first GPIO (because of first bit).
For the Data you can use something like that to set your IO:
(1 << Pin)
This is an example with Channel 1 and Channel 2.
You have to fill in the Channelnumber 1 or 2 in the function to get access to each of this channel.
Hope this help.
01-07-2015 02:36 AM
Each Bit in die Dataregister is for one GPIO.
The SetDirection-Function looks like this:
XGpioPs_SetDirectionPin(Instance, Channel, Data);
In your example you set the direction of the first GPIO (because of first bit).
For the Data you can use something like that to set your IO:
(1 << Pin)
This is an example with Channel 1 and Channel 2.
You have to fill in the Channelnumber 1 or 2 in the function to get access to each of this channel.
Hope this help.
01-07-2015 03:30 AM
Thank you, got confused with using the GPIO coming out of the PS module. For other people finding this solution this was also helpfull:
void XGpio_SetDataDirection (XGpio * InstancePtr, unsigned Channel, u32 DirectionMask )
Set the input/output direction of all discrete signals for the specified GPIO channel.
Parameters:
InstancePtr
is a pointer to an XGpio instance to be worked on.Channel
contains the channel of the GPIO (1 or 2) to operate on.DirectionMask
is a bitmask specifying which discretes are input and which are output. Bits set to 0 are output and bits set to 1 are input.Returns: None.
Note: The hardware must be built for dual channels if this function is used with any channel other than 1. If it is not, this function will assert.