NRF24 not sending data

I've got a setup going with a arduino uno, and a nano, and it's been working fine before, but I turned it on a few days ago and after some testing I found that the nano stopped sending data (receives data fine from what I could tell using the GettingStarted_CallResponse sketch). The wiring is fine as far as I can tell as it is the same as many examples, which work on my uno. I output the radio data and am not sure what it all means. Obviously all the 0's are not good, but I'm not sure how to fix it.

STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1 = 0x0000000000 0x0000000000
RX_ADDR_P2-5 = 0x00 0x00 0x00 0x00
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x00
RF_CH = 0x00
RF_SETUP = 0x00
CONFIG = 0x00
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN

Here's the Transmitter Code:

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

int lxpin = 2;
int lypin = 3;
int rxpin = 0;
int rypin = 1;

double lx = 0;
double ly = 0;
double rx = 0;
double ry = 0;

int left_bumper = 0;
int right_bumper = 0;
int blue = 0;
int red = 0;
int yellow = 0;
int green = 0;

RF24 radio(8,9);

const uint64_t pipe = 0xE6E6E6E6E6E6; // Needs to be the same for communicating between 2 NRF24L01

float data[10];

void setup() {
  Serial.begin(9600);
  radio.begin();

  printf_begin();

  radio.openWritingPipe(pipe);
  radio.stopListening();

  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
  pinMode(6, INPUT_PULLUP);
  pinMode(18, INPUT_PULLUP);
  pinMode(19, INPUT_PULLUP);
  pinMode(9, INPUT_PULLUP);
  radio.printDetails();
}

void loop() {

  lx = -mapJoystick(analogRead(lxpin));
  ly = mapJoystick(analogRead(lypin));
  rx = mapJoystick(analogRead(rxpin));
  ry = -mapJoystick(analogRead(rypin));

  left_bumper = digitalRead(4);
  right_bumper = digitalRead(9);
  blue = digitalRead(5);
  red = digitalRead(18);
  green = digitalRead(19);
  yellow = digitalRead(6);

  data[0] = lx;
  data[1] = ly;
  data[2] = rx;
  data[3] = ry;
  data[4] = left_bumper;
  data[5] = right_bumper;
  data[6] = blue;
  data[7] = red;
  data[8] = green;
  data[9] = yellow;

  radio.write(&data, sizeof(data));   
}

float mapJoystick(int value) {
  return fmap(value, 0, 1023, -1, 1);
}

float fmap(float x, float a, float b, float c, float d){
  return x/(b-a)*(d-c)+c;
}

(I omitted the sensor outputs for readability)

When running the GettingStarted_CallResponse sketch, the transmitter says it failed to send, but if I switch the programs on my uno and nano it works fine. So to summarize my problem, I think that the nano is not working right while sending data, but I cannot see why.

Just to be clear. This was working, and without any changes, has stopped working. Is that correct ?

If that is the case, I can think of two things:

  1. A component failure
  2. You are powering one of the NRF24L01 modules through the Nano's 3.3v pin, but are now not using the USB socket to power the Nano.

Edit:
The Nano's 3.3v is derived from the USB chip and is not adequate to power the NRF24L01.

Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to.

A common problem with nRF24 modules is insufficient 3.3v current from the Arduino 3.3v pin. This seems to be a particular problem with the nano. The high-power nRF24s (with the external antenna) will definitely need an external power supply. At least for testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

...R

6v6gt:
Just to be clear. This was working, and without any changes, has stopped working. Is that correct ?

If that is the case, I can think of two things:

  1. A component failure
  2. You are powering one of the NRF24L01 modules through the Nano's 3.3v pin, but are now not using the USB socket to power the Nano.

Edit:
The Nano's 3.3v is derived from the USB chip and is not adequate to power the NRF24L01.

Yes it had been working but now has stopped.

Well component failure is not it, because i tested the setup with 2 other nRF24's and the exact same thing happened so I don't think that is is, but I am using the USB for debugging. Will it burn up the nRF24 to put it in the 5v?

quantum357:
but I am using the USB for debugging. Will it burn up the nRF24 to put it in the 5v?

As you have not provided a wiring diagram I don't understand what you had in mind when you wrote that question.

The maximum voltage on the nRF24 power pin is 3.6v. The data pins can work with 5v signals.

...R

Robin2:
As you have not provided a wiring diagram I don't understand what you had in mind when you wrote that question.

