ESB Can not trigger handler

Hi

sdk:17.1 ble_app_uart(esb_timeslot))

When I was conducting the integration test between my device (nRF52832) and the external device (nRF24L), I encountered a problem.
The nRF24L sent a message via 2.4GHz. The nRF52832 was able to enter the function "static void on_radio_disabled_rx(void)", and from the code in this function, m_rx_payload_buffer showed the correct data content, but the length seemed incorrect (this has not been confirmed yet). However, it was still unable to reach the top-level interrupt function of ESB, nrf_esb_event_handler(). Could you please tell me if there is something wrong with this situation?

It should be noted that I used the esb_ptx in the SDK17.1 to send the message via 52832 development board or prodcuts(52810/52832) by ourself, and my NRF52832 transceiver was functioning properly.



Best regard

Parents
  • Hi,

    There is too little information to be able to diagnose the problem. When you wrote that nRF24L is sending the data, are you sure that the payload size of PTX in your nRF24L configuration matches the PRX size in your nRF52832 receive end? 

    Can you please show some code snippets on both the PTX and PRX sideon how you configure nrf_esb_config_t  structure.

    I also think that it is best to read the full buffer in your nrf_esb_event_handler(nrf_esb_evt_t const * p_event) function and process the packet before you read another packet.

  • Hi 
    Since the nRF24l is a device from an external company, I can only provide their configuration.

    nRF24L
    1)Reg(0x20+0x10),write buffer{0XA1,0XA2,0XA3,0XA4,0XA5},byte5;
    2)Reg(0x20+0x0A),write buffer{0XA1,0XA2,0XA3,0XA4,0XA5},byte5;
    3)Reg(0X20+0X01),write 0X01; //enable ack
    4)Reg(0X20+0X02),write 0X01; //enable rev address
    5)Reg(0X20+0X04),write 0X01; //auto ack
    6)Reg(0X20+0X05),write 58;   //RF CHANNEL
    7)Reg(0X20+0X11),write 16;   //data length
    9)Reg(0X20+0X00),write 0X0E;//CONFIG 



    This is nRF52832 config
    #define NRF_ESB_LEGACY_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       = 300,                              \
                                    .retransmit_count       = 1,                                \
                                    .tx_mode                = NRF_ESB_TXMODE_AUTO,              \
                                    .radio_irq_priority     = 1,                                \
                                    .event_irq_priority     = 2,                                \
                                    .payload_length         = 16,                               \
                                    .selective_auto_ack     = false                             \
    }
    static nrf_esb_config_t             nrf_esb_config = NRF_ESB_LEGACY_CONFIG;         /**< Configuration structure for nrf_esb initialization. */
    static const uint8_t base_addr_0[4] = {0xA2, 0xA3, 0xA4, 0xA5};
    static const uint8_t base_addr_1[4] = {0xC2, 0xC2, 0xC2, 0xC2};
    static uint8_t addr_prefix[8] = {0xA1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8 };    /**< Address prefix. */
    uint32_t esb_timeslot_init(void)
    {
    	void nrf_esb_event_handler(nrf_esb_evt_t const * p_event);
    	
        nrf_esb_config.protocol                 = NRF_ESB_PROTOCOL_ESB_DPL;
        nrf_esb_config.selective_auto_ack       = true;
    
        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.crc                      = NRF_ESB_CRC_16BIT;
        nrf_esb_config.radio_irq_priority       = 0;
        nrf_esb_config.tx_output_power          = NRF_ESB_TX_POWER_0DBM;
    
        NVIC_ClearPendingIRQ(TIMESLOT_END_IRQn);
        NVIC_SetPriority(TIMESLOT_END_IRQn, 2);
        NVIC_EnableIRQ(TIMESLOT_END_IRQn);
    
        NVIC_ClearPendingIRQ(TIMESLOT_BEGIN_IRQn);
        NVIC_SetPriority(TIMESLOT_BEGIN_IRQn, 2);
        NVIC_EnableIRQ(TIMESLOT_BEGIN_IRQn);
    
        return NRF_SUCCESS;
    }
    uint32_t esb_start_PRX(bool selective_auto_ack) { // need a return value due to "VERIFY_SUCCESS" did
        uint32_t err_code;
    
        if (m_state == LL_ESB_STATE_IDLE) {
            #if 1 // suggestion from Nordic forum to fix "wrong pattern": power cycle RADIO before init
                NRF_RADIO->POWER = 0;
                NRF_RADIO->POWER;
                NRF_RADIO->POWER = 1;
            #endif
            nrf_esb_config.mode               = NRF_ESB_MODE_PRX;
            nrf_esb_config.selective_auto_ack = selective_auto_ack;
            err_code = nrf_esb_init(&nrf_esb_config); APP_ERROR_CHECK(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);
    
    	nrf_esb_set_rf_channel(58);
    	addr_prefix[0] = 0xA1;
            err_code = nrf_esb_set_prefixes(addr_prefix, 8); APP_ERROR_CHECK(err_code);
        }
    
        CRITICAL_REGION_ENTER();
        if (m_state != LL_ESB_STATE_RX)
        {
            /* No packets in the Tx FIFO: start reception */
            err_code = nrf_esb_start_rx();
            APP_ERROR_CHECK(err_code);
            m_state = LL_ESB_STATE_RX;
        }
        CRITICAL_REGION_EXIT();
        return NRF_SUCCESS;
    }
    
    void ESB_ReplyAck(unsigned char *pucData, unsigned long ulLen, unsigned long pipe, bool noack) {
        nrf_esb_payload_t tx_payload;
        memcpy(tx_payload.data, pucData, ulLen);
        tx_payload.length   = ulLen;
        tx_payload.pipe     = pipe;
        tx_payload.noack    = noack;//true;
        if (nrf_esb_write_payload(&tx_payload) == NRF_SUCCESS) {
                //
           }
    }

    If there is any information that needs to be supplemented, please let us know in time. Thank you very much

    I also think that it is best to read the full buffer in your nrf_esb_event_handler(nrf_esb_evt_t const * p_event) function and process the packet before you read another packet.

    Yes, we will process the data in the mainloop.

    Best regard

