cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
6,787 Views
Registered: ‎04-19-2011

AXI GPIO, where to find the pin number

Jump to solution

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

0 Kudos
Reply
1 Solution

Accepted Solutions
Highlighted
Explorer
Explorer
10,950 Views
Registered: ‎02-18-2013

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.

 

Unbenannt.png

 

You have to fill in the Channelnumber 1 or 2 in the function to get access to each of this channel.

 

Hope this help.

View solution in original post

2 Replies
Highlighted
Explorer
Explorer
10,951 Views
Registered: ‎02-18-2013

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.

 

Unbenannt.png

 

You have to fill in the Channelnumber 1 or 2 in the function to get access to each of this channel.

 

Hope this help.

View solution in original post

Highlighted
Visitor
Visitor
6,770 Views
Registered: ‎04-19-2011

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.

0 Kudos
Reply