FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [August 2014 Threads]
Is there a right or "best practices" FreeRTOS way to keep an accurate millisecond timer?
In the project that I am slowly porting, a 1ms counter was kept by a hardware timer peripheral interrupting at 1Khz, but that timer also existed to launch into a 1Khz task, and a 500Hz task (divided via a toggling bit).
Moving to FreeRTOS, to keep an accurate 1ms counter for the whole system, should I just keep that one hardware timer dedicated to counting milliseconds? Or should I always derive my sense of time in the system from tick periods?
I mean, I'm sure both methods could be made to work, but I am trying to learn & achieve proper RTOS implementation here.
Hand in hand with this, is there a guideline for how fast I should set my tick rate if I have several 1Khz tasks? The MCU clock speed is 40Mhz.
I dont think there is a 'right' way. However it works for you. I would probably set the tick interrupt to 1KHz then just use xTaskGetTickCount().
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.