NFR24L01 Brick Wall

Shout here if you need any help!
Maybe you need a plan - just shout
HowardSmith
Posts: 7
Joined: 28 Oct 2020, 09:02

NFR24L01 Brick Wall

Post by HowardSmith »

I've got very excited, seeing on this forum, the wonderful things people are doing with these modules. With some experience of Arduino it looked like I could embark on a number of exciting new flying projects. However I have run into a brick wall. Started rather grand but have now boiled it down to a bare bones sketch and still getting nowhere! For prototyping, I'm using two Arduino Unos with breakout adapters and NRL24L01 modules. From a wiring perspective things could not be much simpler.
Uno 13 = SCK on breakout adapter
Uno 12 = MISO on breakout adapter
Uno 11 = MOSI on breakout adapter
Uno 10 = CSW on breakout adapter
Uno 9 = CE on breakout adapter
Uno 3.3V = VCC on breakout adapter
Uno Gnd = GND on breakout adapter


The transmitter sketch sends Hello World and the Receiver sketch is supposed to output that to the Serial monitor. The addresses are the same but radio.available never becomes true.

RF24 library is from ManiacBug which seems to be highly regarded.

I've called radio.printDetails() to see what the TX module is doing and am seeing a load of zeros which suggests the problem resides on teh TX side.
Tx PrintDetails Screenshot.png
Here is the TX sketch

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include "printf.h"
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "80890";
void setup() {
Serial.begin(9600);
printf_begin();
printf("\n\rTest connection to modules\n\r");
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
radio.printDetails();
}
void loop() {
const char text[] = "Hello World";
radio.write(&text, sizeof(text));
Serial.println("Just sent Hello World");
delay(1000);
}

Here is the RX sketch

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "80890";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}
void loop() {
if (radio.available()) {
char text[32] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
}
else{
Serial.println("Nothing");
}
}
I'd welcome some help, can someone point me in the right direction? It might be me being really stupid, am I missing a key step or something?
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: NFR24L01 Brick Wall

Post by Martin »

Hi Howard, and welcome to the forum!

If you have the breakout adapters with the little voltage regulator (AMS1117 3.3) next to the VCC and GND pins, then you should be connecting VCC on the adapter to the 5V pin on the Arduino UNO, not its 3.3V pin.

I'll try setting up the same hardware here, in case that's not the only problem. I've got at least a couple of UNOs, and more nRF24L01+ and breakout adapters than I would care to count! :)
HowardSmith
Posts: 7
Joined: 28 Oct 2020, 09:02

Re: NFR24L01 Brick Wall

Post by HowardSmith »

Thanks so much Martin,

Ah yes the breakout board has a voltage regulator and some smoothing capacitors. I have swapped them over to the Uno 5 volt supply. It still does not work but I've moved forward which is a welcome change. The print details is not all zeroes and the PA Power has gone to high, despite it being set to minimum n the sketch.
TX Screenshot 2.png
Still nothing at the receiver end but PrintDetails shows the following
RX Screenshot.png
Thanks for the help, at this stage, it is very much appreciated.
WernerL
Posts: 27
Joined: 22 Jan 2020, 02:30

Re: NFR24L01 Brick Wall

Post by WernerL »

The COM5 screenshot is the TX and COM4 the RX?
Note that the data rate is set differently: COM5 says 2Mbps, COM4 1Mbps

good luck, Werner
HowardSmith
Posts: 7
Joined: 28 Oct 2020, 09:02

Re: NFR24L01 Brick Wall

Post by HowardSmith »

Hi Werner,

