NRF24 receiving garbage

I am having some difficulties using the example from here: Simple nRF24L01+ 2.4GHz transceiver demo

I am using two Nanos, I have Capacitors on both nRF boards, both boards are being power with a 9v (stepped down to 3V) 1000mA power supply. I have individual power adapters on order.

The CheckConnection program appears to return correct information.

AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1
 and 250KBPS data rate

STATUS           = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1     = 0x0000000024 0xc003000000
RX_ADDR_P2-5     = 0x78 0x60 0x00 0x8a
TX_ADDR          = 0x00c083cfe7
RX_PW_P0-6       = 0xe0 0x3c 0x00 0x30 0x78 0x30
EN_AA            = 0x49
EN_RXADDR        = 0x00
RF_CH            = 0x00
RF_SETUP         = 0x30
CONFIG           = 0x60
DYNPD/FEATURE    = 0x60 0x00
Data Rate        = 2MBPS
Model            = nRF24L01+
CRC Length       = Disabled
PA Power         = PA_MAX

Transmitter side serial window:

SimpleTx Starting
Data Sent Message 0  Acknowledge received
Data Sent Message 1  Acknowledge received
Data Sent Message 2  Acknowledge received
Data Sent Message 3  Acknowledge received

Receiver Side serial window

SimpleRx Starting
Data received 10   -
Data received 10   -
Data received 10   -
Data received 10   -   @@@@
Data received 10   -
Data received 10   -
Data received 10   -   ▒fd~p```sR
Data received 10   -
Data received 10   -   @@
Data received 10

The system appears to be working, the receiver gets the 10 characters transmitted, the transmitter receives an acknowledgement but the data "Message 0" is corrupt.

I have read through most of the message dealing with this issue but they don't appear to be the same. The only thing that appears to be happening and i cant track the issue down is that the DataRate appears to be changing on its own.

Any diections someone can point me in?

Thanks

@Robin2 wrote

may be worth testing some other demo code

I had this working a while back (part of the code in French)

SENDER CODE

// EMETTEUR (SENDER CODE)
#include <RF24.h> // https://nrf24.github.io/RF24/

const byte CEPin = 8;
const byte CSNPin = 7;
RF24 radio(CEPin, CSNPin);

uint8_t adresse[] = {0xCC, 0xCE, 0xCC, 0xCE, 0xCC};

struct __attribute__ ((packed)) t_message {
  uint8_t payload;
} message;

void envoyerMessage(t_message &msg)
{
  if (!radio.write( &msg, sizeof(t_message) )) Serial.println(F("erreur d'envoi"));
  else Serial.print((char) message.payload);
}

void setup() {
  Serial.begin(115200);

  if (!radio.begin()) {
    Serial.println(F("radio absente!!"));
    while (true) ; // erreur
  }

  radio.setPALevel(RF24_PA_LOW);
  radio.setPayloadSize(sizeof(t_message));
  radio.openWritingPipe(adresse);
  radio.stopListening();
  Serial.println(F("**** ÉMETTEUR PRET ****"));
}

void loop() {
  int recu = Serial.read();
  if (recu != -1) { // -1 veut dire aucun caractèr ereçu
    message.payload = recu; 
    envoyerMessage(message);
  }
}

and RECEIVER

// RECEPTEUR (RECEIVER CODE)
#include <RF24.h> // https://nrf24.github.io/RF24/

const byte CEPin = 8;
const byte CSNPin = 7;
RF24 radio(CEPin, CSNPin);

uint8_t adresse[] = {0xCC, 0xCE, 0xCC, 0xCE, 0xCC};

struct __attribute__ ((packed)) t_message {
  uint8_t payload;
} message;

boolean ecouterRadio(t_message & msg)
{
  boolean messageRecu = false;
  if (radio.available()) {
    radio.read( &msg, sizeof(t_message));  // on lit le message
    messageRecu = true;
  }
  return messageRecu;
}

void setup() {
  Serial.begin(115200);

  if (!radio.begin()) {
    Serial.println(F("radio absente!!"));
    while (true) ; // erreur
  }

  radio.setPALevel(RF24_PA_LOW);
  radio.setPayloadSize(sizeof(t_message));
  radio.openReadingPipe(1, adresse);
  radio.startListening();
  Serial.println(F("**** RECEPTEUR PRET ****"));
}

void loop() {
  if (ecouterRadio(message)) Serial.print((char) message.payload);
}

does it work ?

I just got your demo working and transmitting with an acknowledgement using version 1.4.8. i think it was a bad ground cable joining my nRF power supply to my Nano.

Thanks

cool

It was cool, for a while. :slight_smile:

I transferred the receiving side over to a Mega2560 and it will not work there. It does not seem to save the Power or Data Rates

Using pins
SCK - 52
MISO - 50
MOSI - 51
CE - 7
CSN - 8

I even ohmed out all cables again.

AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1
 and 250KBPS data rate

SPI Speedz      = 10 Mhz
                        STATUS          = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1    = 0x0000000070 0x0000000070
RX_ADDR_P2-5    = 0x38 0xc4 0x1c 0xc6
TX_ADDR         = 0xe7e7e7e7e7
RX_PW_P0-6      = 0x20 0x20 0x20 0x38 0x38 0x1c
EN_AA           = 0x3f
EN_RXADDR       = 0x03
RF_CH           = 0x38
RF_SETUP        = 0x1c
CONFIG          = 0x0e
DYNPD/FEATURE   = 0x38 0x38
**Data Rate       = 2 MBPS**
Model           = nRF24L01+
CRC Length      = 16 bits
**PA Power        = PA_HIGH**
ARC             = 0

Any more ideas?

Thanks

If you are using the Arduino as a power supply for the 3V3 that is problematic. Use an external 3.3 power source. You can use one for both units if you want.

Nope, using an external 3.3v setup same with the nano. I switched back from the mega to the nano and the code still works.

can you post a hand drawn schematic of how things are wired and powered on both sides?

1 Like

The NANO programs the radio consistantly but the Mega doesn't.

    radio.setDataRate( RF24_250KBPS );
    radio.setPALevel( RF24_PA_MIN );
Data Rate       = 2 MBPS
Model           = nRF24L01+
CRC Length      = 8 bits
PA Power        = PA_HIGH

I have another Mega on order but it will still be a couple of days.

Just for sake of testing, try switching CE on the Mega to pin 53 instead of 7

You can try calling RF24 radio(CEPin, CSNPin, 2000000);

This lowers the SPI speed, so if you have long connecting wires, the SPI data won't get corrupted.

I tried both options, one and a time and together. The radio still wont program or return the correct data rate. I got my second Mega today, same issue. No issues using the nRF with the Nano which is driving me even crazier.

Just now swapped back to the Nano and still works, even went own to 1000000 for a spi speed

Problem solved! For me when using the Mega boards the nRF board needs 5V instead of 3.3V for power. I found a reference to this in nRF24L01 Communication between Mega and Uno - #19 by lekcha and as soon as i applied 5V to the nRF module it worked no issue.

There must be some voltage issue possible with the nRF being powered at 3.3V pulling down the Arduino SPI pins. I wish i had a scope to verify this.

Thanks all, now i can progress. :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.