GPIO edge limit?

Moderators: mdrjr, odroid

GPIO edge limit?

Unread postby schmidtbag » Tue Sep 19, 2017 10:25 am

I have a button pad with 5 buttons that I have connected to the GPIO pins on my C1. I can set all of these pins to be inputs and I can read their values just fine. But, I am only able to set the "edge" to only 4 of them; I have found that it does not matter which pin I configure. In other words, I have GPIOs 97-101 that I want to be GPIO. If I define the edges of them in the following order:
97, 98, 99, 100, 101
I get a permission error when trying to write 101. However if I reboot the device and change the order to
97, 98, 99, 101, 100
I will now get a permission error for 100.

At first I was trying to use a program called "gpio-watch" where I noticed it was ignoring the button presses of my last-configured GPIO pin. I figured it was just a flaw in that program, so I started writing my own script in Python, only to find the same problem was happening when trying to poll for file changes. I can confirm that the edge file still says "none".


Any ideas how to fix this? Is there some hardware or kernel limitation where I can only have 4 inputs?
schmidtbag
 
Posts: 52
Joined: Sat Mar 30, 2013 10:19 am
languages_spoken: english
ODROIDs: U2 and C1

Re: GPIO edge limit?

Unread postby odroid » Tue Sep 19, 2017 10:37 am

There are 8 GPIO interrupts only. It is a hardware limitation of S805/S905 CPU.
If you use rising and falling edges together, the maximum number is only 4 as described in our WiKi page.
https://wiki.odroid.com/odroid-c1/appli ... e/gpio/irq
User avatar
odroid
Site Admin
 
Posts: 28610
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: GPIO edge limit?

Unread postby schmidtbag » Tue Sep 19, 2017 11:00 am

Ah, I was not aware of the IRQ limitation. Just after posting this I was trying to research how to find out how many IRQs I can use, but I guess you led me to the answer even quicker.

4 sure seems low, but I can try limiting myself to only falling triggers. Anyway thanks for the information, and the link.

For anyone else who needs more interrupts, I came up with a solution for you:
Set up one more additional GPIO pin. This one and only pin will have the "edge" defined. For each other pin you have, connect it the way you would normally want, but in addition to that, have a diode that leads to the new input pin you just set up. That way, any button you press will trigger the poll event for that one pin, which will interrupt your application. From there, your application can just simply read the value of each GPIO input pin and whichever one has the different value is the button that is pressed.
schmidtbag
 
Posts: 52
Joined: Sat Mar 30, 2013 10:19 am
languages_spoken: english
ODROIDs: U2 and C1

Re: GPIO edge limit?

Unread postby odroid » Tue Sep 19, 2017 11:11 am

Ah.. hardwired-OR logics seem to be a very promising solution.
User avatar
odroid
Site Admin
 
Posts: 28610
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID


Return to Hardware and peripherals

Who is online

Users browsing this forum: No registered users and 1 guest