GreyGnome / EnableInterrupt

New Arduino interrupt library, designed for Arduino Uno/Mega 2560/Leonardo/Due
329 stars 73 forks source link

Conflict with LMIC library #64

Open j45p41 opened 3 years ago

j45p41 commented 3 years ago

This is indeed a very useful library, infact the only library that I can find that allows me to use six interrupts to wake the Arduino. However when I use it with the LMIC library (Matthijs Kooijman ) the "Forward uplink data message" is not sent during initial registration, only if

include is commented out does it work. I am using a RFM95 with the following LMIC pin assignments:

const lmic_pinmap lmic_pins = { .nss = 10, .rxtx = LMIC_UNUSED_PIN, .rst = 9, .dio = {3, 8, LMIC_UNUSED_PIN}, };

This must be something to do with the library sharing ISRs. Could somebody point to which parts of the LMIC library so as not to have this conflict?

I have tried swapping 8 for A5 and it again only works when the line is commented. Any help would be greatly appreciated.

j45p41 commented 3 years ago

I have managed to get it to work by specifying

define EI_NOTPORTD however it does not work with #define EI_ARDUINO_INTERRUPTED_PIN which is needed for my project to function.

j45p41 commented 3 years ago

This is the best I can get to work with 6 available pin change interrupts - just enough!

define EI_ARDUINO_INTERRUPTED_PIN

define EI_NOTPORTB // DISABLE FOR LMIC

define EI_NOTPORTD // DISABLE FOR LMIC

GreyGnome commented 3 years ago

Thanks for the update. Yeah, these little ATMega chips are strange with the interrupts...!

On Wed, Jul 21, 2021 at 7:26 PM j45p41 @.***> wrote:

This is the best I can get to work with 6 available pin change interrupts

  • just enough!

define EI_ARDUINO_INTERRUPTED_PIN

define EI_NOTPORTB // DISABLE FOR LMIC

define EI_NOTPORTD // DISABLE FOR LMIC

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GreyGnome/EnableInterrupt/issues/64#issuecomment-884581173, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2KFGNVTY2ULQBUP3ZTPT3TY5QRTANCNFSM5AY3SHIQ .

-- -Mike Schwager

j45p41 commented 3 years ago

Hi, so managed to get really far, until of course, I got to the point just before the end!

I have a situation where I have interrupts defined in the following way:

define CHANNEL3_IN_PIN A4

define CHANNEL4_IN_PIN A2

define CHANNEL5_IN_PIN A5

define CHANNEL6_IN_PIN A3

define CHANNEL7_IN_PIN A0

define CHANNEL8_IN_PIN A1

enableInterrupt(CHANNEL3_IN_PIN, interruptFunction1, CHANGE); enableInterrupt(CHANNEL4_IN_PIN, interruptFunction, FALLING); enableInterrupt(CHANNEL5_IN_PIN, interruptFunction, FALLING); enableInterrupt(CHANNEL6_IN_PIN, interruptFunction, FALLING); enableInterrupt(CHANNEL7_IN_PIN, interruptFunction, FALLING); enableInterrupt(CHANNEL8_IN_PIN, interruptFunction1, CHANGE);

all works fine but if CHANNEL_3 is held LOW and then CHANNEL[4-7] are used, followed by CHANNEL_3 going HIGH - the last pin is reported as associated with the last CHANNEL[4-7] triggered instead of pin associated with CHANNEL_3.

On the next try its fine. have you seen this before? - THANKS!