This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Communication nrf24LE1 and nrf24L01+

I'm trying to accomplish a communication from the nrf24LE1 to the nrf24L01+. The nrf24L01+ is hooked up to an Arduino UNO. The nrf24LE1 is flashed with the "enhanced_shockburst_ptx_nrf24le1.hex" from the nRFgo SDK V2.3.0.10040. On the Spectrum Analyzer I can see a peak on 2.402Ghz from the nrf24LE1.

The issue is that I can't receive the data packets from the nrf24LE1 on the nrf24L01+. I've written a simple sketch but it seems that it doesn't work. Anyone any Idea what I've missed? I always get 0x0E in the STATUS register of the nrf24L01+

#include <SPI.h>

#define CE  7
#define CSN 8

#define R_REGISTER 0b00000000
#define W_REGISTER 0b00100000

#define CONFIG 0x00
#define CONFIG_MASK_RX_DR 0x01<<6
#define CONFIG_MASK_TX_DS 0x01<<5
#define CONFIG_MASK_MAX_RT 0x01<<4
#define CONFIG_EN_CRC 0x01<<3
#define CONFIG_CRCO 0x01<<2
#define CONFIG_PWR_UP 0x01<<1
#define CONFIG_PRIM_RX 0x01<<0

#define STATUS 0x07
#define STATUS_RX_DR 0x01<<6
#define STATUS_TX_DS 0x01<<5
#define STATUS_MAX_RT 0x01<<4
#define STATUS_TX_FULL 0x01<<0

#define RX_PW_P0 0x11

void write_register(byte address, byte data) {
  digitalWrite(CSN, 0);
  SPI.transfer(W_REGISTER | address);
  SPI.transfer(data);
  digitalWrite(CSN, 1);
}

byte read_register(byte address) {
  byte reply;
  digitalWrite(CSN, 0);
  SPI.transfer(R_REGISTER | address);
  reply = SPI.transfer(0);
  digitalWrite(CSN, 1);
  return reply;
}

void setup() {
  pinMode(CE, OUTPUT);
  pinMode(CSN, OUTPUT);

  digitalWrite(CE, 0);
  digitalWrite(CSN, 1);
  
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);

  Serial.begin(115200);

  // Activate RX mode
  write_register(CONFIG, read_register(CONFIG) | CONFIG_PRIM_RX);

  // Set Payload to 3 Bytes
  write_register(RX_PW_P0, 3);
  
  // PWR_UP
  write_register(CONFIG, read_register(CONFIG) | CONFIG_PWR_UP);

  // Activate Receiver
  digitalWrite(CE, 1);
}

