Part Number: LAUNCHXL-F2800157
I'm transitioning a motor controller to using FreeRTOS for task scheduling. However, I'm relatively new to using an RTOS, and am uncertain about the best way to execute high frequency tasks:
1. Some of my tasks need to run at 10 kHz. It seems ridiculous to run FreeRTOS fast enough to schedule these, so I think I have to use a timer and interrupts to run these, via deferred interrupt handling (https://www.freertos.org/deferred_interrupt_processing.html).
2. Some of my tasks need to run at 1 kHz. I'm not sure whether I should try to run FreeRTOS faster (perhaps ~5kHz?) or use a timer and deferred interrupt handling for these as well.
3. FreeRTOS noob question: If I do use a timer and deferred interrupt handling, how do I avoid messing up some in-progress task when an interrupt happens mid-task? Ie, if taskA is interrupted and the interrupt is going to resume taskB, is there a way to manually save the taskA context so everything is in order when taskB is completed and we return to taskA?
4. Finally, any other obvious mistakes I'm making here? Or advice to give?
I'm mainly using https://www.nxp.com/docs/en/application-note/AN12881.pdf as a reference for this work.