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

NRF52833 ESB Static payload and Dynamic payload

Hi.

I am a student studying esb examples with nrf52433 board.

1. If data is sent from ptx to prx using static payload, is tx completed without receiving ACK?
    Don't need to use the auto_ack option and the noack flag?
    The ACK is only supported by dynamic payload, right?

2. When using dynamic payload, does auto_ack need to be set to false to use auto acknowledgement?

3.After setting auto_ack = false, noack = false, ptx sent data to prx with dynamic payload. ptx's NRF_ESB_EVENT_RX_RECEIVED event is not called.
   I know that the NRF_ESB_EVENT_RX_RECEIVED event occurs when ptx receives ACK from prx.
   However, ptx's NRF_ESB_EVENT_RX_RECEIVED event occurs only when nrf_delay_ms(1) is added in prx's RADIO_IRQHandler().

There are many parts I don't understand.
Any reply would be appreciated.

Parents
  • Hi

    1. For historical reasons, when disabling dynamic payload you are essentially reverting to the basic ESB protocol, which always uses ACK and doesn't provide any way to disable it. 

    In this mode you will not get a TX_SUCCESS event unless an ACK is received (depending on the retransmit setting you have several attempts to get the packet through). If no ACK is received, and you expend the retransmit counter, you will get the TX_FAILED event. 

    The noack flag has no effect in the static payload length mode, since ACK is always required. 

    If you enable dynamic payload length and selective_auto_ack, then you can choose to skip the ACK packet by setting the noack bit in the packet. 

    2. By "auto_ack" I assume you mean "selective_auto_ack"?

    This is not needed. As I mentioned earlier sending ACK is the default behavior, and you actually need to enable selective_auto_ack in order to be able to omit the ACK. 

    3. The RX_RECEIVED event should only be received on the PTX side if you upload a packet to the FIFO on the PRX side before you send something from the PTX. 

    Can you confirm that you upload some data on the PRX side, not only the PTX?

    Best regards
    Torbjørn

Reply
  • Hi

    1. For historical reasons, when disabling dynamic payload you are essentially reverting to the basic ESB protocol, which always uses ACK and doesn't provide any way to disable it. 

    In this mode you will not get a TX_SUCCESS event unless an ACK is received (depending on the retransmit setting you have several attempts to get the packet through). If no ACK is received, and you expend the retransmit counter, you will get the TX_FAILED event. 

    The noack flag has no effect in the static payload length mode, since ACK is always required. 

    If you enable dynamic payload length and selective_auto_ack, then you can choose to skip the ACK packet by setting the noack bit in the packet. 

    2. By "auto_ack" I assume you mean "selective_auto_ack"?

    This is not needed. As I mentioned earlier sending ACK is the default behavior, and you actually need to enable selective_auto_ack in order to be able to omit the ACK. 

    3. The RX_RECEIVED event should only be received on the PTX side if you upload a packet to the FIFO on the PRX side before you send something from the PTX. 

    Can you confirm that you upload some data on the PRX side, not only the PTX?

    Best regards
    Torbjørn

Children
  • d earlier sendin

    Thank you for your response.

    In summary, does the TX_SUCCESS event occur when ACK is successfully received for both dynamic and static?

    In my code, when the prx side NRF_ESB_EVENT_RX_RECEIVED event occurs, I call nrf_esb_read_rx_payload().

    void nrf_esb_event_handler(nrf_esb_evt_t const * p_event)
    {
        switch (p_event->evt_id)
        {
            case NRF_ESB_EVENT_TX_SUCCESS:
                NRF_LOG_DEBUG("TX SUCCESS EVENT\r\n");
                break;
            case NRF_ESB_EVENT_TX_FAILED:
                NRF_LOG_DEBUG("TX FAILED EVENT\r\n");
                break;
            case NRF_ESB_EVENT_RX_RECEIVED:
                NRF_LOG_DEBUG("RX RECEIVED EVENT\r\n");
                if (nrf_esb_read_rx_payload(&rx_payload) == 0) {
                    NRF_LOG_DEBUG("receiving packet: %02x\n", rx_payload.data[1]);
                }
                rx_packet_received = true;
                break;
        }
    }
    
    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.payload_length           = 8;
        nrf_esb_config.protocol                 = NRF_ESB_PROTOCOL_ESB_DPL;
        nrf_esb_config.bitrate                  = NRF_ESB_BITRATE_2MBPS;
        nrf_esb_config.mode                     = NRF_ESB_MODE_PRX;
        nrf_esb_config.event_handler            = nrf_esb_event_handler;
        nrf_esb_config.selective_auto_ack       = false;
    
        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;
    }

    If the above code is applied, is it normal that NRF_ESB_EVENT_RX_RECEIVED does not occur on the ptx side?

    Is there any document where I can get ESB information other than the link below?

    https://infocenter.nordicsemi.com/

  • Hi 

    yimo said:
    In summary, does the TX_SUCCESS event occur when ACK is successfully received for both dynamic and static?

    That is correct.  

    yimo said:
    If the above code is applied, is it normal that NRF_ESB_EVENT_RX_RECEIVED does not occur on the ptx side?

    Yes. When sending packets from the PTX to the PRX you should expect to get the TX_SUCCESS event on the PTX side, and the RX_RECEIVED event on the PRX side. 

    yimo said:

    Is there any document where I can get ESB information other than the link below?

    https://infocenter.nordicsemi.com/

    The infocenter has the most up to date documentation of the ESB implementation in the nRF52 series. 

    Make sure you read both the ESB User Guide, and the ESB API documentation

    Best regards
    Torbjørn

Related