The maximum voltage on the nRF24 power pin is 3.6v. The data pins can work with 5v signals.

...R

Sorry, I misread the original message earlier. I am powering it with USB so I suppose that its not a power issue. I'm wiring it the same way as you showed in your tutorial, and I used the same code, but neither my Uno or Nano are having any success. I believe I have the right library (TMRh20 version of the RF24) but it still isn't working. I'm very confused why, as it was working a week ago. Is there a program I can use to test if a component is physically working? Thanks for your help and patience.

You can put your fingers on the Nano carefully, and feel if it's getting really hot. :slight_smile: Is it a genuine Nano, or a clone? I ask not to determine brand loyalty, but because the 3.3V voltage regulator may be different.

quantum357:
Sorry, I misread the original message earlier. I am powering it with USB so I suppose that its not a power issue. I'm wiring it the same way as you showed in your tutorial, and I used the same code,

The code in your Original Post is not from my Tutorial.

Have you tried the connection test program from my Tutorial with both of your Arduinos? If that does not give the correct result nothing will work.

When the connection test works try the first example from my Tutorial.

...R

Connection Test Results

Nano:

CheckConnection Starting

FIRST WITH THE DEFAULT ADDRESSES after power on
  Note that RF24 does NOT reset when Arduino resets - only when power is removed
  If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
     communicating with the nRF24

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	 = 0x4141417852 0x4141417852
RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR		 = 0x4141417852
RX_PW_P0-6	 = 0x20 0x20 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


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	 = 0x4141417852 0x4141417852
RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR		 = 0x4141417852
RX_PW_P0-6	 = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA		 = 0x3f
EN_RXADDR	 = 0x03
RF_CH		 = 0x4c
RF_SETUP	 = 0x27
CONFIG		 = 0x0e
DYNPD/FEATURE	 = 0x00 0x00
Data Rate	 = 250KBPS
Model		 = nRF24L01+
CRC Length	 = 16 bits
PA Power	 = PA_MAX

Uno:

CheckConnection Starting

FIRST WITH THE DEFAULT ADDRESSES after power on
  Note that RF24 does NOT reset when Arduino resets - only when power is removed
  If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
     communicating with the nRF24

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	 = 0x0808080808 0x0808080808
RX_ADDR_P2-5	 = 0x08 0x08 0x08 0x08
TX_ADDR		 = 0x0808080808
RX_PW_P0-6	 = 0x08 0x08 0x08 0x08 0x08 0x08
EN_AA		 = 0x08
EN_RXADDR	 = 0x08
RF_CH		 = 0x08
RF_SETUP	 = 0x08
CONFIG		 = 0x08
DYNPD/FEATURE	 = 0x08 0x08
Data Rate	 = 2MBPS
Model		 = nRF24L01
CRC Length	 = 8 bits
PA Power	 = PA_MIN


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	 = 0x0808080808 0x0808080808
RX_ADDR_P2-5	 = 0x08 0x08 0x08 0x08
TX_ADDR		 = 0x0808080808
RX_PW_P0-6	 = 0x08 0x08 0x08 0x08 0x08 0x08
EN_AA		 = 0x08
EN_RXADDR	 = 0x08
RF_CH		 = 0x08
RF_SETUP	 = 0x08
CONFIG		 = 0x08
DYNPD/FEATURE	 = 0x08 0x08
Data Rate	 = 2MBPS
Model		 = nRF24L01
CRC Length	 = 8 bits
PA Power	 = PA_MIN

I think those look fine (questioning the Uno, but as it's not 0x00 I suppose it's OK)
Sorry for the confusion in your last post, I the code I posted was mine, but then I switched to yours but still got the same results.

I reran your test code, but still received tx failed from both. Assuming the previous test returned fine, then what area would the error lie in? The previous test (given that they work fine) eliminates wiring/hardware issues, right? And If I'm using your code, then It's not an error in the code. Would it be the library?

The Uno connection test is not showing the correct result. It should be setting the data rate to 250KBPS

...R

Ahhh, ok, so I switched out the nRF24 and got good results:

CheckConnection Starting

FIRST WITH THE DEFAULT ADDRESSES after power on
  Note that RF24 does NOT reset when Arduino resets - only when power is removed
  If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
     communicating with the nRF24

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 = 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


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 = 0xe7e7e7e7e7 0x4141417852
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x00 0x20 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x27
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX

I uploaded my old code and it worked again! Thank you for all your help!