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

MAX_RT interrupt still happens even if retransmit is off

Dear Nordic,

I met a problem while using nRF24L01+ about MAX_RT interrupt.

In my codes, I disabled RF HW retransmit (hal_nrf_set_auto_retr(0, RF_RETRANS_DELAY);) because I use our software codes to handle retransmit. Therefore, RF should not report "HAL_NRF_MAX_RT" interrupt. However, I still receive "HAL_NRF_MAX_RT" in very rare situations. I saw twice so far for a very long time.

My question is since RF module auto retransmition is off, why does nRF24L01+ still report "HAL_NRF_MAX_RT" interrupt?? Is this nRF24L01+ bug? Or how could I do to get rid of these
MAX_RT interrupt?

Parents
  • Hi Harry

    The MAX_RT interrupt occurs if no ACK is received, even when no retransmits are enabled. 

    In other words this will happen if you don't get an ACK on your TX packet. 

    Best regards
    Torbjørn

  • Thank your update.

    One more information: in our codes, we have disabled ACK by 

    hal_nrf_open_pipe(HAL_NRF_PIPE0, false);       // Open pipe0, without/autoack

    This means the receiver will never ACK the sender's TX.

    Two more questions:

    1. Based on your reply, MAX_RT occurs if no ACK. Since we have disabled ACK, I guess we should see MAX_RT interrupt very frequently, but why do we just rarely see the MAX_RT interrupt? (I saw twice so far for a very long time)

    2. We have used software to handle re-transmit. If we don't want MAX_RT interrupt, how could we do?

  • Yes, I need dynamic payload length.

    Therefore, my codes will call

    * run hal_nrf_open_pipe(HAL_NRF_PIPE0, true), 

    * hal_nrf_setup_dyn_pl(ALL_PIPES)

    * hal_nrf_enable_dynamic_pl().

    and will NOT call (comment out)

    * hal_nrf_enable_ack_pl();

    Got it. thank you very much.

  • Hi 

    That sounds good. 

    If you have any more problems just let me know Slight smile

    Best regards
    Torbjørn

  • Hi Torbjorn,

    I follow your comments, but RF does not produce any TX_DS interrupt event anymore. The whole system cannot work.

    I just copy my codes below (remove all comments to save space). Could you please help to check what's matter.

    void radio_pl_init (uint8_t *address, hal_nrf_operation_mode_t operational_mode,
    uint8_t rfChannel, hal_nrf_datarate_t airRate)
    {
    hal_nrf_close_pipe(HAL_NRF_ALL);
    hal_nrf_open_pipe(HAL_NRF_PIPE0, true);
    hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT);
    hal_nrf_set_auto_retr(0, RF_RETRANS_DELAY);
    hal_nrf_set_address_width(HAL_NRF_AW_5BYTES);
    hal_nrf_set_address(HAL_NRF_TX, address);
    hal_nrf_set_address(HAL_NRF_PIPE0, address);

    //hal_nrf_enable_ack_pl(); // Try to enable ack payload

    if(hal_nrf_read_reg(FEATURE) == 0x00 && (hal_nrf_read_reg(DYNPD) == 0x00))
    {
    hal_nrf_lock_unlock (); // Activate features
    //hal_nrf_enable_ack_pl(); // Enables payload in ack
    }

    hal_nrf_enable_dynamic_pl();
    hal_nrf_setup_dyn_pl(ALL_PIPES);

    if(operational_mode == HAL_NRF_PTX)
    {
    hal_nrf_set_operation_mode(HAL_NRF_PTX);
    }
    else
    {
    hal_nrf_set_operation_mode(HAL_NRF_PRX);

    // Disable this. Use dynamic payload, so no need to set the fixed payload length.
    //hal_nrf_set_rx_pload_width((uint8_t)HAL_NRF_PIPE0, RF_PAYLOAD_LENGTH);
    }

    hal_nrf_set_rf_channel(rfChannel);
    hal_nrf_set_power_mode(HAL_NRF_PWR_UP);
    hal_nrf_set_datarate(airRate);
    start_timer(RF_POWER_UP_DELAY);
    wait_for_timer();

    //radio_set_status (RF_IDLE);
    }

  • Hi 

    Are you able to send me the implementation of the hal_nrf_enable_dynamic_pl() function?

    In my version of the HAL library this function needs to be provided a bool argument, allowing you to enable or disable the feature. 

    I realize now that I forgot to mention that you have to call  hal_nrf_enable_dynamic_ack(true) also if you want to use the noack feature. 

    Below is my own test code to verify that this is working: 

    hal_nrf_set_operation_mode((config->mode == APP_RADIO_MODE_PTX) ? HAL_NRF_PTX : HAL_NRF_PRX);

    hal_nrf_set_power_mode(HAL_NRF_PWR_UP);

    nrf_delay_us(1500);

    hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT);

    hal_nrf_set_auto_retr(0, 500);

    hal_nrf_close_pipe(HAL_NRF_ALL);
    hal_nrf_open_pipe(HAL_NRF_PIPE0, true);

    hal_nrf_set_address_width(5);

    hal_nrf_setup_dynamic_payload(0x3F);
    hal_nrf_enable_dynamic_payload(true);
    hal_nrf_enable_dynamic_ack(true);

    hal_nrf_set_datarate(HAL_NRF_2MBPS);

    hal_nrf_set_rf_channel(2);


    if(config->mode == APP_RADIO_MODE_PTX)
    {
      hal_nrf_flush_tx();
    }
    else
    {
      hal_nrf_flush_rx();
      hal_nrf_set_rx_payload_width(HAL_NRF_PIPE0, 8);
    }

    And then I send my packets using the hal_nrf_write_tx_payload_noack(..) function, which removes the ACK requirement from the packet.

    Best regards
    Torbjørn

  • Are you able to send me the implementation of the hal_nrf_enable_dynamic_pl() function?

    Here you are.

    void hal_nrf_enable_dynamic_pl(void)
    {
    hal_nrf_write_reg(FEATURE, (hal_nrf_read_reg(FEATURE) | 0x04));
    }

    void hal_nrf_disable_dynamic_pl(void)
    {
    hal_nrf_write_reg(FEATURE, (hal_nrf_read_reg(FEATURE) & ~0x04));
    }

