This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

FreeRTOS configTICK_SOURCE

Hi,

I am developing a product using the SoftDevcie s140 and SDK 17.0.2.

I have the problem, that the standard FreeRTOS port defines configTICK_SOURCE to FREERTOS_USE_RTC. Since the RTC is driven by 32768 Hz clock, there is no way to let the system tick run with exactly 1000 Hz, the best approximation is 1024 Hz. And if I change the definition of configTICK_SOURCE to FREERTOS_USE_SYSTICK, which would allow to configTICK_RATE_HZ definition set to 1000 take effect, I get an error compiling components/libraries/timer/app_timer_freertos.c, where line 57-59 reads:

#if configTICK_SOURCE != FREERTOS_USE_RTC
#error app_timer in FreeRTOS variant have to be used with RTC tick source configuration. Default configuration have to be used in other case.
#endif

This app_timer is used by the components/ble/common/ble_conn_state.c code. I tried to comment out that error directive, and could not find any reason it is present, the code seemed to work well when using the timer. So I woul like to know the reason for that error directive, or else how could I create the systick to be 1000Hz instead of 1024.

Regards

  Dirk

  • Hi,

    Freertos by default is configured to use RTC so the the overall timekeeping is done on this low power RTC timer (less accurate but lower power). You can use the SysTick which would elevate the overall power consumption but will give you more accurate time including the 1000Hz which is not possible with 32KHz timers.

    I get an error compiling components/libraries/timer/app_timer_freertos.c, where line 57-59 reads:

    I think that check was there because of legacy reasons. If I think hard about it, I do not see any need for that to be there. app_timer_freertos.c does not care about what timer it is being used internally, so I think you can safely remove that check.

  • Thanks a lot for you help :-)

Related