Forums » Software Development »
FPGA_GPIO input polling
Added by Brian Rasmussen over 13 years ago
Hi
I'm trying to get my user application notified when a FPGA GPIO input pin goes high.
I have created a FPGA image containing the FPGA Base (EMIFA) and GPIO modules. I can now toggle output pins and read status for input pins (in the /sys/class/gpio/gpio201/value file). I have found an example with the "poll" function to read from the "value" file and get a notification in my application when it changes, but I never get anything. It just waits...
In the example it refers to an "edge" file that should be found in the /sys/class/gpio/gpio201/ directory, but it is not there.
What am I missing? Do I need any additional modules / configuration in the FPGA? Shouldn't it work without the "Edge" file?
Best regards
Brian Rasmussen
P.S. If I use the supplied Fpga_gpio driver shouldn't it include some interrupt support? Any hints to how I can access this function would be a great help.
Replies (5)
RE: FPGA_GPIO input polling - Added by Michael Williamson over 13 years ago
Hi Brian,
The current fpga-gpio arm linux driver does not support interrupt notification at the moment. However, I think I can update the driver to support this function fairly quickly. Let me see if I can get you something in the next day or so.
-Mike
RE: FPGA_GPIO input polling - Added by Michael Williamson over 13 years ago
Hi Brian,
The gpiolib framework is a little more rigid than I had hoped, and updating the fpga_gpio driver to include poll(2) notification using the edge file is going to require a bit more work. The change requires creating software level interrupts for each GPIO "pin" provided by the FPGA and an associated handler. The number of software interrupts is currently hard-coded in the TI/linux framework and doesn't include space for expanded GPIO (like the FPGA, or other I/O expanders you might use with a SPI bus, etc.). I can see a path to add the additional software IRQs and the needed /edge capability, but it's more than a couple of lines of code. This is probably why I didn't put the support for it in there originally...
As soon as I can get something implemented I'll shoot you an email. Until then, I think you'll need to poll, or modify the driver code yourself and create another notification mechanism outside of gpiolib. Sorry.
-Mike
RE: FPGA_GPIO input polling - Added by Brian Rasmussen over 13 years ago
Hi Mike
Thanks for your answer.
It would be nice to have the FPGA_gpio interrupt (poll) function working, so I'm looking forward to hear from you.
My question came up because I was looking for an easy way to interrupt my user space application from the FPGA. It doesn't necessarily have to be as a gpio interrupt (at least not now), but I just thought that was the easiest thing to do...
If I connect something to the interrupt input in the FPGA (Base module), how can I then get notified in my userspace application? Are there any other drivers in the board support package, that can be used instead? As I have understood the examples and hints I have found on the net, I have to have a kernel driver that supports interrupts.
Best regards
Brian
RE: FPGA_GPIO input polling - Added by Brian Rasmussen over 13 years ago
Hi Mike
Any news about the FPGA_GPIO interrupt function? Is it still on your "to-do" list? :-)
Best regards
Brian
RE: FPGA_GPIO input polling - Added by Michael Williamson over 13 years ago
Hi Brian,
Sorry for the delay. We are working on this, but it is a little more involved. I expect to have something to try in another week or so.
-Mike