-
-
Notifications
You must be signed in to change notification settings - Fork 34
Only one pin interrupt supported #7
Comments
Confirmed here also. Simple sketch reading a rotary encoder that should use 2 interrupts only one works. |
There's a tip by @ohazi on the forum for this: https://forum.arduino.cc/index.php?topic=634250.msg4295322#msg4295322 |
ARMmbed/mbed-os@79c7fa1 - Set GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS and NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS to 8 to allow more pin interrupt sources. This addresses arduino#7 - Cherry pick manual edits to cores/arduino/mbed/ after running mbed-os-to-arduino script.
I have a fix for this here: https://github.com/ohazi/ArduinoCore-nRF528x-mbedos To get here, I went through the steps in the Before compiling mbed-os, I changed
This should increase the number of available pin interrupts from 1 to 8. You can change this to a larger number if you need more, but 8 seemed reasonable. Note that you need to make this change before you compile mbed-os because it ends up affecting libmbed.a -- you can't just edit the copied header (in The I then found a bug (#9), as well as a workaround. I can now run the original example (3 pin interrupt sources), and it works as expected. |
Attaching interrupts for multiple pin change events via attachInterrupt(...) doesn't appear to work on the new nRF52840 based nano boards.
In the simplified test case below, the first call to attachInterrupt appears to work (falling edge of IN3, or pin 6). The other ones don't work. You can change the order of the attachInterrupt calls to get a different pin change interrupt to start working, but I've only ever seen one interrupt working at a time.
I think pins 4, 5, and 6 are actually pins P1_15, P1_13, and P1_14 on the nRF52840 (from variant.cpp), although this could be wrong (the documentation for these new nano boards is pretty lacking). Could this be because all of the inputs are on the same port? This normally isn't a restriction, e.g. when using Nordic's SDK, although I haven't used mbed on a Nordic IC.
In any case, this seems like a bug.
The text was updated successfully, but these errors were encountered: