incubator-nuttx/Documentation/components/drivers/character/foc.rst

49 lines
1.8 KiB
ReStructuredText
Raw Normal View History

====================
FOC Driver Interface
====================
Field Oriented Control (FOC) is a common technique to control
either synchronous or asynchronous alternating current machines.
The main goal of FOC is to control direct current (Id) and
quadrature current (Iq) in powered device.
The device on the kernel side is responsible for the following:
#. update PWM duty cycles
#. return ADC current samples
#. synchronize user-space with PWM events
Fix various typos in comments and documentation Fix typos in these files: * Documentation/components/drivers/character/foc.rst * Documentation/guides/cpp_cmake.rst * Kconfig * arch/arm/src/imxrt/imxrt_lpspi.c * arch/arm/src/kinetis/kinetis_spi.c * arch/arm/src/kl/kl_spi.c * arch/arm/src/lpc31xx/lpc31_spi.c * arch/arm/src/nrf52/nrf52_radio.h * arch/arm/src/s32k1xx/s32k1xx_lpspi.c * arch/arm/src/stm32/Kconfig * arch/arm/src/stm32/stm32_adc.c * arch/arm/src/stm32/stm32_foc.c * arch/arm/src/stm32/stm32_foc.h * arch/arm/src/stm32/stm32_pwm.c * arch/arm/src/stm32/stm32_spi.c * arch/arm/src/stm32f0l0g0/stm32_spi.c * arch/arm/src/stm32f7/Kconfig * arch/arm/src/stm32f7/stm32_spi.c * arch/arm/src/stm32h7/Kconfig * arch/arm/src/stm32h7/stm32_allocateheap.c * arch/arm/src/stm32h7/stm32_fmc.c * arch/arm/src/stm32h7/stm32_fmc.h * arch/arm/src/stm32h7/stm32_pwm.c * arch/arm/src/stm32h7/stm32_qspi.c * arch/arm/src/stm32h7/stm32_spi.c * arch/arm/src/stm32l4/stm32l4_pwm.c * arch/arm/src/stm32l4/stm32l4_spi.c * arch/arm/src/stm32l5/Kconfig * arch/arm/src/stm32l5/stm32l5_spi.c * arch/renesas/src/rx65n/rx65n_dtc.c * arch/renesas/src/rx65n/rx65n_usbdev.c * arch/risc-v/src/rv32m1/rv32m1_serial.c * boards/arm/stm32/b-g431b-esc1/src/stm32_foc.c * boards/arm/stm32/nucleo-f103rb/src/stm32_foc_ihm07m1.c * boards/arm/stm32/nucleo-f302r8/src/stm32_foc_ihm07m1.c * boards/arm/stm32h7/nucleo-h743zi2/README.txt * boards/risc-v/rv32m1/rv32m1-vega/README.txt * boards/sim/sim/sim/scripts/Make.defs * drivers/1wire/1wire.c * drivers/1wire/1wire_internal.h * drivers/lcd/Kconfig * drivers/syslog/ramlog.c * fs/fat/Kconfig * libs/libc/debug/Kconfig * libs/libc/machine/Kconfig * libs/libc/stdio/lib_libvsprintf.c * libs/libc/stdlib/lib_div.c * libs/libc/stdlib/lib_ldiv.c * libs/libc/stdlib/lib_lldiv.c * libs/libdsp/lib_observer.c
2021-07-04 23:31:21 +08:00
The NuttX FOC driver is split into two parts:
#. An "upper half", generic driver that provides the common FOC
interface to application level code,
#. A "lower half", platform-specific driver that implements
the low-level logic to implement the FOC functionality
Files supporting FOC can be found in the following locations:
- ``include/nuttx/motor/foc/foc.h``.
"Upper-half" FOC interface available for the user-space.
- ``include/nuttx/motor/foc/foc_lower.h``.
"Lower-half" FOC interface.
- ``drivers/motor/foc/foc_dev.c``.
The generic "upper half" FOC driver.
The majority of the functionality available to the application
is implemented in driver ioctl calls. Supported ioctl commands:
- ``MTRIOC_START`` - Start the FOC device, arg: none.
- ``MTRIOC_STOP`` - Stop the FOC device, arg: none.
- ``MTRIOC_GET_STATE`` - Get the FOC device state,
arg: ``struct foc_state_s`` pointer.
This is a blocking operation that is used to synchronize the user space
application with ADC samples.
- ``MTRIOC_CLEAR_FAULT`` - Clear the FOC device fault state,
arg: none.
- ``MTRIOC_SET_PARAMS`` - Set the FOC device operation parameters,
arg: ``struct foc_params_s`` pointer.
- ``MTRIOC_SET_CONFIG`` - Set the FOC device configuration,
arg: ``struct foc_cfg_s`` pointer.
- ``MTRIOC_GET_INFO`` - Get the FOC device info,
arg: ``struct foc_info_s`` pointer.