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

Decrease the timer resolution of SDK 14

How can we decrease the resolution of the timer to 500 ms in SDK 14? The minimum resolution I could get to was 1 ms by changing the APP_TIMER_CONFIG_RTC_FREQUENCY macro to 31. 

Thanks

Atul

Parents
  • The RTC peripheral has a 12 bit prescaler. So the max value for prescaler will be (2^12) - 1 = 4095. This will give you a counter resolution of 125 ms with an overflow of 582.542 hours.

    If you want the l̶o̶w̶e̶s̶t̶ highest counter resolution, you can set the prescaler (APP_TIMER_CONFIG_RTC_FREQUENCY) to 0. This will give you a counter resolution of 30.517 us and an overflow of 512 seconds.

  • The counter resolution of 30.517 us is the highest resolution right, not the lowest one. 

    Is there any way in which I can get a resolution of 500 ms? And even if I make do with the 125 ms resolution, where should I change the PRESCALER register? I didn't see any such command in the documentation of SDK 14. I could change the APP_TIMER_CONFIG_RTC_FREQUENCY macro, but in the description, there are some values provided to us, and I suppose, only those can be used as the possible values of the macro. I am attaching the code from the sdk_config file. 

    // <o> APP_TIMER_CONFIG_RTC_FREQUENCY  - Configure RTC prescaler.
     
    // <0=> 32768 Hz 
    // <1=> 16384 Hz 
    // <3=> 8192 Hz 
    // <7=> 4096 Hz 
    // <15=> 2048 Hz 
    // <31=> 1024 Hz 
    
    #ifndef APP_TIMER_CONFIG_RTC_FREQUENCY
    #define APP_TIMER_CONFIG_RTC_FREQUENCY 31        
    #endif
    

Reply
  • The counter resolution of 30.517 us is the highest resolution right, not the lowest one. 

    Is there any way in which I can get a resolution of 500 ms? And even if I make do with the 125 ms resolution, where should I change the PRESCALER register? I didn't see any such command in the documentation of SDK 14. I could change the APP_TIMER_CONFIG_RTC_FREQUENCY macro, but in the description, there are some values provided to us, and I suppose, only those can be used as the possible values of the macro. I am attaching the code from the sdk_config file. 

    // <o> APP_TIMER_CONFIG_RTC_FREQUENCY  - Configure RTC prescaler.
     
    // <0=> 32768 Hz 
    // <1=> 16384 Hz 
    // <3=> 8192 Hz 
    // <7=> 4096 Hz 
    // <15=> 2048 Hz 
    // <31=> 1024 Hz 
    
    #ifndef APP_TIMER_CONFIG_RTC_FREQUENCY
    #define APP_TIMER_CONFIG_RTC_FREQUENCY 31        
    #endif
    

Children
Related