ESB: retransmit_delay setting

Hi,

In my project we are using the ESB between a nrf52811 and a NRF5340dk and are trying to evaluate the maximum speed we can reach with ESB packet transmission without acknowledge.

For this we have the following configuration of the ESB an ptx code:

int esb_initialize(void)
{
    int err;
    /* These are arbitrary default addresses. In end user products
     * different addresses should be used for each set of devices.
     */
    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};

    struct esb_config config = ESB_DEFAULT_CONFIG;

    config.protocol = ESB_PROTOCOL_ESB_DPL;
    config.retransmit_delay = 20;
    config.bitrate = ESB_BITRATE_2MBPS;
    config.event_handler = event_handler;
    config.mode = ESB_MODE_PTX;
    config.selective_auto_ack = true; 
    config.retransmit_count = 0;
    config.crc = ESB_CRC_8BIT;   
    config.use_fast_ramp_up = true;

    err = esb_init(&config);

    if (err) {
        return err;
    }

    err = esb_set_base_address_0(base_addr_0);
    if (err) {
        return err;
    }

    err = esb_set_base_address_1(base_addr_1);
    if (err) {
        return err;
    }

    err = esb_set_prefixes(addr_prefix, ARRAY_SIZE(addr_prefix));
    if (err) {
        return err;
    }

    return 0;
}

int main(void)
{
    int err;

    LOG_INF("Enhanced ShockBurst ptx sample");

    err = clocks_start();
    if (err) {
        return 0;
    }

    // err = dk_leds_init();
    // if (err) {
    //  LOG_ERR("LEDs initialization failed, err %d", err);
    //  return 0;
    // }

    err = debug_pin_init();
    if (err) {
        return;
    }

    err = esb_initialize();
    if (err) {
        LOG_ERR("ESB initialization failed, err %d", err);
        return 0;
    }

    LOG_INF("Initialization complete");
    LOG_INF("Sending test packet");

    tx_payload.noack = true;
    while (1) {
        err = esb_write_payload(&tx_payload);
        tx_payload.data[1]++;
        while(esb_tx_full());
    }
}

We have set some debug pin to monitor the Tx and Rx and the ESB configuration is similar for ptx and prx ( except on is in PRX mode ans the other in PTX mode).

We have done test with SDK v2.5.0 and SDK v2.9.0

  • We don’t observe what has been said in the documentation. We have configured the CONFIG_ESB_NEVER_DISABLE_TX to yes and when we change the value of the retransmit_delay its value is not linked to the delay between two consecutives transmissions. Here are the value of delay between two transmission according to the rentransmit_delay value. Why?

Retransmit_Delay

Delay between 2 Tx

20

113

40

113

50

Only One Tx

Here is what is said in the esb.h of the SDK.

uint16_t retransmit_delay; /**< The delay between each retransmission of
                  *  unacknowledged packets.
                  *  If the CONFIG_ESB_NEVER_DISABLE_TX Kconfig option is enabled,
                  *  this is the delay between two consecutive transmissions.
                  *  Depending on the reception processing time, a minimal
                  *  value might be required (for example, a typical value
                  *  for 32-bit payload is 20 µs).

  • For some values of this retransmit_delay we don’t have a continous transmission of data even if the code is a loop of transmission. When debbugging it appear that the esb_state was set to ESB_STATE_PTX_TX_ACK even if our payload was configured with the field noack set to true. And this should not be possible if we look into the start_tx_transaction function of the esb.c in the sdk. Do anyone can explain me this strange behaviour?

Globally my test shown me that the setting of this retransmit_delay is really difficult and can have many different effect on the quality of the transmission so I would like to understand how it's used in my configuration with: CONFIG_ESB_NEVER_DISABLE_TX set to yes, the fast ramp up activated and no ack requested.

Best regards 
Alexandre

Parents
  • Hi,

    It may be a bug of some sort here, or possible a misunderstanding or wrong description on behavior. I guess I should try this myself, but maybe you can help.

    I can see in your transmit loop you have:

    while (1) {
    err = esb_write_payload(&tx_payload);
    tx_payload.data[1]++;
    while(esb_tx_full());
    }

    In your table you write:

    Retransmit_Delay

    Delay between 2 Tx

    20

    113

    40

    113

    50

    Only One Tx

    Just to ensure I understand, is each call to esb_write_payload() sent or not?

    Are any sent more than one time when using esb_write_payload() with short retransmit delay?

    What is the size of the payload here? If you increase or reduce the payload size, how does that affect the delay?

    Is the nRF5340 or nRF52811 the transmitter here? 

    If you have access to a Power Profiler Kit II, then you can measure the current consumption with high resolution, this will give better understanding of when it's actually transmitting in real-time, the tool can also record pin toggling in real-time, so you can find with great details how on-air transmission overlap with the events you see in the application: https://www.nordicsemi.com/Products/Development-hardware/Power-Profiler-Kit-2 

    Kenneth

  • Hi Kenneth,

    Thank you for your answer and here are mine.

    Just to ensure I understand, is each call to esb_write_payload() sent or not? Yes except for the case with rentransmit_delay set to 50.

    Are any sent more than one time when using esb_write_payload() with short retransmit delay? Yes I tried 10 and 5 and I have continous transmission

    What is the size of the payload here? If you increase or reduce the payload size, how does that affect the delay? I have the default payload length so 32 bits. When I set it to 16 or 8 bits I don't se any change in the delay between Tx

    Is the nRF5340 or nRF52811 the transmitter here? The NRF52811 is the transmitter and the the nrf5340 the receiver, sorry for missing to give this important information.

    Thank you for the advice about the Power Profiler Kit II I will test it :)

    Alexandre

  • Hi Alexandre,

    I am wondering here if you just should set retransmit delay to a large value (e.g. 1000). Because I would expect you only need to transmit each packet once before next packet should be sent, and since you in any case have number of retransmits = 0 and noack = true, that the retransmit delay will not have any impact in this case (unless you set it to a small value, it may have an impact since it indirectly can stop an on-going transmission, which I think is the case when you set it to 50).

    Kenneth

Reply
  • Hi Alexandre,

    I am wondering here if you just should set retransmit delay to a large value (e.g. 1000). Because I would expect you only need to transmit each packet once before next packet should be sent, and since you in any case have number of retransmits = 0 and noack = true, that the retransmit delay will not have any impact in this case (unless you set it to a small value, it may have an impact since it indirectly can stop an on-going transmission, which I think is the case when you set it to 50).

    Kenneth

Children
  • Hi Kenneth,

    I haven't tested a lot of value but If I set to 1000 or 500 the retransmit delay I only have one sending and it's not received.
    And regarding that below 50 I have some configuration working I don't think that put the retransmit delay with a big value will allow me to get the data transmission rate the higher as possible.

    I haven't found it but may be there is a document explaining this retransmit delay and it purpose, especially in my configuration?

    Alexandre

Related