I'm hoping someone can help me since I've been struggling with this all weekend. I've got 2 nRF24L01+ breakout cards and I'm trying to send data from a ATTiny85 to a Raspberry Pi 3.

My setup is (the attiny85 breadboard has a 3.3V power supply):



And the code I'm testing is for the ATTiny85:

#define CE_PIN 3
#define CSN_PIN 4

#include "RF24.h"

RF24 radio(CE_PIN, CSN_PIN);

const byte addr[6] = "00001";
int count = 0;

void setup() {

void loop(void){
  radio.write( &count, sizeof(count) );

And for the Raspberry Pi 3:

#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>
#include <unistd.h>
#include <RF24/RF24.h>

using namespace std;

// Setup for GPIO 22 CE and CE0 CSN with SPI Speed @ 8Mhz
RF24 radio(RPI_V2_GPIO_P1_22, RPI_V2_GPIO_P1_24, BCM2835_SPI_SPEED_8MHZ);

// Radio pipe addresses for the 2 nodes to communicate.
const uint8_t addr[6] = "00001";

int main(int argc, char** argv){
  radio.openReadingPipe(1, addr);

  // Dump the configuration of the rf unit for debugging

  int count = 0;

  while (1)
    while ( radio.available() )
      radio.read( &count, sizeof(count) );
      printf("Count: %d\n", count);

  return 0;
  • Double check MISO/MOSI on ATtiny. They are DO and DI not MISO and MOSI (which are used when programming). – Mikael Patel Nov 20 '16 at 20:26
  • Double check what about them? As far as I understand, the RF24 library supports the attiny's USI for SPI – Jeff Williams Nov 21 '16 at 8:26
  • You might have got the wiring wrong; NRF24/MISO => ATtiny85/DI (Pin 5), MOSI => DO (Pin 6). – Mikael Patel Nov 21 '16 at 9:19
  • @MikaelPatel thanks! That looks like it could be the problem. I have been going off the chip pinout from the datasheet (MOSI pin 5, MISO to pin 6). However, I see now that tmrh20.github.io/RF24/ATTiny.html has them listed the other way around, like you say. I'll test when I get home tonight. – Jeff Williams Nov 21 '16 at 14:16
  • Yes, USI uses DO(utput) and DI(nput). The MISO/MOSI are for programming only. – Mikael Patel Nov 21 '16 at 14:59

As Mikael Patel pointed out, my MOSI and MISO pins were switched.

On the pinout for the ATtiny85, the MOSI and MISO pins are for when the chip is a slave (i.e. programming). DO and DI and used for output as SPI master.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.