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

app_timer_stop return 0x04(NO MEM) error

Hi, all..

An error occurs as soon as it connect and disconnect through advertising. Timer interrupt is currently running on the main function..

and then I found error meaing.. below.. 

 

 * @retval     NRF_ERROR_NO_MEM          If the timer operations queue was full.
 */
ret_code_t app_timer_stop(app_timer_id_t timer_id);

so 'timer operation queue was full' is the reason..

then where should I check? 

BR,

lyrics

Parents Reply Children
  • APP_TIMER_CONFIG_OP_QUEUE_SIZE is set to 10..

    so I increase to 20, but still same error. Do I have to set a higher value?..

    My project is based 'ble_app_uart.c'.. and I added scan module / two timer interrupt..(ms and ns)

    Also it works first connection! 

  • For a specific app I had to increase above 100 because I needed repeated calls to app_timer_start and app_timer_stop, that fixed the issue

    Best regards,

  • My project seems to be a different matter. The error is still not fixed..

  • Hi,

    lyrics said:
    My project is based 'ble_app_uart.c'.. and I added scan module / two timer interrupt..(ms and ns)

     What timer instance are you using? Are you using  ble_app_uart_c i.e the central NUS example? If you are then it already has the scanner module enabled. Can you share your code?

    regards

    Jared 

  • Hi, Jared

    Are you using  ble_app_uart_c i.e the central NUS example?

    My project is based ble_app_uart ! So I added scan module.

    I use NRF_DRV_TIMER_INSTANCE.

    This is my timer_init code.. and call every 200ns, 1000ns (1ms) in the main.

    static void timers_init(void)
    {
        ret_code_t err_code ;
        uint32_t time_ticks, time_ticks_us;
    
        /** added */
        nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
        timer_cfg.frequency = 0;
        err_code = nrf_drv_timer_init(&TIMER_MS, &timer_cfg, timer_ms_event_handler);
        APP_ERROR_CHECK(err_code);
    
        time_ticks = nrf_timer_us_to_ticks(time_ms, 0);
        nrf_drv_timer_extended_compare(
             &TIMER_MS, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
        nrf_drv_timer_enable(&TIMER_MS);
    
        //us_timer
        nrf_drv_timer_config_t timer_cfg_2 = NRF_DRV_TIMER_DEFAULT_CONFIG;
        timer_cfg_2.frequency = 0;
        err_code = nrf_drv_timer_init(&TIMER_US, &timer_cfg_2, timer_us_event_handler);
        APP_ERROR_CHECK(err_code);
    
        time_ticks_us = nrf_timer_us_to_ticks(time_us, 0);
        nrf_drv_timer_extended_compare(&TIMER_US, 
                                        NRF_TIMER_CC_CHANNEL1,
                                        time_ticks_us, 
                                        NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK, 
                                        true);
        nrf_drv_timer_enable(&TIMER_US);
    }

    This is my main func..

    while(1)
    {
        sys_us_timer();
        sys_ms_timer();
    }

Related