I wanted to ask about a couple of points on proper system design using the FreeRTOS primitives, now that I’m trying in earnest to port my old timer-driven code to FreeRTOS.
Of course, I understand that there’s a limit to how much ‘free’ help I can solicit, but this is for an academic project, which makes it a little different situation. In the end, it’ll all be open source on GitHub, and could provide as a FreeRTOS example.
The project is a small robot with a number of autonomy-related tasks all running. The uncertainty I have is over how to correctly set up each of these tasks.
For example, there is an IMU reading task @ 1khz that updates values, providing a zeroth-order hold on gyro & accelerometer values. That seems like a good candidate for a medium-priority periodic task.
But there’s also a motor control task, that reads back-EMF and updates PID controllers and sets duty cycles, also running at 1Khz. Should this just be set up as a very high priority software task, or should I keep it as a hardware timer interrupt driven task?
Our system also uses SPI peripherals both with busy waiting (for single bytes) or through a hardware interrupt and user callback for DMA for block writes. Should I be using a gatekeeper task for each SPI channel, or just a mutex?
I know that’s a lot, but if anyone could provide insight into how to address any of those system design issues, advice would be greatly appreciated. I am searching around for examples that use FreeRTOS for similar applications, but haven’t quite found something I can draw from just yet.