This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to communicate with ESB RF with nRF52840.

-HI.

I had previously implemented ESB RF communications with the nRF24l01 + and nRF24LU1 +.

Now we want to implement ESB RF communication with nRF52840 DK(PTX) and nRF24LU1+(PRX).

I am studying with reference to "esb_ptx" example of SDK_15.0.0.

When implementing it with nRF24LU1 +, I was able to set RF as below.

hal_nrf_open_pipe((int)HAL_NRF_PIPE1, true); 

// Set RF channel
hal_nrf_set_rf_channel(0x02); 

// Set data rate
hal_nrf_set_datarate(HAL_NRF_250KBPS);

// Set CRC scheme
hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT); 

// Set address width
hal_nrf_set_address_width(HAL_NRF_AW_5BYTES);

However, in the nRF52840, I do not know how to code these settings for channels, pipes, addresses, and ACKs.

What should I do?

Thank you.

Parents
  • Hi Kim

    There is no 250KBPS mode in the nRF52840 unfortunately, so you have to use either the 1Mbps or 2Mbps mode to be compatible. 

    Also, the nrf_esb library provided for the nRF52 series only support Enhanced Shockburst, not the older Shockburst mode. This means that you have to enable ACK's on the nRF24LU1+ side in order to be compatible with the nRF52840. 

    Finally address configuration is different, as both the bit order and byte order is changed from the nRF24L series to the nRF5 series. I would suggest starting with a symmetric address like 0xE7E7E7E7E7 initially, so that you can verify that everything else works correctly before you start playing with the address configuration. 

    Other than that the settings should be compatible, and you should be able to use one of the nRF5 SDK examples as a starting point on the nRF52840 side:

    \nRF5_SDK_15.0.0_a53641a\examples\proprietary_rf\esb_ptx
    \nRF5_SDK_15.0.0_a53641a\examples\proprietary_rf\esb_prx

    Best regards
    Torbjørn

  • HI ovrevekk.

    I set it as follows.

    nRF24LU+

    pipe1 enable auto ack
    2Mbps
    CH.85
    CRC : 2Byte
    payload width : 5
    auto retransmit delay : 500us
    auto retransmit count : 3
    RF_PWR : 0dBm

    nRF52840 (SDK15 / esb_ptx example)

    static nrf_esb_payload_t        tx_payload = NRF_ESB_CREATE_PAYLOAD(5, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00);
    
    #define NRF_ESB_DEFAULT_CONFIG {.protocol               = NRF_ESB_PROTOCOL_ESB_DPL,         \
                                    .mode                   = NRF_ESB_MODE_PTX,                 \
                                    .event_handler          = 0,                                \
                                    .bitrate                = NRF_ESB_BITRATE_2MBPS,            \
                                    .crc                    = NRF_ESB_CRC_16BIT,                \
                                    .tx_output_power        = NRF_ESB_TX_POWER_0DBM,            \
                                    .retransmit_delay       = 500,                              \
                                    .retransmit_count       = 3,                                \
                                    .tx_mode                = NRF_ESB_TXMODE_AUTO,              \
                                    .radio_irq_priority     = 1,                                \
                                    .event_irq_priority     = 2,                                \
                                    .payload_length         = 5,                               \
                                    .selective_auto_ack     = true                             \
    }
    
    uint32_t esb_init( void )
    {
        uint32_t err_code;
        uint8_t base_addr_0[4] = {0xE7, 0xE7, 0xE7, 0xE7};
        uint8_t base_addr_1[4] = {0xC2, 0xC2, 0xC2, 0xC2};
        uint8_t addr_prefix[8] = {0xE7, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8 };
    
        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         = 500;
        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;
    
        nrf_esb_set_rf_channel(85);
        
        err_code = nrf_esb_init(&nrf_esb_config);
    
        VERIFY_SUCCESS(err_code);
    
        err_code = nrf_esb_set_base_address_0(base_addr_0);
        VERIFY_SUCCESS(err_code);
    
        err_code = nrf_esb_set_base_address_1(base_addr_1);
        VERIFY_SUCCESS(err_code);
    
        err_code = nrf_esb_set_prefixes(addr_prefix, 8);
        VERIFY_SUCCESS(err_code);
    
        return err_code;
    }
    

    - Can you tell what's wrong?

    - The esb_ptx example seems to be for nrf52832.
      Is it also available on nrf52840?

    Thank you.


    I succeeded in communication !!

    tx_payload = NRF_ESB_CREATE_PAYLOAD(0x00, 0x02,0x03,0x04,0x00,0x00);

    I was misunderstanding the macros that make up the payload.

    There are additional questions.

    nrf_esb_config.selective_auto_ack       = true;

    Is this code setting whether to receive ACK from the receiver?

    If set to false, can not you check whether the data transmission is good?

    In the nRF24L01, I could check the communication by reading the TX_DS register. What should I read in the nRF52840?

    tx_payload.noack = false;

    What does this code do?

    Thank you.


    I succeeded in verifying that the data was sent well.

    NRF_ESB_DEFAULT_CONFIG => NRF_ESB_LEGACY_CONFIG

    I made this change.

    What is the difference between the two?

  • Hi

    I am glad to hear you got the communication working Slight smile

    We don't have official support for the nRF52840 yet, but it is expected in the next SDK release. The library should still work fine. 

    The selective_auto_ack feature allows you to use the "no ack" feature, so that you can disable ACK's on some packets. Without this feature enabled you will receive ACK on all packets. 

    When selective_auto_ack is enabled, you can use the noack field in the tx_payload struct to have a packet sent without requesting an ACK. If selective_auto_ack is set to false then the noack field will have no effect. 

    For a full overview of the differences between NRF_ESB_DEFAULT_CONFIG and NRF_ESB_LEGACY_CONFIG, please have a look at their definition in nrf_esb.h
    Essentially the legacy configuration mimics the default configuration of the nRF24L radios, while the default configuration is the recommended configuration for new designs. With the legacy configuration you will only use 8-bit CRC, and you will not have access to the dynamic payload length, ACK payload or dynamic ACK features that you get with the default configuration. 

    Best regards
    Torbjørn

     

     

Reply
  • Hi

    I am glad to hear you got the communication working Slight smile

    We don't have official support for the nRF52840 yet, but it is expected in the next SDK release. The library should still work fine. 

    The selective_auto_ack feature allows you to use the "no ack" feature, so that you can disable ACK's on some packets. Without this feature enabled you will receive ACK on all packets. 

    When selective_auto_ack is enabled, you can use the noack field in the tx_payload struct to have a packet sent without requesting an ACK. If selective_auto_ack is set to false then the noack field will have no effect. 

    For a full overview of the differences between NRF_ESB_DEFAULT_CONFIG and NRF_ESB_LEGACY_CONFIG, please have a look at their definition in nrf_esb.h
    Essentially the legacy configuration mimics the default configuration of the nRF24L radios, while the default configuration is the recommended configuration for new designs. With the legacy configuration you will only use 8-bit CRC, and you will not have access to the dynamic payload length, ACK payload or dynamic ACK features that you get with the default configuration. 

    Best regards
    Torbjørn

     

     

Children
No Data
Related