-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interrupts not available on RPi OS/Bullseye (No WiringPi) #818
Comments
RPi.GPIO? I know these are python bindings, but they are written c++ and boast interrupts. maybe we should double-down on MRAA support |
Isn’t that python?
… On Jan 3, 2022, at 8:03 AM, Brendan ***@***.***> wrote:
RPi.GPIO?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you authored the thread.
|
I think pigpio can be used from C++. It looks like RPi.GPIO is strictly for CPython. MRAA looks promising (because we already have the backend for it), but its maintenance has been looking sparse over the last few years. Conversely, MRAA transcends armhf and aarch64 arc types; I was able to compile RF24 for various other platforms in the revised build_linux.yml CI (see commented out portions). On a side note, CircuitPython has started building their own OS img for the RPi4/CM4 and RPi0W2, but it is still in early stages and I'm not sure if it will allow C++ extended python libs (though they merged in the latest changes from MicroPython which can be used with C++ extended libs). |
Does this mean we can officially deprecate WiringPi support? (keep it in there but with less maintenance for it) I know many people have migrated to the unofficial mirror. but installing that without puging the wiringPi install from |
MRAA would be promising, but I don't think they've updated it for the RPi4. Per this link they only list pin combos for earlier models of the pi, and I can't seem to get it working on my RPi4... It works up to RPi3, but not on my RPi4. Yeah, I think we can start to look at deprecating wiringPi support since everybody else is lol. |
pigpio sounds like an exciting new challenge! I think this is the function needed to enable/disable IRQ callbacks. It looks like the mraa docs haven't been updated since 2.0 (they're at v2.2.0 now). Looked into this... It seems that RPi4 support is very basic at this stage (introduced in v2.1.0), so you may have hit a worthy new issue (regarding interrupts only or basic gpio usage?) for the eclipse/mraa repo. |
I think basic GPIO or SPI usage, I get a hardware failure error on the rpi4. I’ll have to look into that more…
… On Jan 3, 2022, at 9:17 AM, Brendan ***@***.***> wrote:
pigpio sounds like an exciting new challenge! I think this is the function needed to enable/disable IRQ callbacks.
It looks like the mraa docs haven't been updated since 2.0 (they're at v2.2.0 now). Looked into this... It seems that RPi4 support is very basic at this stage (introduced in v2.1.0), so you may have hit a worthy new issue (regarding interrupts only or basic gpio usage?) for the eclipse/mraa repo.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you authored the thread.
|
Having some problems including pigpio in the workflow for these changes, I think I screwed it up. Could you take a look at it @2bndy5 ? I'm not very familiar with workflows etc. on github. In the pigpio branch... |
already on it. I'd prefer we install pigpio from latest src as using |
good newspigpio has CMake support. This is good because I can't seem to cross-compile pigpio using their hand-crafted Makefile; it doesn't seem to like using variables from the CLI or env 🤷🏼 . Furthermore, the cmake/toolchains/*.cmake scripts I made for RF24 are generic enough to use with pigpio's CMakeLists.txt 💯 bad newsThe CMake support in pigpio is apparently a community contribution and may need to be updated as such. For example, the pigpio latest version is 79, but the CMakeLists.txt has the version number hardcoded to 71 (probably from when the CMake contribution was introduced). So, we might have to keep an eye on that in future workflow runs. moving onI think using pigpio as a dependency may limit compiling RF24 for other platforms (specifically not broadcom chips). Should we discuss how to make IRQ features optional on Linux? I personally don't mind because I don't use BeagleBone or other RPi clones. Coincidentally, I think the historic reliance of using wiringPi for IRQ features could prove that end-users aren't using RF24 for non-BCM chips. |
Yeah, with the way it looks I'm thinking we will want to make IRQ support optional, keeping the dependencies as minimal as possible for a default install. Pigpio is starting to look like more trouble than it's worth, although it is nice to have interrupts on the RPi, to limit CPU load and have quick response times. |
Its definitely less trouble than I was having trying to continue supporting the undead wiringPi. I'll be glad to finally put #669 to rest. I have to look at the src in utility dir again, but I think I can auto-enable IRQ support when the build system detects presence of a BCM chip (like the |
Ok, we will have to remember to put something in the docs about pigpio too
… On Jan 3, 2022, at 3:32 PM, Brendan ***@***.***> wrote:
Pigpio is starting to look like more trouble than it's worth
Its definitely less trouble than I was having trying to continue supporting the undead wiringPi. I'll be glad to finally put #669 to rest.
I have to look at the src in utility dir again, but I think I can auto-enable IRQ support when the build system detects presence of a BCM chip (like the RPi driver option does).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you authored the thread.
|
This just occurred to me: We could provide pigpio as a separate driver entirely. Although, this would make RPi & SPIDEV drivers not use IRQ feature, but this, to me, sounds like the path of least resistance (in terms of a sustainable build system). It also concurs with other drivers that conditionally provide their own IRQ support (as in not wrapped by RF24 utility srcs) like MRAA, RP2040, & other specialized arduino-based platforms (like ATTiny & the Teensy). TBH, this is kinda the idea I was expecting when taking on pigpio to begin with. |
I wouldn’t mind adding pigpio as its own driver, but it would still be nice to have interrupt support for the SPIDEV driver at least. I guess it’s easy enough for users to add their own interrupt handling, but it is good to have on a Linux system.
I guess the question is who’s going to write the code? I’m up for it but prob can’t do it right away.
… On Jan 4, 2022, at 10:58 AM, Brendan ***@***.***> wrote:
This just occurred to me: We could provide pigpio as a separate driver entirely. Although, this would make RPi & SPIDEV drivers not use IRQ feature, but this, to me, sounds like the path of least resistance (in terms of a sustainable build system). It also concurs with other drivers that conditionally provide their own IRQ support (as in not wrapped by RF24 utility srcs) like MRAA, RP2040, & other specialized arduino-based platforms (like ATTiny & the Teensy).
TBH, this is kinda the idea I was expecting when taking on pigpio to begin with.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you authored the thread.
|
Dito. My head space is in a JS wormhole right now (sincerely trying to learn node.js & npm deployment). Last time I wrote a MCP300x driver for pigpio (in python), I had several tabs open to the same page because navigating the pigpio docs are worse than using doxygen.
I did a quick look today into how we might use the Linux kernel to use IRQ independently from other drivers. But that approach might be a little too low level for me; I would prefer to use a middleware API for the SPIDEV driver that provides basic IRQ features (or maybe I'm just not used to reading the Linux kernel docs). It might be worth poaching an approach used for another Linux HW lib (maybe even something that uses I2C like the MCP23017). I am curious also about the standalone driver's performance using pigpio. Mainly because it uses a background system service. I should investigate further, since the daemon may also appropriate HW resources when users try using a mix of GPIO API libs (1 of which would be pigpio) simultaneously. However, we hit upon a similar issue with the RPi driver (#785), so it would be nice to have an option that could potentially avoid forcing users to use different GPIO access libs at the same time. |
Well I had a chance to port RF24 over to pigpio and it works fine on earlier model RPIs, but not on my RPI4. I think its a GPIO problem, because it looks like the CE pin toggling isn't working. SPI transfers seem to work ok. I may create an issue in pigpio for this if I can dig into it a bit more and get more info. |
I just compiled the pigpio_driver branch with the pigpio driver on my RPi4 and ran gettingstarted with no problems. However, my RPi4 is apparently still using the buster based OS... I'll have to upgrade and report back; just thought I'd share this little success on backward compatibility. |
Ok, I completed the update (with @TMRh20 Is there any additional steps to reproduce the problem you're experiencing? |
No additional steps. That makes me wonder wtf. It was getting stuck very consistently at transmission using the gettingstarted example. Right where it sends 4 bytes then toggles the CE pin, then I was getting I know for a fact I tried lowering the SPI speed before, maybe I had something funky in the code at that point... I dunno, but I guess its good that it works now lol... Another reason I should have a logic analyzer... |
That's kinda good to hear. I tried setting up my logic analyzer, but all I managed to do is muck up the SPI connections (consistently got "radio not responding" on Worth noting that the exact same wiring setup works on my RPi2 at default SPI speed. Furthermore, I had to lower my SPI speed when testing the CMake solution (SPIDEV & RPi drivers) on my RPi4 running Ubuntu. At first I was under the impression that the RPi4's SPI bus impedance was somewhat higher than previous models, but someone else reported consistent results on RPi4 with Ubuntu using the CMake solution & default SPI speed... 🤷 I'm pretty anal about keeping my modules powered down when not in use (power still supplied but radio in "sleep mode"). This was initially due to scheduled power outs and random brown outs here in California, but it lamented into habit during the diligent CMake testing. |
There's been a difference in the API when using interrupts for MRAA and wiringPi. It usually results in a compilation error like so
So, I've been operating under the assumption that MRAA and wiringPi drivers aren't fully supported for RF24Gateway lib examples that involve using interrupts (and RF24/examples_linux/interruptConfigure.cpp). |
Yeah there is no interrupt support, but the non-interrupt examples should still work for Mraa and wiringPi
… On Jan 23, 2022, at 10:43 PM, Brendan ***@***.***> wrote:
There's been a difference in the API when using interrupts for MRAA and wiringPi. It usually results in a compilation error like so
***@***.***:/mnt/c/Users/ytreh/Documents/GitHub/RF24Gateway/build$ make
Scanning dependencies of target RF24GatewayNode
[ 16%] Building CXX object CMakeFiles/RF24GatewayNode.dir/RF24GatewayNode.cpp.o
[ 33%] Linking CXX executable RF24GatewayNode
[ 33%] Built target RF24GatewayNode
Scanning dependencies of target RF24GatewayNodeInt
[ 50%] Building CXX object gwNodeInt/CMakeFiles/RF24GatewayNodeInt.dir/RF24GatewayNodeInt.cpp.o
/mnt/c/Users/ytreh/Documents/GitHub/RF24Gateway/examples/gwNodeInt/RF24GatewayNodeInt.cpp: In function ‘int main(int, char**)’:
/mnt/c/Users/ytreh/Documents/GitHub/RF24Gateway/examples/gwNodeInt/RF24GatewayNodeInt.cpp:44:23: error: ‘INT_EDGE_FALLIN
’ was not declared in this scope
44 | attachInterrupt(23, INT_EDGE_FALLING, intHandler);
| ^~~~~~~~~~~~~~~~
/mnt/c/Users/ytreh/Documents/GitHub/RF24Gateway/examples/gwNodeInt/RF24GatewayNodeInt.cpp:44:3: error: ‘attachInterrupt’ was not declared in this scope
44 | attachInterrupt(23, INT_EDGE_FALLING, intHandler);
| ^~~~~~~~~~~~~~~
make[2]: *** [gwNodeInt/CMakeFiles/RF24GatewayNodeInt.dir/build.make:63: gwNodeInt/CMakeFiles/RF24GatewayNodeInt.dir/RF24GatewayNodeInt.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:144: gwNodeInt/CMakeFiles/RF24GatewayNodeInt.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
So, I've been operating under the assumption that MRAA and wiringPi drivers aren't fully supported for RF24Gateway lib (and RF24/examples_linux/interruptConfigure.cpp).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you were mentioned.
|
✏️ Reminder 📝Docs revision about IRQ should note difference in drivers' APIs and specify which lib is fully compliant with externally installed drivers |
I have serious concerns using sudo to run python (specifically when a python venv is active). Its better if we recommend that people don't build RF24 with pigpio driver when installing the python wrapper. I have already disabled interrupt support (via BTW, I haven't needed to use |
I got frustrated trying to child-proof the py wrapper's build process, so I returned to addressing nRF24/pyRF24#3... It is working, but there are nuances related to what driver was used to build the C++ lib. Using the pyrf24 pkg will not inherit these nuances because the pkg is built in isolation (doesn't require the C++ libs installed). |
* pigpio testing * pigpio * Clean up comments/descriptor * Forgot colon * fix indent in linux CI * [linux CI] try cross-compiling pigpio latest src * [linux CI] set pigpio make var from cli * there may a problem with pigpio makefile's $(CC) * Re-add pthread https://github.com/nRF24/RF24/pull/819/files/7b549fccf3d601196ec1fd98355ae26db1e77505#diff-90d08e583c4c9c6f391b2ae90f819f600a6326928ea9512c9e0c6d98e9f29ac2 * cross compile pigpio using our cmake toolchains * tell cmake to look for pigpio * IRQ example still incompatible w/ MRAA/wiringPi * Add pigpio driver #818 * Update gpio.cpp * Update spi files for pigpio * pigpio - SPI at 1mhz default * Fix per review 690f2ed#r780832480 * update build systems (needs HW testing) * not sure what is wrong with cmake built examples * don't provide pigpio for non-armhhf/aarch64 CI * fix logic in last CI change * [cmake] fix compiling irq example for pigpio * [cmake] allow RPi and SPIDEV to not use pigpio * typo in last commit * [cmake] examples avoid use irq for RPi/SPIDEV * c-n-p error in last commit * let py wrapper avoid irq if no pigpio found * fix logic in setup.py detecting pigpio * fix CMake buibld examples. prep for doxygen 1.9.3 * fix typo in cmake msg output * [cmake] correct a var value when autodetect pigpio * py wrapper link to pigpio if detected when built * [CMake] allow explicitly disabling IRQ support * [cmake] allow driver to be set from env * add a cmake msg about disabling irq support * Update linux_install.md - Add new cmake based installer script * do not include interrupt.h for python wrapper * update py wrapper install cmake doc & Linux CI * properly link to pigpio driver in py wrapper * Update setup.py Co-authored-by: 2bndy5 <2bndy5@gmail.com>
With the move to Bullseye, wiringPi is deprecated and no longer available for RPi. This means interrupts will not work on RPi anymore for users that have made the move to Bullseye. Whether using the SPIDEV or BCM driver, we used wiringPi for interrupts. In looking around, most of the GPIO C libraries support standard GPIO functions, but not interrupts, so I'm not sure exactly where to go with this one.
The text was updated successfully, but these errors were encountered: