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

FreeRTOS and RTC

Hello!
I used the "blinky_rtc_freertos" example and transferred ticksource from RTC to SYSTICK in "FreeRTOSConfig.h".
The application has stopped working. What am I doing wrong?

I use nRF52840, SEGGER Embedded Studio for ARM Release 4.12 Build 2018112601.37855 Windows x64, nRF5_SDK_15.2.0,
debug board PCA10056 1.0.0. WINDOWS 10 x64.

Thank you.

FreeRTOSConfig.h

Parents Reply Children
  • This unfortunately breaks all timing in FreeRTOS, since the basis timer will now run roughly at 1/1000 the rated speed.

    Also did you do the stuff with NVIC_SetPriority()? The SoftDevice will generate faults otherwise - it checks internal BTLE timing very precisely.

  • I do not use SoftDevice(yet). I want to know can be used SysTick in FreeRTOS.

  • Hi,

    As wrote, you should stick with using the RTC. There is nothing to gain by using the SysTick timer as the current consumption is negligible (an RTC instance only consumes about 0.1 µA since the LF clock must anyway always be running once you enable the SoftDevice).

  • Hi!

    I realized that SysTimer can not be used. Let me remind you that I do not use SD. I implemented the alarm clock on RTC2, for waking up once a month. What should I do for a deep sleep app with FreeRTOS? Stop RTC1 counter? Thank you.

  • Hi,

    Valery said:
    Let me remind you that I do not use SD.

    SoftDevice or not does not really matter, but since you wrote "SoftDevice(yet)", I take it that you intend to use in in the future? Therefor it makes sense to me to mention it where it might be relevant.

    Valery said:
    implemented the alarm clock on RTC2, for waking up once a month.

    I do not see any reason for using a dedicated RTC for an alarm clock. That is a perfect example of where you want to use an app timer or FreeRTOS timer instead. The app timer library is essentially made to make it easier to make multiple virtual timers form a single physical RTC instance.

    Valery said:
    What should I do for a deep sleep app with FreeRTOS?

    What do you mean by deep sleep? Do you mean system off (where you need an external wakeup source), or do you mean system ON low power mode? As we are discussing waking up once a month, then I assume the latter. And in that case, you essentially just make a normal timer based on the RTC, for instance a app timer or a FreeRTOS timer directly (use xTimerCreate). Note that you may have to wake up more than once a month due to the wraparound time of the RTC, but that has no practical impact on average current consumption.

    In short, make a timer that times out regularly and keep track of time based on that. Other than that, go to system off low power mode (using something like __SEV(); __WFE(); __WFE();, and moving to sd_app_evt_wait when you introduce the SoftDevice.

Related