I have been looking into FreeRTOs for a bit now and am really liking it. I come from high level applicaiton coding (OO programming), so the idea of using multiple independant tasks all managed by a central scheduler sounds way better than one large infinite-loop-main-function program (from a code architecture POV).
I still though have had some issues trying to understand something. The documentation says that the RTOS tick frequency should range from 100Hz to 1KHz. Any more than that and the task switching overhead becomes non-insignificant, and the individual time slices for each task running at the same priority become smaller (kind of like "thrashing" if I remember my CompSci courses correctly).
So that means that the smallest amount of time that we can periodically do something is between 1msec and 10msec. So the question is, what if we have to service a device every msec? Then we’d have to increase our tick frequency to 1KHz and then every tick, the task for that device would execute, effectively starving out the other tasks. If we’re running on a 96Mhz chip (we’re using a STR911), then a task that happens every 1msec shouldn’t effectively hog the whole processor. But I don’t want to really increase my tick rate to like 1MHz because of the aforementioned issues with doing that.
Now I know I could handle this task in a hardware interrupt (i.e. configure one of the TIMER peripherals for every 1KHz and handle it right there), but that would mean I have a "task" (i.e. a chunk of firmware algorithm) running outside of the RTOS scheduler…which seems to kind of defeat the purpose?
Has anyone run into this before? What is the way you go about handling really frequent items with this RTOS?
Thanks for the info and the newbie help