nRF24L01+ works first time

I tried few nRF24L01+ modules using several examples including basic one that came with the NRF library or that illustrated by several contributors. The modules only work the first time they are connected, after uploading a new program all modules fail at radio.begin() and all print details output zero info.
The power during different tries are either 2AA batteries or nRF24L01 mount (sold separately and more than one tried).
None of the modules seem to have apparent physical damage, hot etc or shorted between different pins (apologies this is my knowledge limit). During test all pins are connected firmly and correctly and simplest proof is that it does work fist time for any period of time.

I have added debug points to the NRF library and it appears write_register operations do not take effect.

The main questions I have are:

  • is it possible under a given settings programming arduino somehow corrupts the module firmware, and if so can it be recovered?
  • Is there a way to physically test the module for damage?

Thanks in advance.

You should show your wiring.

You should post your code.

a7

Code:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <stdio.h>
#include <printf.h>

#define CE_PIN 8
#define CSN_PIN 9

const byte slaveAddress[5] = { 'R', 'x', 'x', 'x', 'x' };

RF24 radio(CE_PIN, CSN_PIN);  // Create a Radio

char dataToSend[10] = "Message 0";
char txNum = '0';
bool radioResult = false;

long loopCounter = -1;

void setup() {

  Serial.begin(115200);
  radioResult = radio.begin();
  delay(50);
  radio.setAutoAck(false);
  bool radioType = radio.isPVariant();
  bool radioValid = radio.isValid();
  radio.setPALevel(RF24_PA_LOW);                //Also tried MIN.
  radio.openWritingPipe(slaveAddress);
  radio.stopListening();  // put radio in TX mode
  
  Serial.println("SimpleTx Starting");
  printf_begin();
  radio.printPrettyDetails();
  Serial.print("Radio Result: ");
  Serial.println(radioResult);
  Serial.print("nRF24L01 Variant: ");
  Serial.println(radioType);
  Serial.print("nRF24L01 is Valid: ");
  Serial.println(radioValid);
}

//====================

void loop() {
  loopCounter++;
  if (loopCounter > 100000) {  //tried micros, delay etc.
    send();
    loopCounter = -1;
  }
}

//====================

void send() {
  bool rslt;
  rslt = radio.write(&dataToSend, sizeof(dataToSend));

  Serial.print("Data Sent ");
  Serial.print(dataToSend);
  if (rslt) {
    Serial.println("  Acknowledge received");
    updateMessage();
  } else {
    Serial.println("  Tx failed");
  }
}

Sample Output:
22:26:10.518 -> Auto Retry Delay = 4000 microseconds
22:26:10.518 -> Auto Retry Attempts = 15 maximum
22:26:10.518 -> Packets lost on
22:26:10.518 -> current channel = 0
22:26:10.518 -> Retry attempts made for
22:26:10.518 -> last transmission = 0
22:26:10.550 -> Multicast = Allowed
22:26:10.550 -> Custom ACK Payload = Enabled
22:26:10.550 -> Dynamic Payloads = Enabled
22:26:10.550 -> Auto Acknowledgment = 0b111111
22:26:10.550 -> Primary Mode = TX
22:26:10.550 -> TX address = 0x0000000000
22:26:10.550 -> pipe 0 (closed) bound = 0x0000000000
22:26:10.550 -> pipe 1 (closed) bound = 0xffffffffff
22:26:10.550 -> pipe 2 (closed) bound = 0xff
22:26:10.550 -> pipe 3 (closed) bound = 0xff
22:26:10.550 -> pipe 4 (closed) bound = 0x00
22:26:10.550 -> pipe 5 (closed) bound = 0x00
22:26:10.550 -> Radio Result: 0
22:26:10.550 -> nRF24L01 Variant: 1
22:26:10.594 -> nRF24L01 is Valid: 1

I can't look closer at your code right now, but I do remember that the radio can get itself jammed, somehow.

A power cycle reset clears it up. This may explain your works once observation.


It still may mean you are placing it in that state inadvertently through something in the code.

As for your questions, no and no.

Although it can get confused, you can't harm the moduke firmware and there is no reflashing or reprogramming that I know of.

And aside from seeing obvious damage, the only test available is to go back to a circuit you did not mess with and code you did not alter form examples taken from tutorials or other explainers. And see if a pair of radios works.

Did you build a pair of these and see them work just slavishly following every step of a legitimate tutorial? There are quite a few, all hammer at some essential points. among which find themselves

  • use adequate power and a filter capacitor of some good size
  • separate the two Arduino+NRF24L01 units by a few meters at least

a7

Several Tutorials were tried in their basic layout and code. That code has undergone several modifications to replace functions or change their order (e.g. add Serial.begin(xxx) before or after or introduce delays ets) and introduce debug points in the RF24 library itself to track the probelm with no give. Both receiever and transmitter functions where tried separately and fail at the first upload, and as readio.begin() fails there is not much TX/ RX test I can follow with.

I may try a capacitor even though these are 18650 batteries with ample power and I believe are very stable.

Regards.

I assume you mean with success. If not, working on anything more is frutile.

So… post the example sketch or pair of the code is not identical on the two Arduino + radio module instances.

The one or ones that worked proving you have good modules and power and so forth.

Post a link to the tutorial or website from which the circuit and code were taken.

a7

I highly appreciate your help and I am listing some of the examples below. that said, I don't think this is a code or connection issue.

Example

Example

There is also another example by (if I recall correctly) Robin somehwere on this forum.

Note, these were just starting points but I shuffled code around more than I can remember after I encountered the failure but with no luck.

Regards.

You haven't said you ever saw the radio set performing to specifications.

So do, say that, and post the actual code and schematic you used when you enjoyed that success.

If you have never seen the radio set work, stop making changes and additions and work on getting the "hello world!" to work. Again, code you did not mess with and a schematic you followed to the letter.A link to the tutorial woukd be nice.

a7

Code whether original or modified works if already loaded on the Arduino. Once I upload a change whilst the module is connected or possibly restart the power to the module (and arduino) radio.begin fails. This is no an isolated case but 3 modules thus far endured this problem.

Regards

To it is still not clear

Did you use an example-code and sending/receiving did successfully work?

If yes:

  • just a first single send/receive and then nothing more?
  • testing some days ago it worked now nothing works anymore regardless of which code you use?

What is this nrf24 mount thing?

Did you measure the voltage that is present between GND und 3.3V of the nrf24-module?
If yes what voltage do you measure?

I got nothing. Without seeing the code you claim works that you did not mess with there's not much to say.

If a hard reset of the module (power cycle) doesn't make it work again, that is a mystery. Sry.

a7

This may be the key to the problem. The Arduino and the nRF do not both reset when the Arduino is reset or only the Arduino power is removed. Remove power to BOTH devices and power them both at the same time. See if that helps. Or if not possible, remove power to the nRF and Arduino and power the nRF first and then the Arduino.

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