Electronics > Projects, Designs, and Technical Stuff

Setting Up the nRF24L01 for Transmitting, and Receiving

(1/6) > >>

Kalcifer:
I have one of those nRF24L01 ~2.4GHz transmitter modules, as seen here:
http://www.hobbyandyou.com/content/images/thumbs/0002081_nrf24l01-24ghz-wireless-transceiver-module-for-arduino.jpeg.
I have been having some trouble getting it to work (data not being received), so I wanted to make sure that I am, at least, using the right method for configuring the device(s) for use; I want to make sure that I am understanding the datasheet correctly. So, my setup is as follows:

Receiver:
1. Enter RX mode by setting the PWR_UP bit and the PRIM_RX bit, and bringing the CE pin logic high.
2. Default receive address is used at data pipe 0: 0xE7E7E7E7E7
2. Ensure that the data pipe 0 (using the default address that is used at reset) is enabled to receive 1 byte by writing 1 to RX_PW_P0.

Transmitter:
1. Go into standby-2 mode to wait for transmit data by setting the PWR_UP bit, clearing the PRIM_RX bit, and bringing the CE pin logic high.
2. Default transmit address at reset is used: 0xE7E7E7E7E7

Transmission:
1. Write a byte of data to the transmit payload with 0b00000001 written to W_TX_PAYLOAD
2. from my understanding, this should automatically start the transmission of data
3. read the received data by reading from R_RX_PAYLOAD

Please let me know if my configuration and usage method is correct.

Thank you.

Doctorandus_P:
My sincerest advise is tho throw the thing in the garbage bin and buy some better hardware.

Years ago I bought a bunch of these things and wrote a driver library from a collection of a bunch of giants before me, but mostly from reading the datasheet about 20 times.
The nRF24L01+ is another chip from the incompatible nRF24L01, and I found the whole thing just horrible.
The designer of that chip had some very distorted ideas of what is useful in such a chip and what is not. They have some "6 pipe" model, which is either not enough or too much, and either way you have to find a way to work around it. It's doing a bunch of buffering and it's very hard to determine what is buffered where and when. I've had the thing lock up, and then after a complete power cyle have it receive messages from before the power cycle. The way their internal synchronization works is very yucky.

I had a short moment to light my interest when I noticed that it had some signal strength measurement, but it's implemented so badly that it's completely useless.

And on top of that. There are some clones on the market and these have some bugs and / or incompatibilities, so you never know what you're working with.

So pay 50ct or a euro more for some other RF breakout board that has some decent hardware on it.

The HopeRF RFM95 and RFM96 are probably much better chips. But probably anything is better than the nRF24 horror.
If you're lucky you can get some "arduino" lib for it to work in 10 minutes or so, but that's because someone else has been banging their heads to the wall for days before you.

Kalcifer:

--- Quote from: Doctorandus_P on May 11, 2021, 07:58:30 pm ---My sincerest advise is tho throw the thing in the garbage bin and buy some better hardware.

--- End quote ---
Perhaps something like an ESP8266 would be good. Those are decently popular it seems. Although, I have looked into it before, and I'm not entirely sure how to go about programming them.


--- Quote from: Doctorandus_P on May 11, 2021, 07:58:30 pm ---The HopeRF RFM95 and RFM96 are probably much better chips. But probably anything is better than the nRF24 horror.
If you're lucky you can get some "arduino" lib for it to work in 10 minutes or so, but that's because someone else has been banging their heads to the wall for days before you.

--- End quote ---
I don't have HopeRF chips but I do have a couple of those Semtech SX1278 LoRa module things lying around which seem to be similar in idea to the chips that you mentioned.

MarkF:
Here is the general flow I use.  I have the 'Plus' modules.
There is an Arduino library for the nRF24L01+ (RF24 lib)


// CHANGES TO POWER-ON DEFAULTS:
nRF_CONFIG (00h)     = nRF_CRC1|nRF_PwrDn|nRF_PRX (09h)
nRF_SETUP_RETR (04h) = (ARD=500us, ARC=3 retries) (13h)
nRF_RF_SETUP (06h)   = nRF_1Mbps|nRF_PWR0 (06h)


// RECEIVER SETUP:
nRF_RX_ADDR_P0 (0Ah) = (E7E7E7E7E7h)
nRF_RX_ADDR_P1 (0Bh) = (C2C2C2C2C2h)
nRF_TX_ADDR (10h)    = (E7E7E7E7E7h)
nRF_RX_PW_P0 (11h)   = 8
nRF_RX_PW_P1 (12h)   = 8
// Start listening: Power-up and Receive mode
nRF_CONFIG (00h) = nRF_CRC1|nRF_PwrUp|nRF_PRX (0Bh)
delay_us(130)
// Set CE high
CEpin = 1
// Read FIFO status
while ((nFIFO_STATUS & 0x03) != 1) {
   // read payload, nRF_RD_RX_PL (61h)
}


// TRANSMITER SETUP:
nRF_RX_ADDR_P0 (0Ah) = (C2C2C2C2C2h)
nRF_RX_ADDR_P1 (0Bh) = (E7E7E7E7E7h)
nRF_TX_ADDR (10h)    = (C2C2C2C2C2h)
nRF_RX_PW_P0 (11h)   = 8
nRF_RX_PW_P1 (12h)   = 8
// Write payload: Power-up and Transmit mode
nRF_CONFIG (00h) = nRF_CRC1|nRF_PwrUp|nRF_PTX (0Ah)
delay_us(150)
for (int i=0;i<8;i++) {
   // write payload, nRF_WR_TX_PL (A0h)
}
// Strobe CE
CEpin = 1
delay_us(16)
CEpin = 0

SiliconWizard:
I've used the nRF24L01+ chip a few years ago, and I don't remember how close to the nRF24L01 it is, nor if your module doesn't actually contain a nRF24L01+, which I'm suspecting.

Anyway, from what I remember, what MarkF showed looks correct to me. If you have any further problem, I may have to take a closer look at my project to give possible additional info.


Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod