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

nRF52 ESB RF (Enhanced Shockburst)SDK

hi,

After the TX interrupt event occurs, on_radio_disabled_tx() is executed.

// Make sure the timer is started the next time the radio is ready,
    // and that it will disable the radio automatically if no packet is
    // received by the time defined in m_wait_for_ack_timeout_us
    NRF_ESB_SYS_TIMER->CC[0]    = m_wait_for_ack_timeout_us;
    NRF_ESB_SYS_TIMER->CC[1]    = m_config_local.retransmit_delay - 130;
    NRF_ESB_SYS_TIMER->TASKS_CLEAR = 1;
    NRF_ESB_SYS_TIMER->EVENTS_COMPARE[0] = 0;
    NRF_ESB_SYS_TIMER->EVENTS_COMPARE[1] = 0;

#define     NRF_ESB_SYS_TIMER                   NRF_TIMER2          //!< The timer that is used by the module.
#define     NRF_ESB_SYS_TIMER_IRQ_Handler       TIMER2_IRQHandler   //!< The handler that is used by @ref NRF_ESB_SYS_TIMER.

There is a timeout event for receiving an ACK.I noticed that the timer timeout was set using TIMER2, but I didn't see where the timer interrupt was generated.

But I found an interrupt event for Timer3.

// Workaround neccessary on nRF52832 Rev. 1.
void NRF_ESB_BUGFIX_TIMER_IRQHandler(void)
{
    if (NRF_ESB_BUGFIX_TIMER->EVENTS_COMPARE[0])
    {
        NRF_ESB_BUGFIX_TIMER->EVENTS_COMPARE[0] = 0;

        // If the timeout timer fires and we are in the PTX receive ACK state, disable the radio
        if (m_nrf_esb_mainstate == NRF_ESB_STATE_PTX_RX_ACK)
        {
            NRF_RADIO->TASKS_DISABLE = 1;
        }
    }
}

#define     NRF_ESB_BUGFIX_TIMER                NRF_TIMER3
#define     NRF_ESB_BUGFIX_TIMER_IRQn           TIMER3_IRQn
#define     NRF_ESB_BUGFIX_TIMER_IRQHandler     TIMER3_IRQHandler

How does this ACK receive timeout?

Best regards,

Ellison

Parents
  • Hi Ellison, 

    The ESB protocol use the TIMER2 in a little bit smart way. So there is no interrupt handler code, but instead the process is automated with PPI. You can find in ppi_init() the automation task-event is connected. So when NRF_ESB_SYS_TIMER->EVENTS_COMPARE occurs the TASK_DISABLE will be triggered. It automatically stop the PTX from waiting for ACK if it's timed out.

    The CC[1] will start TX automatically if there is a retransmission needed. 

Reply
  • Hi Ellison, 

    The ESB protocol use the TIMER2 in a little bit smart way. So there is no interrupt handler code, but instead the process is automated with PPI. You can find in ppi_init() the automation task-event is connected. So when NRF_ESB_SYS_TIMER->EVENTS_COMPARE occurs the TASK_DISABLE will be triggered. It automatically stop the PTX from waiting for ACK if it's timed out.

    The CC[1] will start TX automatically if there is a retransmission needed. 

Children
No Data
Related