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 Reply Children
No Data
Related