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

Queries on Application Timer functionality

Hello,

 

I am using nRF52832, SDK_15.3.0, S132 SoftDevice and Segger for flash the image. I am using ‘ble_app_blinky’.

 

I have gone through “Application Timer” tutorial.

https://devzone.nordicsemi.com/nordic/tutorials/b/software-development-kit/posts/application-timer-tutorial

 

I have few queries.

 

1) Using “Application Timer module” how many max timers / handlers can be executed at a time with APP_TIMER_MODE_REPEATED. At application level I need 5 timers. Since RTC1 has CC[0..3] whether I can use only 4 at a time.

  1. a) Whether APP_TIMER_CONFIG_OP_QUEUE_SIZE is for that purpose only ?

 

2) I want to sleep & wakeup periodically for every 30 minutes. For this I need to change PRESCALER. To my understanding there will be only one prescaler for entire timer module. So if I change, will there be any impact on existing timers and SoftDevice (Not sure whether SoftDevice uses Application Timer).

 

3) I want to stop LED after 10 blink automatically. In this case with some conditions whether can I call app_timer_stop() within same handler (repeated_timer_handler()).

        

static void repeated_timer_handler(void * p_context)
{

            :
            :

    err_code = app_timer_stop(m_repeated_timer_id);
    APP_ERROR_CHECK(err_code);
            
            :
}

 

 4) Whether handler will execute in Interrupt context. I want to read data over TWI and write data into Flash. Whether all there can be called within timer handler.

                            

static void repeated_timer_handler_1(void * p_context)
{
        :
        
        // Read sensor data.
        
        :
        :
        
        // Write data into Flash
        nrf_fstorage_write( ... );
        
        :
        :
}

 

Thanks & Regards

Vishnu Beema

Parents
  • 1) Using “Application Timer module” how many max timers / handlers can be executed at a time with APP_TIMER_MODE_REPEATED. At application level I need 5 timers. Since RTC1 has CC[0..3] whether I can use only 4 at a time.

     I am not sure what the maximum amount of timers are, and what the limiting factor is, but I tried adding 6 timers to an application and that worked fine. I don't think APP_TIMER_CONFIG_OP_QUEUE_SIZE is the limiting factor, since I set it to 1 and all the 6 timers still fires. I can look into it further if you would like a more precise answer.


    2) I want to sleep & wakeup periodically for every 30 minutes. For this I need to change PRESCALER. To my understanding there will be only one prescaler for entire timer module. So if I change, will there be any impact on existing timers and SoftDevice (Not sure whether SoftDevice uses Application Timer).

     The APP_TIMER_CONFIG_RTC_FREQUENCY (RTC prescaler) is not used by the Softdevice

     

    3) I want to stop LED after 10 blink automatically. In this case with some conditions whether can I call app_timer_stop() within same handler (repeated_timer_handler()).

     No problem, you can do this

     4) Whether handler will execute in Interrupt context. I want to read data over TWI and write data into Flash. Whether all there can be called within timer handler.

     This shouldn’t be a problem

    Best regards,

    Simon

  • Hello Simon,

    Could you able to cross check with below issue, while writing into Flash within event handler.

  • I have been quite busy lately, my apologies for that. Have you been able to figure this out?

    Best regards,

    Simon

  • Hi Simon,

    As mentioned above, if I call Flash write within event handler, code gets hanged. To avoid this I set a flag to true in event handler and in ideal loop I will write data into Flash and reset the flag. With this its working fine.

    Please let me know is this expected behavior, if not let me know any other alternate approach.

    Thanks & Regards
    Vishnu Beema

Reply Children
Related