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

ESB and app_timer.c

Hello!

I have a device with custom nrf52832 board. This device can beep using buzzer. Frequency of the sound is generated by pwm driver from SDK. I'm changing frequencies and delays between to generate melody via app_timer.c (app_timer_start function). Timer handler change frequency and configure itself to the new period of time until melody ends. At the same time device receives messages via ESB using RX mode.

ESB messages and melody triggering events are asynchronous.

The problem I have is that sometimes device became frozen. It's hard to understand why it's happening but I found that it's can't end while loop in timer_list_remove() function:

    /**@brief Function for removing a timer from the timer queue.
     *
     * @param[in]  timer_id   Id of timer to remove.
     */
    static void timer_list_remove(timer_node_t * p_timer)
    {
        timer_node_t * p_previous;
        timer_node_t * p_current;
        uint32_t       timeout;
    
        // Find the timer's position in timer list.
        p_previous = mp_timer_id_head;
        p_current  = p_previous;
    
        while (p_current != NULL)
        {
            if (p_current == p_timer)
            {
                break;
            }
            p_previous = p_current;
            p_current  = p_current->next;
        }
       // ...... other function code 
    }

Another observation I have is that 75% of times it happens when ESB TX device (which sends data to my device) asynchronously resets itself. So I think unsuccessful wireless transmissions somehow related to this behavior.

Since it's happens not very often and it's hard catch I would like to ask for a tip. Maybe I'm doing something wrong? Any help is appreciated!

Parents
  • I don't think the ESB library has something to do with the app_timer as it only use the NRF_TIMER2 not the RTC. I suspect it's the issue with how app_timer is used. But I don't know what could be wrong. You may want to stop the CPU then it's hang in the while loop and check why it couldn't get out. p_current should get to p_timer or get to NULL at some points, unless it's closed loop.

Reply
  • I don't think the ESB library has something to do with the app_timer as it only use the NRF_TIMER2 not the RTC. I suspect it's the issue with how app_timer is used. But I don't know what could be wrong. You may want to stop the CPU then it's hang in the while loop and check why it couldn't get out. p_current should get to p_timer or get to NULL at some points, unless it's closed loop.

Children
No Data
Related