A20 GPIO Interruption


OpenglMan
 Share

1 1

Recommended Posts

Hello,

 

I need to use an IRQ interruption with a button. I mean, I push a button, and then a code is executed.

 

Some information: The PIN is PH19, EINT19. and the board A20 SOM. Armbian SO, kernel 4.13

 

Firstly i configure the digital pin and IRQ from user space:

echo 243 > /sys/class/gpio/export

echo "in" > /sys/class/gpio/gpio243/direction

echo "falling" > /sys/class/gpio/gpio243/edge

 

Now, when I push the button, I can monitoring the IRQ and the counter related to

cat /proc/interrupts

 

But now, how can I run a program when the interruption event happens ? 

 

I have seen this useful link

http://linux-sunxi.org/External_interrupts

 

How can i use it? I think there is very few information about this issue.

 

I executed a bash script with while true , and polling the digital pin, but the disadvantage is that it consumes a lot of cpu.

 

I hope you can help me. Thank you very much in advance

Regards

 

 

 

 

 

Link to post
Share on other sites

Donate and support the project!

Thank you martinayotte for your answer.

 

However i have found an alternative solution in PHP language that works pretty well. It barely consumes CPU. The code is very simple. Anyway I will try the code in c language that you indicated in your previous post. I imagine that the internal functioning will be similar in both solutions.

 

If anyone is interested, check the following link:

https://github.com/PacktPublishing/GNU-Linux-Rapid-Embedded-Programming/blob/master/Chapter06/gpio-poll.php 

 

Regards

 

Link to post
Share on other sites

Guest
This topic is now closed to further replies.
 Share

1 1