banner

Motor control

Synchronisation & Timing
The first priorities of every real-time application are proper timing, synchronisation and deterministic system response, and special attention must be paid to these aspects when designing motor control software. In essence, the process sounds very simple: the system reads sensor values, processes the control algorithm, monitors system safety and manages the output stage by adjusting the duty cycle of the PWM output.
Small timing errors can lead to serious system response errors, erratic operation and poor performance. To ensure that everything works as expected, it is critical to stay synchronised and ensure system determinism. Here, I would like to emphasise that we are dealing with a ‘hard real-time system’ and meeting tight deadlines is absolutely critical.
The motor controller software can be implemented as a bare-metal solution without an operating system, using a suitable RTOS (real-time operating system), or as a multi-core hybrid solution, where some CPU cores run in bare-metal mode while others use an operating system. Bare-metal solutions are always based on an interrupt-driven design, where interrupts handle time-critical tasks and ensure that everything happens at precise intervals.
Whether it is a bare-metal, RTOS or hybrid solution, timing analysis, task prioritisation and security analysis must be performed to ensure efficient and reliable system performance.
Timing analysis ensures that all tasks are completed on time. This includes considering the worst-case execution time for each task. Some of the major critical tasks in motor control include sensor data acquisition, execution of control algorithms via PWM signal generation, fault detection and handling, emergency stop and safety functions, real-time communication with other system components, and synchronisation with external systems.

微信图片_20240508092932

Real-time operating system (RTOS)
Choosing the right RTOS for your motor control application is critical to ensuring high performance, reliability and safety. Key considerations include the RTOS’s real-time performance, resource efficiency including memory footprint and CPU usage, and priority-based preemptive scheduling processing. Efficient and fast interrupts, as well as system reliability and robustness, are also key factors. Vendor support and documentation, compatibility with hardware, and the availability of development tools (such as IDEs, debuggers, and analysers) and ecosystems (including libraries and code samples) play an important role. Finally, the licensing terms and cost of the RTOS should also be considered.
Considering the various factors and specific requirements of motor control applications, FreeRTOS, a popular open source real-time operating system known for its efficiency and versatility, is an excellent choice. This choice is particularly beneficial in scenarios where cost-effectiveness, operational efficiency, system flexibility, reliability and robustness, ease of use, extensive hardware support and resource efficiency are key considerations.


Post time: May-08-2024