Hardware-based field-oriented control
HardFOC¶
Open firmware for ESP32 motor and valve controller boards. Motor commutation runs on dedicated FOC driver chips, such as the TMC9660, instead of in MCU software; the firmware around them is C++ on ESP-IDF and FreeRTOS, split into portable chip drivers, a shared core, board HALs and one application per board.
Start with a board, or a chip¶
-
ESP32-C6 with a TMC9660 smart gate driver running FOC on chip, an AS5047U magnetic encoder and CAN (CANopen).
-
ESP32-S3 with on/off and proportional solenoid channels on a TLE92466ED and a MAX22200.
-
Every
hf-*-driveris hardware-agnostic C++: no platform code, one small bus adapter, ESP32 examples.
How the code is layered¶
Figure description and sources
From bottom to top, each layer builds on the one below it as a Git submodule pinned to a commit or tag. Chip drivers are hardware-agnostic C++ libraries with no platform code; each one needs only a small bus adapter. hf-core gathers them with the peripheral interface wrap, the pin configuration and the utility libraries (RTOS wrappers, general helpers, CANopen). A board HAL builds one object per board from hf-core, with one manager per board function. A product is the application firmware for one board, on top of its HAL.
Drawn from: mkdocs.yml; figure module docs/diagrams/figures/hardfoc-layers.py.
Each box is one or more repositories; each arrow is a Git submodule pinned to a commit or tag. The architecture page shows the repositories in each layer.
Documentation¶
Every repository with a documentation site publishes it at https://hardfoc.github.io/<repository>/, versioned:
latest/ is the newest release (or the default branch until the first release), and older versions stay
available. The repository catalogue links each one, with its topics and latest release.
-
Every public repository, searchable by name, description and topic.
-
Drivers, core, HALs and products, and how they are pinned together.
-
How to report a problem, propose a change, and report a vulnerability privately.