Porting Jeelib for Attiny85 + RFM12B

I am trying to get the Jeelib work for an Attiny85 with pinchange interrupts. See the schematic attached for the hardware part.

I have modified the RF12B.cpp in the following way:

I added a "always on" PINCHG_IRQ for ATTiny85

#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny45__)
#define PINCHG_IRQ 1   
#endif

I have added a section fot that MCU in the SPI defines:

...
#elif defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny45__)
#define RFM_IRQ     4
#define SS_DDR      DDRB
#define SS_PORT     PORTB
#define SS_BIT      3

#define SPI_SS      3     
#define SPI_MISO    0     
#define SPI_MOSI    1     
#define SPI_SCK     2     
...

I have added a section in the

....
#if PINCHG_IRQ
#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny45__)
        ISR(PCINT0_vect) { if (!bitRead(PINB, RFM_IRQ )) rf12_interrupt(); }
#else ......

I added a section in the rf12_initialize procedure as follows:

.....
#if PINCHG_IRQ
#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny45__)
        if ((nodeid & NODE_ID) != 0) {
            bitClear(DDRB, RFM_IRQ);      // input
            bitSet(PORTB, RFM_IRQ);       // pull-up
            bitSet(PCMSK, RFM_IRQ);      // pin-change
            bitSet(GIMSK, PCIE);         // enable
        } else
            bitClear(PCMSK, RFM_IRQ);
#else ...

Just to see if the thing is alive, I have a LED on the PB2, it flashes once then freezes, right when it is supposed to talk to the RFM12b..

Any help to get this working is appreciated

Schematic

The actual project on stripboard http://forum.jeelabs.net/files/IMAG0219.jpg

The sketch http://forum.jeelabs.net/files/test_rfm12b_0.ino

Hi Martin

Are you sure your MISO and MOSI pins/signals are not swapped?

Märt