GPIO Interrupts Omega2
Hi everyone and @administrators
I was digging and searching for all the posts in this forum about how to enable interruptions in Omega2 GPIOs, however, after much reading and understanding how the Omega2 SDK works, among other things, I was able to understand how to enable interruptions in Omega2, thanks to @Kit-Bishop because without his post this would have been almost impossible not to say impossible.
I have managed to modify the code of @Kit-Bishop to be able to read and write in the GPIOs of the Omega2, with this also enable PWM and PULSE, the only thing missing are the interruptions, however, for this it is necessary the module "kmod-gpio-irq" which @luz has already modified to work on the Omega2 (https://github.com/OnionIoT/gpio-irq/pull/1), however, this module is not available in the official Omega2 packages, so it can not be installed using "opkg".
I tried to compile it on my own using the Omega2 SDK following the cross-compilation tutorial (https://docs.onion.io/omega2-docs/cross-compiling.html), then install it using opkg, however it reaches a dead end, because when I compiled it with that SDK the kernel using corresponds to version 4.4.71 , however, the version running the Omega2 is 4.4.46 (as you can see in the image attached) so it can not be installed because of the incompatibility.
I could try to use kernel 4.4.46 and compile it, however, because of the importance of this module (the interruptions are VERY important) I think it is more feasible to ask the @administrators to add it to the official packages.
So, @administrators, could you add the package please? This was already done for Omega1 but not for Omega2.
Thank you very much!!
@Keitaro While opening the complete setup to build matching kernel modules is definitely something @onion should do (@administrators, @Lazar-Demin, hello again…), there's a ugly workaround for this: you can just force the module to load:
opkg install --force-depends kmod-gpio-irq_4.4.71\+HEAD-1_mipsel_24k.ipk
This is not without risk - if kernel internals have changed too much between the kernel you are running and the kernel the module has been compiled for, this will crash the system or cause any other undefined behaviour.
Having said that, the kernel APIs used by kmod-gpio-irq haven't changed between kernels 4.4.46 and 4.4.71, so it should work in this case.
This post is deleted!
@luz Hi. I tried it, but without success.
opkg install --force-depends ./kmod-gpio-irq_4.4.74+HEAD-1_mipsel_24kc.ipk
Installing kmod-gpio-irq (4.4.74+HEAD-1) to root...
- satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-gpio-irq:
- kernel (= 4.4.74-1-aaf6d939aa2876446cc7729bf177ca18)
@Zerog despite the errors, the module should be installed now.
--force-dependsdoes not silence the error messages, but only causes them to be ignored.
insmod gpio-irqand then have a look at
lsmodto see if the module was loaded.
Hi @Zerog @luz, I've managed to compile and insmod the kernel module for Omega2. Thanks to your hints :)
however, I can't win the fight with the gpioirq (which is a part of this package https://github.com/KitBishop/Omega-GPIO-I2C-Arduino/tree/master/gpioirq).
i've been trying with "toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2" recommended in PDF doc. successfully, but it doesn't work on Omega2 (giving: syntax error: unexpected "(" (expecting ")") ) , probably by architecture/binary difference. The original Omega2 toolchain can't link it (.o fileas are baked) and producing errors like:
./../../../mipsel-openwrt-linux-musl/bin/ld: ../libnewgpio/bin/static/libnewgpio.a(GPIOPin.o): compiled for a big endian system and target is little endian
./../../../mipsel-openwrt-linux-musl/bin/ld: ../libnewgpio/bin/static/libnewgpio.a(GPIOPin.o): endianness incompatible with that of the selected emulation
./../../../mipsel-openwrt-linux-musl/bin/ld: failed to merge target specific data of file ../libnewgpio/bin/static/libnewgpio.a(GPIOPin.o)
Would appreciate for any recommendations!
success! I solve the issue :)
This is what I have changed in Makefile (for both: libnewgpio and gpioirq)
then just compile with make (libnewgpio and gpioirq consequently)