Reply
  • Hi 
    Since the nRF24l is a device from an external company, I can only provide their configuration.

    nRF24L
    1)Reg(0x20+0x10),write buffer{0XA1,0XA2,0XA3,0XA4,0XA5},byte5;
    2)Reg(0x20+0x0A),write buffer{0XA1,0XA2,0XA3,0XA4,0XA5},byte5;
    3)Reg(0X20+0X01),write 0X01; //enable ack
    4)Reg(0X20+0X02),write 0X01; //enable rev address
    5)Reg(0X20+0X04),write 0X01; //auto ack
    6)Reg(0X20+0X05),write 58;   //RF CHANNEL
    7)Reg(0X20+0X11),write 16;   //data length
    9)Reg(0X20+0X00),write 0X0E;//CONFIG 



    This is nRF52832 config
    #define NRF_ESB_LEGACY_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       = 300,                              \
                                    .retransmit_count       = 1,                                \
                                    .tx_mode                = NRF_ESB_TXMODE_AUTO,              \
                                    .radio_irq_priority     = 1,                                \
                                    .event_irq_priority     = 2,                                \
                                    .payload_length         = 16,                               \
                                    .selective_auto_ack     = false                             \
    }
    static nrf_esb_config_t             nrf_esb_config = NRF_ESB_LEGACY_CONFIG;         /**< Configuration structure for nrf_esb initialization. */
    static const uint8_t base_addr_0[4] = {0xA2, 0xA3, 0xA4, 0xA5};
    static const uint8_t base_addr_1[4] = {0xC2, 0xC2, 0xC2, 0xC2};
    static uint8_t addr_prefix[8] = {0xA1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8 };    /**< Address prefix. */
    uint32_t esb_timeslot_init(void)
    {
    	void nrf_esb_event_handler(nrf_esb_evt_t const * p_event);
    	
        nrf_esb_config.protocol                 = NRF_ESB_PROTOCOL_ESB_DPL;
        nrf_esb_config.selective_auto_ack       = true;
    
        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.crc                      = NRF_ESB_CRC_16BIT;
        nrf_esb_config.radio_irq_priority       = 0;
        nrf_esb_config.tx_output_power          = NRF_ESB_TX_POWER_0DBM;
    
        NVIC_ClearPendingIRQ(TIMESLOT_END_IRQn);
        NVIC_SetPriority(TIMESLOT_END_IRQn, 2);
        NVIC_EnableIRQ(TIMESLOT_END_IRQn);
    
        NVIC_ClearPendingIRQ(TIMESLOT_BEGIN_IRQn);
        NVIC_SetPriority(TIMESLOT_BEGIN_IRQn, 2);
        NVIC_EnableIRQ(TIMESLOT_BEGIN_IRQn);
    
        return NRF_SUCCESS;
    }
    uint32_t esb_start_PRX(bool selective_auto_ack) { // need a return value due to "VERIFY_SUCCESS" did
        uint32_t err_code;
    
        if (m_state == LL_ESB_STATE_IDLE) {
            #if 1 // suggestion from Nordic forum to fix "wrong pattern": power cycle RADIO before init
                NRF_RADIO->POWER = 0;
                NRF_RADIO->POWER;
                NRF_RADIO->POWER = 1;
            #endif
            nrf_esb_config.mode               = NRF_ESB_MODE_PRX;
            nrf_esb_config.selective_auto_ack = selective_auto_ack;
            err_code = nrf_esb_init(&nrf_esb_config); APP_ERROR_CHECK(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);
    
    	nrf_esb_set_rf_channel(58);
    	addr_prefix[0] = 0xA1;
            err_code = nrf_esb_set_prefixes(addr_prefix, 8); APP_ERROR_CHECK(err_code);
        }
    
        CRITICAL_REGION_ENTER();
        if (m_state != LL_ESB_STATE_RX)
        {
            /* No packets in the Tx FIFO: start reception */
            err_code = nrf_esb_start_rx();
            APP_ERROR_CHECK(err_code);
            m_state = LL_ESB_STATE_RX;
        }
        CRITICAL_REGION_EXIT();
        return NRF_SUCCESS;
    }
    
    void ESB_ReplyAck(unsigned char *pucData, unsigned long ulLen, unsigned long pipe, bool noack) {
        nrf_esb_payload_t tx_payload;
        memcpy(tx_payload.data, pucData, ulLen);
        tx_payload.length   = ulLen;
        tx_payload.pipe     = pipe;
        tx_payload.noack    = noack;//true;
        if (nrf_esb_write_payload(&tx_payload) == NRF_SUCCESS) {
                //
           }
    }

    If there is any information that needs to be supplemented, please let us know in time. Thank you very much

    I also think that it is best to read the full buffer in your nrf_esb_event_handler(nrf_esb_evt_t const * p_event) function and process the packet before you read another packet.

    Yes, we will process the data in the mainloop.

    Best regard

Children
No Data
Related