XXooptRobotics

Priority inversion in a real-time control loop

mediumsubjectivesystem design

General

On a robot's microcontroller you run three tasks under a fixed-priority preemptive RTOS: a high-priority motor-control task HH, a medium-priority telemetry task MM, and a low-priority logging task LL. Both HH and LL access a shared SPI bus guarded by the same mutex. You observe that HH occasionally misses its deadline even though the CPU is far from fully loaded. Explain the mechanism causing this, why MM makes it worse, and how you would fix it. Also state one way you would detect or measure the problem on real hardware.