This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF52 <-> 24L01+ ESB sample code

Does anyone have any sample code for two-way ESB comms between an nRF52 and nRF24L01+ being controlled by an Arduino (or similar), please?

I can get two nRF52s to talk to each other, and I can get two 24L01+s to talk to each other, but I just can't get the comms working between the different modules.

  • Hi Steve,

    Q1: Could you try using an RF address which is equal regardless of endianess, like E7 E7 E7 E7 E7?

    Q2: If the above does not work, could you post your settings?

    Cheers, Håkon

  • Hi Håkon,

    I've tried the first many times!

    Here is my setup which I initially took from an example on NDZone, which worked for the poster. I've tried swapping the address used for the reading and writing pipes with no success.

    The nRF52 is using the esb_ptx example with the channel set to 2.

    Thanks,

    Steve.

    int64_t pipe_address[2] = {0xC2C2C2C2C2, 0xE7E7E7E7E7};
    

    void setupRadio() { radio.begin(); radio.setRetries(15, 15); radio.setChannel(2); radio.setDataRate(RF24_250KBPS); radio.setPALevel(RF24_PA_LOW); radio.enableDynamicPayloads(); radio.enableDynamicAck(); radio.enableAckPayload(); radio.setCRCLength(RF24_CRC_16); radio.openReadingPipe(1, pipe_address[1]); radio.openWritingPipe(pipe_address[0]); radio.startListening(); radio.printDetails(); }

  • Hi Steve,

    The nRF52 does not have the 250 kBit on-air datarate mode. As shown in the nrf52_bitfields.h: RADIO_MODE_MODE_Nrf_250Kbit (2UL) // Deprecated enumerator - 250 kbit/s Nordic proprietary radio mode

    Could you try with 2 MBit and see if this works better? If you're using noack with the nRF24L01+, then the selective_ack must be set on the nRF5x-side. Example configuration:

    `nrf_esb_config_t nrf_esb_config         = NRF_ESB_DEFAULT_CONFIG;
    
    nrf_esb_config.protocol                 = NRF_ESB_PROTOCOL_ESB_DPL;
    
    nrf_esb_config.retransmit_delay         = 600;
    
    nrf_esb_config.bitrate                  = NRF_ESB_BITRATE_2MBPS;
    
    nrf_esb_config.event_handler            = nrf_esb_event_handler;
    
    nrf_esb_config.mode                     = NRF_ESB_MODE_PTX;
    
    nrf_esb_config.selective_auto_ack       = true;`
    

    Cheers, Håkon

  • Hi Håkon,

    Thanks for the suggestion, I'll try that later in the week when I have more time.

    Wouldn't it be better for the compiler to give an error message if you try and compile for 250kbps on nRF52, rather than just having a deprecation message in the header?

    Cheers,

    Steve.

  • I agree with you 100 %. I've already flagged this internally.

Related