void loop() {
  if( read_register(0x07) & 0x40 ) {
    Serial.println("Received Data!!");
    write_register(0x07, read_register(0x07) | 0x40);
  } else {
    Serial.println("No data!");
    Serial.println("Status: ");
    Serial.println( read_register(0x07), HEX);
  }
  delay(1000);
}
Parents
  • @berkutta, did you ever get this working? I'm trying the same, using the RF24 library on the arduino, but to no avail. Arduino code and nRF24L01+ config data below:

    #include <SPI.h>
    #include "RF24.h"
    
    
    #define CE_PIN 7
    #define CSN_PIN 8
    RF24 radio(CE_PIN, CSN_PIN);
    
    const uint64_t pipe = 0xA7A7A7A7A7A7LL;
    
    unsigned long payload[] = {0,0,0,0};
    
    // divert stdout to serial. from reza.net/.../
    int my_putc( char c, FILE *t) {
      Serial.write( c );
    }
    
    // channel, pipe, address, data rate, crc?
    void setup() {
    
      Serial.begin(115200); // PC <--> Arduino serial communication
      fdevopen( &my_putc, 0); // route stdout to serial
      radio.begin(); // Start up the radio
      Serial.println("Power up status:");
      radio.printDetails(); // print verbose details of initial state of device.
      radio.setChannel(0x02); // 0x02 is the default channel for the nRF24LE1 (reset value) but 0x4c appears to be the default for the nRF24L01+ (see data dump).
      radio.setDataRate( RF24_1MBPS);
      radio.setCRCLength(RF24_CRC_8);
      bool pv = radio.isPVariant(); // if true, this is an nRF24L01+, not nRF24L01.
      radio.setAutoAck(1); // Ensure autoACK is enabled
      radio.setRetries(15,15); // Max delay between retries & max number of retries
      radio.setPayloadSize (3); // don't know if this is needed for the receiver.
      radio.openReadingPipe(1, address); // should we use pipe 0?
      Serial.println("After setup status:");
      radio.printDetails(); // print verbose details after setup.
      radio.startListening();
    }
    
    void loop(void){
      if (radio.available()) {
        radio.read( &payload, sizeof(unsigned long) );
        if(payload != 0){
          Serial.print("Got Payload ");
        }
      } 
      delay(10);
    }
    

    The output, before setting values:

    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0xc2c2c2c2c2
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0xe7e7e7e7e7
    RX_PW_P0-6	 = 0x00 0x00 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x4c
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0e
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 16 bits
    PA Power	 = PA_MAX
    

    after setting values:

    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0xa7a7a7a7a7
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0xe7e7e7e7e7
    RX_PW_P0-6	 = 0x00 0x03 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x4c
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0a
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 8 bits
    PA Power	 = PA_MAX
    
Reply
  • @berkutta, did you ever get this working? I'm trying the same, using the RF24 library on the arduino, but to no avail. Arduino code and nRF24L01+ config data below:

    #include <SPI.h>
    #include "RF24.h"
    
    
    #define CE_PIN 7
    #define CSN_PIN 8
    RF24 radio(CE_PIN, CSN_PIN);
    
    const uint64_t pipe = 0xA7A7A7A7A7A7LL;
    
    unsigned long payload[] = {0,0,0,0};
    
    // divert stdout to serial. from reza.net/.../
    int my_putc( char c, FILE *t) {
      Serial.write( c );
    }
    
    // channel, pipe, address, data rate, crc?
    void setup() {
    
      Serial.begin(115200); // PC <--> Arduino serial communication
      fdevopen( &my_putc, 0); // route stdout to serial
      radio.begin(); // Start up the radio
      Serial.println("Power up status:");
      radio.printDetails(); // print verbose details of initial state of device.
      radio.setChannel(0x02); // 0x02 is the default channel for the nRF24LE1 (reset value) but 0x4c appears to be the default for the nRF24L01+ (see data dump).
      radio.setDataRate( RF24_1MBPS);
      radio.setCRCLength(RF24_CRC_8);
      bool pv = radio.isPVariant(); // if true, this is an nRF24L01+, not nRF24L01.
      radio.setAutoAck(1); // Ensure autoACK is enabled
      radio.setRetries(15,15); // Max delay between retries & max number of retries
      radio.setPayloadSize (3); // don't know if this is needed for the receiver.
      radio.openReadingPipe(1, address); // should we use pipe 0?
      Serial.println("After setup status:");
      radio.printDetails(); // print verbose details after setup.
      radio.startListening();
    }
    
    void loop(void){
      if (radio.available()) {
        radio.read( &payload, sizeof(unsigned long) );
        if(payload != 0){
          Serial.print("Got Payload ");
        }
      } 
      delay(10);
    }
    

    The output, before setting values:

    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0xc2c2c2c2c2
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0xe7e7e7e7e7
    RX_PW_P0-6	 = 0x00 0x00 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x4c
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0e
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 16 bits
    PA Power	 = PA_MAX
    

    after setting values:

    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0xa7a7a7a7a7
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0xe7e7e7e7e7
    RX_PW_P0-6	 = 0x00 0x03 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x4c
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0a
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 8 bits
    PA Power	 = PA_MAX
    
Children
No Data
Related