You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
examples/foc: protect control loop with critical section
If the controller frequency is high, system timer interrupts will
eventually interrupt the controller function, thereby increasing the
execution time. This may lead to skipping the control cycle, which
negatively affects the control algorithm.
With this option enabled, interrupts are disabled for the duration
of the controller function execution.
Here example results from CONFIG_EXAMPLES_FOC_PERF output
for b-g431b-esc1 board with CONFIG_EXAMPLES_FOC_NOTIFIER_FREQ=10000:
1. CONFIG_EXAMPLES_FOC_CONTROL_CRITSEC=n
exec ticks=5258
nsec=30929
per ticks=21268
nsec=125105
2. CONFIG_EXAMPLES_FOC_CONTROL_CRITSEC=y
exec ticks=3428
nsec=20164
per ticks=19203
nsec=112958
The difference is ~12us!
0 commit comments