Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

A20 GPIO Interruption

Featured Replies

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

 

 

 

 

 

  • Author

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

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.