This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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 RTC issue in port_cmsis_systick.c

Hello,

Ported my FreeRTOS application on NRF52 from SDK 12.2.0 to SDK 13.0.0 .My application is using freertos apptimer for timestamping and waking up of device which was working without any issues on SDK 12.2.0,but on SDK 13.0.0 device was stuck insider RTC driver loop and device is not waking up. After replacing port_cmsis_systick.c with file from SDK 12.2.0 this issue is fixed. Can please let me know do we have any issues with RTC in port_cmsis_systick.c in SDK 13.0?

  • We found a corner case which could make the FreeRTOS tick go ahead of RTC tick.

    Please find the attached file and replace this

    port_cmsis_systick.c with the file SDK\external\freertos\portable\CMSIS\nrf52\port_cmsis_systick.c

    For those who are using older SDK, they will get a missing define error with this new file, in that case you need to add the below to FreeRTOSConfig.h file

    /** Implementation note:  Use this with caution and set this to 1 ONLY for debugging  *
    ----------------------------------------------------------
         * Set the value of configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to below for enabling or disabling RTOS tick auto correction:
         * 0. This is default. If the RTC tick interrupt is masked for more than 1 tick by higher priority interrupts, then most likely
         *    one or more RTC ticks are lost. The tick interrupt inside RTOS will detect this and make a correction needed. This is needed
         *    for the RTOS internal timers to be more accurate.
         * 1. The auto correction for RTOS tick is disabled even though few RTC tick interrupts were lost. This feature is desirable when debugging
         *    the RTOS application and stepping though the code. After stepping when the application is continued in debug mode, the auto-corrections of
         *    RTOS tick might cause asserts. Setting configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to 1 will make RTC and RTOS go out of sync but could be
         *    convenient for debugging.
         */
    #define configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 0
    

    Let me know if this helps

    /Susheel

  • Thank you for Fix. Tested for last 15 minutes ,Device is working as expected .

  • Yes it works now. Thank you very much!

  • This issue is still not fixed in the sdk 13.1.0, and it worked by replacing the file port_cmsis_systick.c

  • Is this fixed in the latest SDK14.0 ?

Related