9

I am looking through the example code found here. I know there are 6 pipes that the nRF24L01 module can use but I've been searching the internet for the address designations and have been able to find nothing. More specifically on line 37, is there a reference for where the author is getting 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL?

Thanks.

  • 1
    Have you looked at the datasheet for the radio IC? That certainly has more information about pipe addresses. – user588 Jun 15 '14 at 19:45
  • 1
    Check RF24 API doc for openReadingPipe() here: maniacbug.github.io/RF24/… it mentions you can use any values for the last address byte. – jfpoilpret Jun 16 '14 at 5:05
  • So I looked through the documentation but it doesn't mention how the pipe address is chosen. It just say they should share the first 32 bits. For example 0xF0F0F0F0(XX), does 0x count as a byte? Or is F0F0F0F0 the 32 bits that matter? Also, does it matter if it's not F0F0F0F0 as long as the pipes share those 32 bits? How about the last two significant bytes (XX)? Are those arbitrary as well? – Alex H Jun 19 '14 at 4:27
  • The 0x... prefix is just to tell the value is in hexadecimal. This is because 99 in decimal is different from 99 in hexadecimal, even though they look the same. So instead we use 0x99. – Gerben Jun 21 '14 at 12:34
  • 2
    The code you a using only supports 1 pipe. The nRF24L01 has 2 unique pipes (0 and 1). It also has 4 additional pipes (2, 3, 4 and 5), where you can only set the least-significant-byte. The other bytes will be the same as the second pipe (1). – Gerben Jun 21 '14 at 12:39
5

As most of the people have posted, the values for the pipe are arbitrary, but must follow the rules per the API:

Pipes 1-5 should share the first 32 bits. Only the least significant byte should be unique, e.g.

Before I answer your question, I think an explanation on Hex and Decimal values are needed.

The 40 bit hexadecimal is a number representation of base 16. A decimal is of base 10. So you can convert a Hex Value to Decimal. As this is out of scope for the question, you can google on how to convert from one to another. There are some online converters:

Hex to Decimal Converter

You will see when you convert the Hex value to decimal, that its just a number representation. When you convert, you drop the 0x and LL. As stated the 0x indicates the value is a hex value and LL means type Long Long.

So to answer your question, use the a converter to find a hex number like:

F0F0F0F0A1
F0F0F0F0A2
F0F0F0F0B4
F0F0F0F0E9

Just change the last 2 digits (least significant bit):

Pipes 1-5 should share the first 32 bits. Only the least significant byte should be unique, e.g.
   openReadingPipe(1,0xF0F0F0F0AA);
   openReadingPipe(2,0xF0F0F0F066);

Add the 0x and LL

0xF0F0F0F0A1LL
0xF0F0F0F0A2LL
0xF0F0F0F0B4LL
0xF0F0F0F0E9LL

All should work.

I am no expert on hex, as I am learning, so if I am incorrect, then please someone correct me.

Finally, the nRF24L01 datasheet makes the following point that the choice of address is not completely arbitrary:

Note: Addresses where the level shifts only one time (that is, 000FFFFFFF) can often be detected in noise and can give a false detection, which may give a raised Packet Error Rate. Addresses as a continuation of the preamble (hi-low toggling) also raises the Packet Error Rate.

  • could you please mention also, that those pipes refer only to the "6 data multi-receiver" feature (s. Nordic datasheet p39-40). by default only data pipe 0 and 1 are enabled. – user3028 Jul 16 '14 at 13:08
  • @bersch - Is that relevant? The OP was asking how the pipe values are choosen e.g. where the author is getting 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL?, not how the pipes are used. – PhillyNJ Jul 16 '14 at 14:37
  • In order to choose the values, you need to know that by default there is a writing pipe and a reading pipe. In multi-receiver mode there is a writing and up to 5 reading pipes. You describe only the reading pipes. So far I didn't check that, but I believe if one choses the reading and writing pipe that share the first 32 bits, it will fail. – user3028 Jul 16 '14 at 15:03
  • From my testing, the values are arbitrary as long as your pipe 0 & 1 are the same on the Transmitter and the receiver – PhillyNJ Jul 16 '14 at 15:30
  • I see. For myself I didn't check the multi-receiver feature. I use each chip for transmit and receive. – user3028 Jul 16 '14 at 15:48
2

The values 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL are arbitrary values and define the adresses of the senders and receivers to talk to.

If you use the Mirf library

Mirf.setRADDR((byte *)"serv1");

they can be also strings like serv1.

RF24 uses

write_register(RX_ADDR_P0, &value, 5);
write_register(TX_ADDR, &value, 5);
1

There's something that everyone forgets to tell you:

Pipes at receiver should be shortened after the first one

const uint64_t pipe01 = 0xE8E8F0F0A1LL;
const uint64_t pipe02 = 0xA2LL;  
const uint64_t pipe03 = 0xA3LL;
const uint64_t pipe04 = 0xA4LL;
const uint64_t pipe05 = 0xA5LL;
const uint64_t pipe06 = 0xA6LL;

radio.openReadingPipe(1, pipe01);  
radio.openReadingPipe(2, pipe02);
radio.openReadingPipe(3, pipe03);
radio.openReadingPipe(4, pipe04);
radio.openReadingPipe(5, pipe05);

Pipes at transmitter should be

const uint64_t pipe01 = 0xE8E8F0F0A1LL;
const uint64_t pipe02 = 0xE8E8F0F0A2LL;  
const uint64_t pipe03 = 0xE8E8F0F0A3LL;
const uint64_t pipe04 = 0xE8E8F0F0A4LL;
const uint64_t pipe05 = 0xE8E8F0F0A5LL;
const uint64_t pipe06 = 0xE8E8F0F0A6LL;

uint64_t setPipeToSend = pipe01; // or pipe02 or pipe03 or pipe04 or pipe05
radio.openWritingPipe(setPipeToSend );

If you want to know which pipe's message has come, use

  uint8_t someVariable;
    if (radio.available(&someVariable))
    {
       Serial.print("pipe number ");
       Serial.printLn(someVariable);
    }

Also pipe number 6 is used for receiving acknowledge messages.

In addition, the initialization code must have radio.enableDynamicPayloads(); This one works well for me:

    radio.begin();
    //radio.setChannel(0x57); //if set should be the same at the both sides
    radio.setPALevel(RF24_PA_LOW);  // "LOW" is more stable mode
    radio.enableAckPayload(); //for autoanswers
    radio.openWritingPipe(pipe01); //for sending
    //link pipe numbers to the pipe addresses
    //radio.openReadingPipe(1, pipe01); // I use pipe01 for sending
    radio.openReadingPipe(2, pipe02);
    radio.openReadingPipe(3, pipe03);
    radio.openReadingPipe(4, pipe04);
    radio.openReadingPipe(5, pipe05);
    radio.enableDynamicPayloads(); //must have for multi pipe receiving
    radio.startListening();  //start listening

Good luck...

  • whats pipe defined as in your example? – x29a Sep 14 '18 at 4:32
  • 1
    I have edited the code. You can use any of these 'pipes' for sending, but don't forget (like me) to exclude that pipe from reading. – Faig Sep 15 '18 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.