Possibility to use an alternative InteruptPin (IRQ) on Arduino Mega 2560
I ran into a slight unforseen problem in my project.
I'm using an Arduino Mega 2560 in conjunction with the RFM12B Board and got it working without any problems until I attached my GLCD shield :(
It appears that both my RFM12B board and the GLCD are trying to use the same interupt pin (IRQ a.k.a. pin 2).
I found thru my precious friend Google that it is possible to change the IRQ pin that the Jeelib is using by editing RF12.cpp.
// pin change interrupts are currently only supported on ATmega328's // #define PINCHG_IRQ 1 // uncomment this to use pin-change interrupts // maximum transmit / receive buffer: 3 header + data + 2 crc bytes #define RF_MAX (RF12_MAXDATA + 5) // pins used for the RFM12B interface - yes, there *is* logic in this madness: // // - leave RFM_IRQ set to the pin which corresponds with INT0, because the // current driver code will use attachInterrupt() to hook into that // - (new) you can now change RFM_IRQ, if you also enable PINCHG_IRQ - this // will switch to pin change interrupts instead of attach/detachInterrupt() // - use SS_DDR, SS_PORT, and SS_BIT to define the pin you will be using as // select pin for the RFM12B (you're free to set them to anything you like) // - please leave SPI_SS, SPI_MOSI, SPI_MISO, and SPI_SCK as is, i.e. pointing // to the hardware-supported SPI pins on the ATmega, *including* SPI_SS ! #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) #define RFM_IRQ 2 #define SS_DDR DDRB #define SS_PORT PORTB #define SS_BIT 0 #define SPI_SS 53 // PB0, pin 19 #define SPI_MOSI 51 // PB2, pin 21 #define SPI_MISO 50 // PB3, pin 22 #define SPI_SCK 52 // PB1, pin 20
Unfortunately there is also a comment in here that it only works for ATmega328 :(
On the Mega I have several interupt pins free (18 to 21 a.k.a. INT3, 2 1 and 0) so I'm hoping to be able to use one of these.
I wasn't able to get it to work so I hope someone here could give me some advise.
Thanks in advance,
RE: Possibility to use an alternative InteruptPin (IRQ) on Arduino Mega 2560 - Added by JohnO about 2 months ago
Did we miss this one? Did you get to a resolution Alban?