Yes TX is Com5 and Rx Com 4. Those data rates do look like a smoking gun! Although I bought them both from ebay, one reports to be an NFR24L01+ and the other a plain old NFR24L01. Looking at the net, it appears these can be run together, but you have to get the data rates identical (https://www.seeedstudio.com/blog/2019/1 ... ta%20rate.)

The NRF24L01+ is a newer version of the NRF24L01, capable of doing an extra 250kbps of on-air data rate while the one without “+” has only 1Mbps and 2Mbps.

Apart from that, they can both be considered as identical to one another

Both versions can be mixed together as long as 1 or 2 MBps is being used as the data rate.


Interestingly the RF24 documentation states it is not possible to change the data rate on the NFR24L01 unit, however I have changed it on the transmitter to 1Mbps to make them both match. Still nothing.
I'm a bit concerned that cyclic redundancy checks are being done at the receiver at 16 bits but is disabled on the transmitter; perhaps that is another thing which stops this working. However I've put radio.setCRCLength(RF24_CRC_16); into the TX code and it remains disabled. Tried it with a 8 bit parameter but got the same result. I'm going to assume for now that if a packet without a cyclic check bit in the header is received, the packet is processed anyway.

Interestingly I can control CRC Length programmatically on the NRF24L01+. On the NRF24L01 I can't change PA strength or CRC length. Perhaps these can't be set on the transmitter?

I'll do some experiments to see if anymore clues come to light.

Keep the help coming if possible, it's much appreciated
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: NFR24L01 Brick Wall

Post by Martin »

I modified your sketches very slightly (to get rid of the compiler warnings), and they're working for me now. Click on photos to embiggen.
nrf24s.jpg
Don't worry about the extra capacitors soldered on the modules - I put them on before I had the breakout adapter boards - and with those boards the extra caps aren't needed, as far as I know.
howard_test.jpg

Code: Select all

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include "printf.h"
RF24 radio(9, 10); // CE, CSN
#define address 80890

void setup() {
  Serial.begin(9600);
  printf_begin();
  printf("\n\rTest connection to modules\n\r");
  radio.begin();
  radio.openWritingPipe(address);
  radio.stopListening();
  radio.printDetails();
}

void loop() {
  const char text[] = "Hello, World!";
  radio.write(&text, strlen(text));
  Serial.print("Just sent ");
  Serial.println(text);
  delay(1000);
}

Code: Select all

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

RF24 radio(9, 10); // CE, CSN
#define address 80890

void setup() {
  Serial.begin(9600);
  printf_begin();
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.startListening();
  radio.printDetails();
}

void loop() {
  if (radio.available()) {
    char text[32] = "";
    radio.read(text, radio.getPayloadSize());
    Serial.println(text);
  } else {
    Serial.println("Nothing");
  }
  delay(500);
}
I think the main changes were using #define for the address, strlen() to get the write payload size, and radio.getPayloadSize() to get the read payload size.

I've got some of those RF-Nanos somewhere that came with fake nRF24L01+ chips that were actually the nonplussed type. I'll try it with one of those plus one of the real ones next.

Edit: Yes, it worked with that too. I tried it with both your transmitting and receiving sketches, keeping one of the Arduino UNOs with its '+' module for the other one. On the RF-Nano, I had to swap the 9 and 10 around to:

RF24 radio(10, 9); // CSN, CE

...because that's how they're (internally) connected on the RF-Nano boards. Other than that, no changes to either sketch - the library defaults to using the 1 MBPS data rate supported by the older type of chip, and you have call the radio.setDataRate(RF24_250KBPS); method if you want to change to the lower (250 kBPS) data rate only supported by the '+'. The radio.printDetails() thing shows this for the RF-Nano:

Code: Select all

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	 = 0x0000013bfa 0x4a49484746
RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR		 = 0xe7e7e7e7e7
RX_PW_P0-6	 = 0x20 0x02 0x00 0x00 0x00 0x00
EN_AA		 = 0x3f
EN_RXADDR	 = 0x03
RF_CH		 = 0x4c
RF_SETUP	 = 0x07
CONFIG		 = 0x0f
DYNPD/FEATURE	 = 0x00 0x00
Data Rate	 = 1MBPS
Model		 = nRF24L01
CRC Length	 = 16 bits
PA Power	 = PA_MAX
HowardSmith
Posts: 7
Joined: 28 Oct 2020, 09:02

Re: NFR24L01 Brick Wall

Post by HowardSmith »

Thanks Martin,

It's reassuring that it works for you. I've copied your sketches into my IDE's to use the defined address and strlen on the TX side but still get nothing. That got me wondering if it is a simple wiring issue.

Your photographs are really helpful. My breakout boards are pinned (with the sockets to the right): -
CE
CSN
SCK
MO
MI
IRQ
Is yours breakout adapter pinned the same as mine, if so, looking at your ribbon, it suggests you have it wired differently

CE = 9
CSN = 10
SCK = 11
MOSI = 12
MISO = 13

Can you just confirm?

I've ordered a couple of RF Nanos to try out, in case I have a bad pin or something.

Many thanks

Howard
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: NFR24L01 Brick Wall

Post by Martin »

Did you swap to radio.getPayloadSize() on the receive sketch?

My breakout boards are the same as yours. If you click on the photo to get the bigger version, you can, just about, see the pin labels on the one with the added orange capacitor. My little ribbon cables are plaited around at one end to get the connections right: with the bigger photo you can see the violet wire at the nRF24 end is twisted around to plug in next to the yellow wire. When you use the standard Arduino SPI library, SCK is always pin 13, MISO 12, and MOSI 11. One thing that catches people out is that MISO on the master connects to MISO on the slave - you don't have a crossover connection like you do with a TX / RX serial connection.

If you downloaded your RF24 library from somewhere, try temporarily renaming its folder, and then install the RF24 library you find in the Arduino IDE Library manager, when you type nRF24 into the search box. That way you might get a more recent, bug-fixed version. Some of the libraries you find on GitHub and elsewhere have been mangled for special use purposes - and it's not always obvious why.
HowardSmith
Posts: 7
Joined: 28 Oct 2020, 09:02

Re: NFR24L01 Brick Wall

Post by HowardSmith »

Thanks Martin,

I'll try that now. Fingers crossed.

All the best

Howard
HowardSmith
Posts: 7
Joined: 28 Oct 2020, 09:02

Re: NFR24L01 Brick Wall

Post by HowardSmith »

Hi Martin,

I started from scratch, deleted all reference to RF24.h in my Arduino libraries and the complied the code to check it failed when trying to include RF24L01.h, rf24.h and printf.h. That confirmed all traces of old libraries had gone. I then downloaded RF24-1.3.9 from the Arduino site (although it was linked to Github).

Uploaded the sketches, but still nothing coming through to the receiver. I looked at the print details but could not see anything obviously wrong, apart from one reporting to be NRF24L01 rather than NRF24L01+. A new module came through yesterday so I swapped it. To my amazement and relief I got a couple of Hello World's coming through the receiver and then it went back to reporting nothings again. I powered down the RX Arduino and now have a constant stream of Hello World's coming through my Serial Monitor. This is amazing, I can't wait to start building things from it. A bang, bang Madcap might be the first project or perhaps a radio DT.

Huge thanks to everyone for their help. Hope I can do the same for someone else in the future.

Howard
Post Reply