Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

nRF52840 dongle & nRF24L01 Pipe Config

Hi,

I'm confused about ESB settings. I'm trying to renew our board with new nRF520840 chip and we must need to provide backward compatibility that the existing board has nRF24L01.

In the ESB example of NRF5 SDK the pipe settings is set by:

static struct esb_payload tx_payload = ESB_CREATE_PAYLOAD(0, 0x01, 0x00, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08);

As I understand from the function definition Red is the pipe index, blue is the data size, greens are the pipe bytes. Is it correct?

In our nRF24 application the pipe settings are like below:

const uint64_t pipes[2] = { 0xABCDEFABCDLL, 0xAABBCCDDEELL };  // pipe[0] is for RX, pipe[1] is for TX
Data size Is 24 bytes. So do I need to set "blue" parameter to 24?
Is there only one pipe for both transmitting and receiving in new SDK (ESB)?
Look like new SDK is require 7 pipe bytes if I'm correct. How can I set 5 byte pipe number? Is it like ESB_CREATE_PAYLOAD(0240xAA, 0xBB, 0xCC, 0xDD, 0xEE);  ?
Thanks in advance.
  • Hello Salih, 

    Unfortunately, I need to put you off until next week, as our expert in this topic is out of office this week. 

    We will come back to you as soon as possible. My apologies for the inconvenience! 

    Regards, 

    Markus 

  • Hi Salih

    I will help Markus out with this case as I have more experience with the ESB protocol. 

    As I understand from the function definition Red is the pipe index, blue is the data size, greens are the pipe bytes. Is it correct?

    The red value is the pipe index, that is correct, but there is no data size parameter. The macro sets the size according to how many bytes you include after the pipe index (8 bytes in this case). 

    Data size Is 24 bytes. So do I need to set "blue" parameter to 24?

    No. As I mentioned earlier the ESB_CREATE_PAYLOAD macro doesn't take the size as an argument. 

    In your case I would probably just populate the fields of the tx_payload struct directly, rather than use the ESB_CREATE_PAYLOAD macro. This macro is only meant as a utility macro to make it easy to define simple ESB payloads for the ESB samples, but is impractical to use in most applications where the payload content is dynamically rather than statically defined. 

    Is there only one pipe for both transmitting and receiving in new SDK (ESB)?

    No, you can both receive or transmit on any pipe. 

    Look like new SDK is require 7 pipe bytes if I'm correct. How can I set 5 byte pipe number? Is it like ESB_CREATE_PAYLOAD(0240xAA, 0xBB, 0xCC, 0xDD, 0xEE);  ?

    I assume what you are referring to here is the RF address. The new ESB library allows you to use 3, 4 or 5 byte RF address, similar to the old nRF24L01 implementation. 

    Just keep in mind that setting the RF address has to be done separately, as shown in the standard ESB samples. 

    Also, addresses are handled differently between the nRF24L series radios and the nRF5 series radios, as described in more detail here

    Best regards
    Torbjørn

  • Thanks a lot. Devices were successful paired according to the description in the links. To match, I needed to change NRF24 parameters like below to be suited to the example code of PTX. I'm sharing below what I did.

    NRF24 

     
    const byte addr[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};   // Pipe address
    
      RF.setChannel(80);                    // Custom channel. Same as NRF5
      RF.setDataRate(RF24_1MBPS);           // NRF52840 doens't support 250KBs
      RF.openWritingPipe(addr);
      RF.openReadingPipe(1, addr);
      RF.enableAckPayload();
      RF.enableDynamicPayloads();
      RF.setRetries(2, 10);                 // Whatever
      RF.setCRCLength(RF24_CRC_16);
    NRF5
    For the certain data package, I changed the code like below in the main function:
    static struct esb_payload test_payload;
    
    short rf_data[25];
    /* some stuff with rf_data */
    
    test.length = 25;
    test.noack = true;
    for(i=0; i<25; i++)
         test.data[i] = rf_data[i];  // Data copy
    
    err = esb_write_payload(&test);
  • Hi Salih

    Good to hear that you got it working, and thanks for sharing your settings. 

    I will consider the case closed then, unless you have more questions?

    Best regards
    Torbjørn

  • Hi Torbjørn,

    I have no more questions under this topic.

Related