attiny84 and nrf24L01+ - I'm sure I'm thiiiiiiiiiiiis close.

Hi all,

I have a totally working project using pro minis and pro micros attached to nrf24L01+ modules. I've mixed 16mhz and 8mhz units and everything is working great. I'm using stanleyseow's arduino-nrf24l01 library (GitHub - stanleyseow/arduino-nrf24l01: An Arduino & attiny port of the http://www.tinkerer.eu/AVRLib/nRF24L01 library.) across all of these.

Now, I'm trying to downsize a few of the remote units to use the attiny84. I am new to avr, but I can program the 84 with blinky sketches to confirm that I can at least interact with it successfully.

To simplify debugging, I have a very simple ping sketch with a client on one pro micro and a server on another. I get successful pings between these just fine. I uploaded the nearly identical (ping server) sketch to the attiny and am not getting any response. The only difference between the sketch that runs on the pro mini (ping server) is that I am including SPI85.h on the attiny and on the attiny I am setting the fuses for 8mhz and am adjusting the SPI prescaler to (I believe) run the nrf24 on 4mhz like the other units.

A few notes about the setup:

  1. I can confirm that my power sources are clean and properly regulated
  2. I've removed the headers & soldered 20ga directly to the nrf24l01 units after discovering an amazingly frustrating flaky-jumper issue.
  3. I'm using the identical pin configuration as noted in stanleyseow's example: arduino-nrf24l01/attiny84_mirf.ino at master · stanleyseow/arduino-nrf24l01 · GitHub
  4. like I said above, the pro mini units all behave nicely, so I'm not totally lost

My best guess right now is that I am doing something wrong with the SPI clock and/or PCE clock, and/or that I am doing something wonky with the CE/CSN pin mappings. It took me awhile to wrap my head around how the whole pin numbering/internal mapping actually work, and I might be wrong still. Anyway, I'm into some unknown territory and would really appreciate a nudge in the right direction. Thanks!

#include <SPI.h>
#include <SPI85.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>

void setup(){
  CLKPR = (1 << CLKPCE);
  CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);
  SPI.setClockDivider(SPI_CLOCK_DIV2);
  Mirf.cePin = 7;
  Mirf.csnPin = 3; 
  Mirf.spi = &MirfHardwareSpi;
  Mirf.init();
  Mirf.setRADDR((byte *)"serv1");
  Mirf.payload = sizeof(unsigned long);   
  Mirf.config();
}

void loop(){
  byte data[Mirf.payload];
  if(!Mirf.isSending() && Mirf.dataReady()){
    Mirf.getData(data);
    Mirf.setTADDR((byte *)"clie1");
    Mirf.send(data);
  }
}