The recently released (limited-edition) JeeNode Block has a couple of changes w.r.t. pin allocation, most notably the RFM12B’s “nIRQ” interrupt pin. This was moved from PD2 to PB1 (Arduino digital pin 2 to pin 9). The main reason for this change was to free the entire set op pins on PORTD, i.e. PD0..PD7 – in Arduino-speak: digital pin 0 through 7.
That means interrupts are no longer coming in over the INT0 line, and can no longer use the attachInterrupt() and detachInterrupt() functions in the Arduino run-time library. Instead, the RF12 driver needs to switch to pin-change interrupts, which I’ve now added to the /code.
To use the RF12 driver with the JeeNode Block, you need to make the following changes:
Get the latest version of JeeLib from GitHub
Enable pin-change interrupts by removing the comment so it defines
#define PINCHG_IRQ 1
RFM_IRQdefine (make sure you pick the ATmega328 case):
// ATmega168, ATmega328, etc. #define RFM_IRQ 1
If you plan to use
RF12demo.ino– don’t forget to change the LED pin to match the JeeNode Block:
#define LED_PIN 8
Compile and upload, and things should work as on any other JeeNode.
Note that pin-change interrupts are a bit tricky. First of all, changes are not the same as responding to a level interrupt, but the new code should take care of that. More importantly, the RF12 driver assumes it’s the only one using pin changes on the corresponding “port” (in Atmel datasheet terminology). If you use more pins for port interrupts, you may have to adjust the RF12.cpp file.
These changes are not on by default, the latest RF12 driver comes configured for the original JeeNodes.
Update – 2014-11-23: RFM_IRQ changed from 9 to 1