LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Performance external GPIO interrupt on Orange Pi Zero (https://www.linuxquestions.org/questions/linux-hardware-18/performance-external-gpio-interrupt-on-orange-pi-zero-4175662563/)

huuchinh02 10-15-2019 04:33 AM

Performance external GPIO interrupt on Orange Pi Zero
 
I am using OPi.GPIO to detect one interrupt from my peripheral module. It worked fine with the low trigger but it was missing some signals at a higher frequency (It was latency). I jumped into the source code of the library, it seemed to handle the interrupt with using polling output logic level, not true interrupt same as the microcontroller.
I want to ask whether orange pi is possible to make a true interrupt.
I looked for the internet and found some libraries in python better than OPi.GPIO such as: wiring-pi, pigpio...

1. The wiring-pi was implemented by C language but I am using python
2. The pigpio seem to support only for Raspberry Pi but I am using Orange Pi

Which the best way should I do now to implement my project? I think about some ideas to resolve it below:

- Build the new hardware include microcontroller and the peripheral. I'll use the MCU to handle it and making one connection between this board and Orange Pi through some basic interfaces such as SPI, I2C or UART.
- Switch to Raspberry and use pigpio. I don't ensure whether the performance better than OPi.gpio
- Is it possible to build another library by myself? If yes, how can I build it?

I hope to get the best suggestion. Many thanks!

business_kid 10-17-2019 08:46 AM

My basic understanding was: GPIO is slow in hardware terms; Python is slow in software terms. I'm not surprised to see latency. I'm surprised you designed that, but maybe other factors forced your hand (As often happens).

The sort of hardware bodge I might attempt is to OR your gpio pin with a real interrupt, and stick in a routine which basically asks "Is the gpio pin low?" and act accordingly. There were also inventive ways of getting more interrupts than interrupt pins on early cpus like the Z80. IIRC, it used to float the databus in response to an interrupt in some mode, and read the number some interrupt controller put on it.


All times are GMT -5. The time now is 08:39 PM.