I have a Z7-10 board. I am writing software for the Zynq, which will access 8 GPIO pins via the PL (using the AXI GPIO IP). These will be 4 each on-board LEDs LD0-LD3 (to be configured as output) and DIP switches SW0-SW3(to be configured as input). The BD is shown below. The offset and high address are shown below in the SS.
My target is to read the status of the 4x slide switches and write those values back to the LEDs in order.
So to achieve that, after initializing the GPIO, I have also set the direction of the bits as shown in the following 2 lines.
Status = XGpio_CfgInitialize(&my_Gpio, GPIO_Config, GPIO_Config -> BaseAddress);
XGpio_SetDataDirection(&my_Gpio, 1, 15); // Only the 4 LSB bits are inputs(4x slide switches), so 1's
Now all I have to do is to read the switch status and write them back to the LEDs inside a while loop. However I am not sure how to use the XGpio_ReadReg() or XGpio_WriteReg().
SDK tells me the to use XGpio_*Reg(BaseAddress, RegOffset). But what would be my BaseAddress, RegOffset?
Will it be as shown in the Address Editor, i.e. BaseAddress = 0x4120_0000 and RegOffset = 0x00000000?
Question
dpaul
Hello,
I have a Z7-10 board. I am writing software for the Zynq, which will access 8 GPIO pins via the PL (using the AXI GPIO IP). These will be 4 each on-board LEDs LD0-LD3 (to be configured as output) and DIP switches SW0-SW3(to be configured as input). The BD is shown below. The offset and high address are shown below in the SS.
My target is to read the status of the 4x slide switches and write those values back to the LEDs in order.
So to achieve that, after initializing the GPIO, I have also set the direction of the bits as shown in the following 2 lines.
Status = XGpio_CfgInitialize(&my_Gpio, GPIO_Config, GPIO_Config -> BaseAddress);
XGpio_SetDataDirection(&my_Gpio, 1, 15); // Only the 4 LSB bits are inputs(4x slide switches), so 1's
Now all I have to do is to read the switch status and write them back to the LEDs inside a while loop. However I am not sure how to use the XGpio_ReadReg() or XGpio_WriteReg().
SDK tells me the to use XGpio_*Reg(BaseAddress, RegOffset). But what would be my BaseAddress, RegOffset?
Will it be as shown in the Address Editor, i.e. BaseAddress = 0x4120_0000 and RegOffset = 0x00000000?
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now