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

How to communicate with FPGA from linux?

Unsolved
10 posts / 0 new
venkatesh_w's picture
venkatesh_w
Junior(1)
How to communicate with FPGA from linux?

I've a software application ,which I'll run on linux environment on zynq.It has to send some data to PL block ,where some computation is done and result is fed back to s/w application on linux.So I want to know how to communicate with PL(FPGA) from linux.I know that communication between PS and PL block happens through axi_gpio port ,but important thing to note is these gpio drivers are provided only for standalone application ,I can't use these gpio drivers from linux ,So how do I send data to PL block ?

wachag's picture
wachag
Junior(0)
You can try to use mmap() to

You can try to use mmap() to access the memory, or (better way) you can write a simple character device kernel module (http://lwn.net/Kernel/LDD3/).

venkatesh_w's picture
venkatesh_w
Junior(1)
Thanks for the reply wachag!

Thanks for the reply wachag!
You mean by writing a character device kernel module on linux side I can write data to axi_gpio port ?

wachag's picture
wachag
Junior(0)
Yes, I mean exactly that. It

Yes, I mean exactly that. It is the preferred way to do it on the long time.

gorkavelez's picture
gorkavelez
Junior(0)
hi!

hi!
do you know any sample application or tutorial which shows a communication between the ARM linux and the programable logic that uses a character device kernel module??

venkatesh_w's picture
venkatesh_w
Junior(1)
Thanks wachag!

Thanks wachag!
Thank you for providing that useful link about device driver kernel module.

madcow's picture
madcow
Junior(0)
Since there is a high chance

Since there is a high chance that your driver never make in into mainline there is always UIO which also uses mmap():
https://www.kernel.org/doc/htmldocs/uio-howto.html
http://www.zedboard.org/content/interrupt-handler-kernel-module

venkatesh_w's picture
venkatesh_w
Junior(1)
Thank you for the reply!

Thank you for the reply!
Did you mean that using mmap() is better than writing a device driver module for communicating with FPGA from linux ?In that case please can you provide some example or use case on how the UIO or mmap() is used to establish communication between ARM linux and FPGA?

madcow's picture
madcow
Junior(0)
I'ld not say better, just

I'ld not say better, just more practical:
With your selfmade IP-Core you have a niche for which the kernel has no specific subsystem for, like PCI, USB etc.
And because of kernel changes, a kernel module is hard to maintain.
The logical choice, at least for me, is to do the work in userspace.

With mmap you map physical memory in your process virtual memory. The Internet is full of examples on how to use mmap.

venkatesh_w's picture
venkatesh_w
Junior(1)
Thank you for your guidance !

Thank you for your guidance !