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

FreeRTOS changes for better RTOS timer accuracy

Hi,

I have made some changes with how we update tick timer inside FreeRTOS and the results are promising . The improvement is

  1. RTOS tick will auto correct if masked for more than one tick. BLE activity will not affect the RTOS tick accuracy. No ticks will be lost.
  2. better RTOS timers resolution (max deviation noticed with BLE traffic is 2%).
  3. TicklessIDLE wakeup tick correction is simplified using RTC overflow feature
  4. More stable BLE connections due to increased efficiency of RTOS timers.

I have tested this for few hours but I need you guys to give feedback on how this improves your setup.

  • NOTE. tested on SDK12.x only (might work with other SDKs, but i am not sure)

    apply this patch in SDK\external\freertos folder

    No_Ticks_lost.patch

    Discussion for a clarification for vTaskStepTick is started here
    Update: The change in task.c::vTaskStepTick is now confirmed by FreeRTOS team to be safe and required in our case

    EDIT: 19th May 2017

    DO NOT USE THIS PATCH IN YOUR NEW DESIGNS. better patch available in here

  • Aryan,

    I tried to compile this new file but I can't link vTaskStepTick when not using TicklessIDLE. From your initial post it seems like this should work for either Tick mode and Tickless mode.

    Thanks, Darren

  • Hi Darren,

    I attached a patch for it. I think it is unfair to make vTaskStepTick available only for tickless mode. I have created a post in FreeRTOS forum to convey this.
    Sourceforge post

    Anyways, since we have source code, I have removed this restriction for now by removing the compile flag. This must be agreeable given the nature of our BLE stack.

  • Is the patch for the nordic SDK 12. or 12.2 or does it not matter?

    Sorry. I cant read I see that the answer is below.

  • Hi Darren, did you get time to test this?

1 2 3 4