nuttx-apps/examples/foc
raiden00pl a7024aea89 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!
2024-10-18 10:43:46 +08:00
..
CMakeLists.txt examples/foc: add support for control loop performance measurements 2023-11-06 09:02:28 +08:00
foc_adc.h include: fix double include pre-processor guards 2022-01-16 17:36:21 +08:00
foc_cfg.h examples/foc: replace CONFIG_INDUSTRY_FOC_* with CONFIG_EXAMPLES_FOC_* 2023-11-18 08:40:16 -08:00
foc_debug.h include: fix double include pre-processor guards 2022-01-16 17:36:21 +08:00
foc_device.c examples/foc: improve perf monitor 2024-10-18 10:43:46 +08:00
foc_device.h examples/foc: add support for control loop performance measurements 2023-11-06 09:02:28 +08:00
foc_fixed16_thr.c examples/foc: protect control loop with critical section 2024-10-18 10:43:46 +08:00
foc_float_thr.c examples/foc: protect control loop with critical section 2024-10-18 10:43:46 +08:00
foc_intf.c fsutils/examples: Include unistd.h explicitly 2023-02-05 08:46:59 +02:00
foc_intf.h include: fix double include pre-processor guards 2022-01-16 17:36:21 +08:00
foc_main.c examples/foc: replace CONFIG_INDUSTRY_FOC_* with CONFIG_EXAMPLES_FOC_* 2023-11-18 08:40:16 -08:00
foc_motor_b16.c examples/foc: ignore error for align and ident routines when motor controller disabled 2024-10-18 10:43:46 +08:00
foc_motor_b16.h examples/foc: replace CONFIG_INDUSTRY_FOC_* with CONFIG_EXAMPLES_FOC_* 2023-11-18 08:40:16 -08:00
foc_motor_f32.c examples/foc: ignore error for align and ident routines when motor controller disabled 2024-10-18 10:43:46 +08:00
foc_motor_f32.h examples/foc: replace CONFIG_INDUSTRY_FOC_* with CONFIG_EXAMPLES_FOC_* 2023-11-18 08:40:16 -08:00
foc_mq.c examples/foc: make sure that the queue is empty before start the control thread 2022-08-27 23:50:58 +08:00
foc_mq.h include: fix double include pre-processor guards 2022-01-16 17:36:21 +08:00
foc_nxscope.c examples/foc: replace CONFIG_INDUSTRY_FOC_* with CONFIG_EXAMPLES_FOC_* 2023-11-18 08:40:16 -08:00
foc_nxscope.h examples/foc: add phase angle observer support (sensorless mode) 2023-10-19 19:33:43 +08:00
foc_parseargs.c examples/foc: replace CONFIG_INDUSTRY_FOC_* with CONFIG_EXAMPLES_FOC_* 2023-11-18 08:40:16 -08:00
foc_parseargs.h examples/foc: move validate_args to parseargs file 2022-11-04 02:07:15 +08:00
foc_perf.c examples/foc: improve perf monitor 2024-10-18 10:43:46 +08:00
foc_perf.h examples/foc: improve perf monitor 2024-10-18 10:43:46 +08:00
foc_thr.c examples/foc: replace CONFIG_INDUSTRY_FOC_* with CONFIG_EXAMPLES_FOC_* 2023-11-18 08:40:16 -08:00
foc_thr.h examples/foc: fix snprintf warning 2024-10-18 10:43:46 +08:00
Kconfig examples/foc: protect control loop with critical section 2024-10-18 10:43:46 +08:00
Make.defs Make.defs: Change "ifeq ($(XXX),y)" to "ifneq ($(XXX),) 2022-10-16 14:59:08 +02:00
Makefile examples/foc: add support for control loop performance measurements 2023-11-06 09:02:28 +08:00