userland application reacting to hardware interrupt

Started by krbonne, April 03, 2014, 12:52:48 AM

Previous topic - Next topic

krbonne

Hi,

Not specifically a question for the A13, but as there is no forum dedicated to generic linux coding, I'll ask it here.

How do I write a userland application that reacts to a hardware interrupt on one of the IO pins. I want to interface with a chip (NRF24L01) that uses SPI to control it, but returns a hardward interrupt on an events (like "packet received").

Any info on how to code this? (in preference in C).


Cheerio! Kr. Bonne.

vinifr


MBR

If a GPIO has the edge file in its directory, it can generate hardware interrupt. The C code example is at https://developer.ridgerun.com/wiki/index.php/Gpio-int-test.c, the main key is to use poll() to wait on value file.

krbonne

Hi MBR, vinifr,

I'm sorry for the late reply. (been busy couple of days).

OK, this is funny.
It looks like I had already tried out the application you mention. But, when doing copy-and-paste, I had put the "fopen" insite the while loop, so the application didn't work. I made the wrong conclussions because of that. How stupid! :-(

OK. It now works. Thanks!

Now I only need to find out how to access the spi bus on the A13 and I can get started.


Cheerio! Kr. Bonne?