Skip to content

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.

Get started All repositories HardFOC on GitHub

Start with a board, or a chip

How the code is layered

Layer diagram, top to bottom: products (hardfoc-vortex-v1, hardfoc-flux-v1) build on board HALs (hf-hal-vortex-v1, hf-hal-flux-v1), which build on hf-core (hf-core-drivers and hf-core-utils), which gathers the hardware-agnostic chip drivers (hf-*-driver) and the peripheral interface wrap.Layer diagram, top to bottom: products (hardfoc-vortex-v1, hardfoc-flux-v1) build on board HALs (hf-hal-vortex-v1, hf-hal-flux-v1), which build on hf-core (hf-core-drivers and hf-core-utils), which gathers the hardware-agnostic chip drivers (hf-*-driver) and the peripheral interface wrap.
Four layers, each a set of repositories
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.

  • Repositories

    Every public repository, searchable by name, description and topic.

  • Architecture

    Drivers, core, HALs and products, and how they are pinned together.

  • Contribute

    How to report a problem, propose a change, and report a vulnerability privately.