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

In radio_signal_callback, after switching app_timer, it cannot generate app_timer interrupt

Hello,

I encountered a problem. When I turn off app_timer during timeslot interruption, it cannot generate app_timer interrupt
code show as below:

static nrf_radio_signal_callback_return_param_t *timeslot_cb(uint8_t signal)
{
    static nrf_radio_signal_callback_return_param_t ret = {
        .params.request.p_next = NULL,
        .callback_action       = NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE,
    };
    
    if(signal == NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO){
        if (NRF_RADIO->EVENTS_DISABLED == 1) {
            NRF_RADIO->EVENTS_DISABLED = 0;
            NRF_LOG_DEBUG("radio disable evt");
            APP_ERROR_CHECK(app_timer_start(m_rx_timer, APP_TIMER_TICKS(SLEEP_INTERVAL), NULL));
            APP_ERROR_CHECK(app_timer_stop(m_rx_timer));
            APP_ERROR_CHECK(app_timer_start(m_rx_timer, APP_TIMER_TICKS(SLEEP_INTERVAL), NULL));
            NRF_LOG_INFO("timer active : %d", m_rx_timer->active);
        }
    }

I am using app_timer2 :

ret_code_t app_timer_start(app_timer_t * p_timer, uint32_t timeout_ticks, void * p_context)
{
    ASSERT(p_timer);
    app_timer_t * p_t = (app_timer_t *) p_timer;

    if (p_t->active)
    {
        return NRF_SUCCESS;
    }

    p_t->p_context = p_context;
    p_t->end_val = get_now() + timeout_ticks;

    if (p_t->repeat_period)
    {
        p_t->repeat_period = timeout_ticks;
    }

    return timer_req_schedule(TIMER_REQ_START, p_t);
}

Regards, 

Gray.

Related