Sorry, you need to enable JavaScript to visit this website.

Writing to GPIO from a Linux application on MicroZed

Unsolved
3 posts / 0 new
icoulter's picture
icoulter
Junior(0)
Writing to GPIO from a Linux application on MicroZed

Hi,
So I am pretty new to FPGAs but I have been testing the microZed board and trying to write an application that will run on linux to read and write from the GPIO to, for example, blink an LED.

To do this I have been using memory mapping to read and write from the registers, as described for a different board in chapter 6.3 of http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_3/ug873-..., using memcpy to read and write data from the addresses.

This seems to work fine when reading but doesn't seem to write. Writing to other peripherals such as the DDR and AFI seems to work so this seems specific to the GPIO.

I was wondering if I might need to export the relevant pin (as done via bash commands on page 17 of http://www.microzed.org/sites/default/files/documentations/MicroZed_Gett...)? Is this the problem and is it possible to do via the linux application rather than command line?

Does anyone have any advice on how to do this? I've looked around but haven't found anything explaining how to do this from the microzed.

Thanks,
Ian

mwales's picture
mwales
Junior(0)
Look at the Linux sysfs GPIO interface

I've been able to use GPIO on Zynq using the Linux kernel sysfs interface. You don't need to write any code and can read / write GPIOs from the shell.

https://www.kernel.org/doc/Documentation/gpio.txt

(It's about 4/5 through the document in a section titled "Sysfs Interface for Userspace" )

I've used that interface for both the PS GPIOs (MicroZed) and GPIOs in the PL (on a Zynq ZC706 dev board)

icoulter's picture
icoulter
Junior(0)
Thanks for the reply. I'd

Thanks for the reply. I'd seen elsewhere how to read and write from the shell but I was hoping to do this with C as it will tie into some larger code.
The documentation has looks helpful in terms of my general understanding of whats going on but I'm still not sure I whether what I want to do is possible.