Let’s illustrate this issue with a specific example. How does a typical task system handle information in embedded systems? The process looks like this:
• Retrieve new data
• Filter/process data
• Output data
Pretty straightforward, right? We know that for real-time embedded system design, the main goal is determinism and minimizing jitter.
The three steps above will maximize jitter rather than minimize it, which is not good for the real-time nature of the entire system.
Assuming a motor control task reads the latest analog current and voltage measurements, then runs through a PID controller. The PID controller will provide output for the new motor state. The problem is that depending on the design of the controller, the number of times it runs through the PID controller may not occur within the same clock cycle. If we include the possibility of interrupts triggering during the PID calculation or task preemption, there can be quite a wide range of timing values. As a result, the motor output is never consistently updated. It moves slightly, causing jitter that can affect the motor’s response.
Now, by understanding how data is processed, you can change the order of operations:
• Output the previous result
• Retrieve new data
• Filter/process data
In this case, the new output is always sent to the motor at the start of the thread (loop or otherwise) before further processing or running other non-deterministic tasks.
Yes, we are acting on data that may be slightly earlier, but we can justify this and significantly reduce dynamic jitter.
Conclusion: When you break down the work we do for designing and implementing embedded software, it all comes down to data. For more information, refer to my earlier article: Three Tips for Data-Centric Software Design (click “Read the original” at the end of the article to view it).
END
Source: MicTechCopyright belongs to the original author. If there is any infringement, please contact for deletion..▍Recommended ReadingSupply Cut! Huawei No Longer Has Windows AvailableCompiled STM32 Related Open Source ProjectsCommon VS Code Plugins for Microcontroller Development→ Follow for more updates ←