Reply Children
  • Hi

    That looks fine, I guess it's a slightly different implementation of the hal_nrf libraries. 

    Did you add the dynamic ACK configuration?

    If yes, did it change the behavior?

    If it still doesn't work, can you send me the code you use to upload packets, and a printout of your config register after you have configured the device?

    Best regards
    Torbjørn

  • Hi Torbjorn,

    I check my code. I use `hal_nrf_write_tx_pload()` to send payload.

    I want to try your codes, but I found my nRF libraries does not have `hal_nrf_write_tx_payload_noack(..)` this function. Could you paste this function to me?

    Another question: I saw you call `hal_nrf_set_rx_payload_width(HAL_NRF_PIPE0, 8);`. My question is since we already enable dynamic payload `hal_nrf_enable_dynamic_payload(true);`, why do we still need to call set payload width?

    By the way, the data rate in my test is 250K bps (yours is HAL_NRF_2MBPS). I think this will not affect anything, but still mention this difference.

  • Hi 

    The function looks like this:

    void hal_nrf_write_tx_payload_noack(const uint8_t *tx_pload, uint8_t length)
    {
      hal_nrf_write_multibyte_reg(W_TX_PAYLOAD_NOACK, tx_pload, length);
    }

    It is identical to the normal TX function, except the command byte is 0xB0 (W_TX_PAYLOAD_NOACK) instead of 0xA0 (W_TX_PAYLOAD).

    harryAI said:
    Another question: I saw you call `hal_nrf_set_rx_payload_width(HAL_NRF_PIPE0, 8);`. My question is since we already enable dynamic payload `hal_nrf_enable_dynamic_payload(true);`, why do we still need to call set payload width?

     You are correct. There is no need to set the payload length when using dynamic payload length, and this line can safely be removed from the code. 

    harryAI said:
    By the way, the data rate in my test is 250K bps (yours is HAL_NRF_2MBPS). I think this will not affect anything, but still mention this difference.

     Thanks for the information. I agree this should not make a difference in this case. 

    Best regards
    Torbjørn

  • In my library, I did not find `W_TX_PAYLOAD_NOACK`, but I find `WR_NAC_TX_PLOAD` below. I think the definition of `W_TX_PAYLOAD_NOACK` is the same as`WR_NAC_TX_PLOAD`, right? Please double confirm in case any unexpected issue happens.

    #define WR_NAC_TX_PLOAD 0xB0

  • Hi

    As long as the value is 0xB0 the name is irrelevant, so you can use that define, yes Slight smile

    Best regards
    Torbjørn

Related