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

ESB event_handler is called only once

NRF52

I have a Transmitter and Receiver. The Receiver starts and listens to the ESB.

The Transmitter starts, sends a message on the ESB and restarts. The message is static. Triggered nrf_esb_event_handler with the message: "TX SUCCESS EVENT".

The Receiver receives the message ONLY ONCE. (nrf_esb_event_handler with the message "RX RECEIVED EVENT").

If the Transmitter does not restart and send different messages - then the Receiver receives all messages.

Why when reboot and send static messages nrf_esb_event_handler is called only once?

Parents Reply Children
  • If the payload isn't going to change and you need to reset the PTX after each message then you'll need to manually ensure that the PID is changing. I've modified the nrf_esb module in a couple of my projects for this purpose in the past. This is from a project I did with SDK14:

    /**@brief Function for setting a new packet ID for a specific pipe.
     *
     * The ESB protocol uses a 2-bit sequence number (packet ID) to identify
     * retransmitted packets. By default, the packet ID is incremented for every
     * uploaded packet. If the nrf_esb library is disabled in between sending two
     * payloads to a particular device then the PID will be zero for each
     * transmission and the device could get confused. This function allows the
     * PID to be set manually in this situation.
     *
     * @param[in]   pipe                            Pipe.
     * @param[in]   pid                             New PID value.
     *
     * @retval  NRF_SUCCESS                         If the operation completed successfully.
     * @retval  NRF_ERROR_BUSY                      If the function failed because the radio is busy.
     */
    uint32_t nrf_esb_set_pid(uint8_t pipe, uint8_t pid);
    
    
    uint32_t nrf_esb_set_pid(uint8_t pipe, uint8_t pid)
    {
        VERIFY_TRUE(m_nrf_esb_mainstate == NRF_ESB_STATE_IDLE, NRF_ERROR_BUSY);
        VERIFY_TRUE(pipe < 8, NRF_ERROR_INVALID_PARAM);
    
        m_pids[pipe] = (pid % (NRF_ESB_PID_MAX + 1));
        return NRF_SUCCESS;
    }

    Then I keep track of the last PID I used so I can increment it and then call this function the next time I re-enable the PTX.

Related