app_timer not working without softdevice

I am working wih  \nrf5_sdk_17.1.0_ddde560\examples\802_15_4\wireless_uart\secure\first\

And I want to add app timer to start a peroid works.

unfortunately, this timer not worked.  

Hope need your help. 

Parents
  • Hello,

    Do you get an error if you uncomment the app_timer_start() function in main()? 

    Best regards,

    Vidar

  • APP_TIMER_DEF(app_timer_id);
    static void mg_app_timeout_handler(void *p_context)
    {
    	NRF_LOG_INFO("mg_app_timeout_handler.");
    }
    
    /**
     * @brief Function for application main entry.
     */
    int main(void)
    {
        ral_irq_handler_import();
        APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
        NRF_LOG_DEFAULT_BACKENDS_INIT();
        NRF_LOG_INFO("Wireless UART example started.");
    		
        app_task_init();
        sys_task_post(APP_TASK_ID);
    		
       //clock_init();
    	 APP_ERROR_CHECK(app_timer_init());
    	mg_nrf_scheduler_init();
    	
        mg_app_button_init();
    	
    		APP_ERROR_CHECK(app_timer_create(&app_timer_id, APP_TIMER_MODE_REPEATED,
                                       mg_app_timeout_handler));
    		APP_ERROR_CHECK(app_timer_start(app_timer_id, APP_TIMER_TICKS(1000), NULL));
        while (true)
        {
    #if APP_SCHEDULER_ENABLED
          app_sched_execute();
    #endif
            sys_task_run();
        }
    }

    I'm sorry, this is the correct code, there's no errors.

Reply
  • APP_TIMER_DEF(app_timer_id);
    static void mg_app_timeout_handler(void *p_context)
    {
    	NRF_LOG_INFO("mg_app_timeout_handler.");
    }
    
    /**
     * @brief Function for application main entry.
     */
    int main(void)
    {
        ral_irq_handler_import();
        APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
        NRF_LOG_DEFAULT_BACKENDS_INIT();
        NRF_LOG_INFO("Wireless UART example started.");
    		
        app_task_init();
        sys_task_post(APP_TASK_ID);
    		
       //clock_init();
    	 APP_ERROR_CHECK(app_timer_init());
    	mg_nrf_scheduler_init();
    	
        mg_app_button_init();
    	
    		APP_ERROR_CHECK(app_timer_create(&app_timer_id, APP_TIMER_MODE_REPEATED,
                                       mg_app_timeout_handler));
    		APP_ERROR_CHECK(app_timer_start(app_timer_id, APP_TIMER_TICKS(1000), NULL));
        while (true)
        {
    #if APP_SCHEDULER_ENABLED
          app_sched_execute();
    #endif
            sys_task_run();
        }
    }

    I'm sorry, this is the correct code, there's no errors.

Children
Related