Skip to content

HardFOC driver

Vortex Driver

A C++20 CANopen host client for HardFOC Vortex devices. It builds NMT and expedited SDO download frames with named CiA 301 and CiA 402 objects and hands them to a CAN transport you provide, on any MCU or a PC.

Quickstart API guide Source on GitHub

The driver has no platform code. You give it an object with one method, send(), that puts a classic CAN frame on the bus; it does the CANopen encoding: COB-IDs, command specifiers, little-endian payloads. It has no heap, no threads and no dependency on CANopenNode, ESP-IDF or the HardFOC HAL.

The device on the other end of the bus Vortex V1 HardFOC
MCU
ESP32-C6 with a TWAI (classic CAN) controller
CAN
TWAI TX GPIO14, RX GPIO15, external transceiver; 500 kbit/s in the Vortex V1 HAL
Motor control
TMC9660 smart gate driver with on-chip FOC
CANopen role
Server (slave), with CANopenNode from the HAL's third_party/; its object dictionary is authoritative
This driver
The client side: NMT commands and expedited SDO downloads to a node ID

Vortex V1 HAL ยท Pin map

What you get

  • NMT in one call. sendNmt() with NmtCommand::Start, Stop, PreOperational, ResetNode or ResetCommunication, to one node or all. See API guide.
  • Expedited SDO writes. sdoDownloadExpedited() writes 1, 2 or 4 bytes to any index and sub-index, with the CiA 301 command specifier for the size. See API guide.
  • Named objects. Controlword, statusword, modes of operation, position and velocity actual value, error register and a HardFOC vendor range. See Hardware.
  • Any CAN driver. One virtual method to implement; a BaseCan adapter is ten lines. See Porting.
  • Checked bytes. The code on these pages is compiled and run on the host against a loopback transport that compares every frame. See Testing and CI.

Transmit only

The session sends requests and does not read the bus: no SDO responses or uploads, no PDOs, heartbeats or EMCY. Read those with your CAN driver, hf-utils-canopen or CANopenNode. API guide lists what to use for each.

Where to go next

  • Quickstart


    Wire the bus, write the transport, start a node.

  • Hardware


    Bus settings, COB-IDs, frame layouts, objects.

  • API guide


    NMT, SDO and the CiA 402 state machine.