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.