|
HF-TMC9660 Driver 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC9660
|
Main class representing a TMC9660 motor driver in Parameter Mode. More...
#include <tmc9660.hpp>
Classes | |
| struct | Brake |
| Subsystem controlling the brake chopper and mechanical brake features. More... | |
| struct | CurrentSensing |
| Subsystem for configuring ADC-based current measurement. More... | |
| struct | FeedbackSense |
| Subsystem for feedback sensor configuration. More... | |
| struct | GateDriver |
| Subsystem for configuring the MOSFET gate driver. More... | |
| struct | Globals |
| Convenience helpers for reading and writing global parameters. More... | |
| struct | GPIO |
| Subsystem for configuring general-purpose IOs (GPIOs). More... | |
| struct | Heartbeat |
| Subsystem for configuring the communication watchdog (heartbeat). More... | |
| struct | IIT |
| Subsystem for motor thermal overload protection via I²t integration. More... | |
| struct | MotorConfig |
| Motor configuration and control subsystem. More... | |
| struct | NvmStorage |
| Subsystem for storing and recalling parameters from nonvolatile flash. More... | |
| struct | PositionControl |
| Subsystem for position control (FOC outer loop). More... | |
| struct | Power |
| Subsystem for entering low-power hibernation mode and configuring wake. More... | |
| struct | Protection |
| Subsystem for motor protection features. More... | |
| struct | RamDebug |
| Subsystem for debug and data logging features. More... | |
| struct | Ramp |
| Hardware 8-segment acceleration/dec-acc profile controller. More... | |
| struct | ReferenceSearch |
| Subsystem for executing a reference search (homing) routine. More... | |
| struct | Script |
| Subsystem for TMCL script execution control. More... | |
| struct | StepDir |
| Subsystem for controlling the STEP/DIR pulse input interface. More... | |
| struct | StopEvents |
| Configure automatic stop/latch behaviour for deviation, switches. More... | |
| struct | Telemetry |
| Subsystem for reading various telemetry and status information from the driver. More... | |
| struct | TorqueFluxControl |
| Subsystem for torque and flux current control (FOC inner loop). More... | |
| struct | VelocityControl |
| Subsystem for velocity control (FOC middle loop). More... | |
Public Types | |
| enum class | BootloaderInitResult { Success , NoConfig , Failure } |
| Bootloader initialization result codes. More... | |
| using | GlobalParamBankVariant |
Static Public Member Functions | |
| static constexpr const char * | GetDriverVersion () noexcept |
| Get the compiled driver version string. | |
| static constexpr uint8_t | GetDriverVersionMajor () noexcept |
| Get the compiled driver major version number. | |
| static constexpr uint8_t | GetDriverVersionMinor () noexcept |
| Get the compiled driver minor version number. | |
| static constexpr uint8_t | GetDriverVersionPatch () noexcept |
| Get the compiled driver patch version number. | |
Private Attributes | |
| CommType & | comm_ |
| sending/receiving data. | |
| uint8_t | address_ |
| std::unique_ptr< tmc9660::TMC9660Bootloader< CommType > > | bootloader_ |
| Bootloader helper. | |
| const tmc9660::BootloaderConfig * | bootCfg_ |
| const uint8_t | tmcCRCTable_Poly7Reflected [256] |
Main class representing a TMC9660 motor driver in Parameter Mode.
The TMC9660 class provides a comprehensive high-level interface for configuring and controlling the TMC9660 motor driver chip. This class abstracts the complex low-level register operations into intuitive, easy-to-use methods for motor control applications.
The TMC9660 class supports a wide range of motor control features:
The class uses a CRTP-based communication interface for communication, making it completely agnostic to the physical communication layer. This allows the same code to work with SPI, UART, or other communication methods by simply providing the appropriate communication interface implementation.
The driver is a template class that takes the communication interface type as a template parameter, providing compile-time polymorphism with zero runtime overhead.
All configuration and control is performed by sending TMCL (Trinamic Motion Control Language) commands to read and write parameter values. This provides a standardized interface that is consistent across different Trinamic motor drivers.
Without proper bootloader initialization, the TMC9660 will not respond to TMCL commands and motor control will not function.
| CommType | The communication interface type (must inherit from SpiCommInterface<CommType> or UartCommInterface<CommType>) |
| using tmc9660::TMC9660< CommType >::GlobalParamBankVariant |
Bootloader initialization result codes.
These indicate the outcome of the bootloaderInit() method.
| Enumerator | |
|---|---|
| Success | Successfully initialized the bootloader. |
| NoConfig | No bootloader configuration provided. |
| Failure | Failed to initialize the bootloader. |
|
noexcept |
|
noexcept |
Destructor for TMC9660, cleans up resources.
|
noexcept |
Complete bootloader initialization and transition to parameter mode.
This method performs the complete initialization sequence:
| cfg | Bootloader configuration. MUST set cfg.boot.boot_mode = BootMode::Parameter for motor control functionality. If nullptr, uses configuration provided during construction. |
| perform_reset | If true (default), performs hardware reset sequence (RST pin toggle
|
| retrieveBootloaderInfo | If true, retrieves and logs all available bootloader information (version, features, git info, etc) for debugging. |
| failOnVerifyError | If true (default), initialization fails on read-back verification errors. If false, logs warnings but continues despite verification failures (useful for debugging or when some configs are expected to fail). |
|
inlinenoexcept |
Get the communication interface used by this TMC9660 instance.
|
inlinenoexcept |
Exit parameter mode and return to bootloader mode.
This sends the special Boot command (0xF2 / 242) with magic values to trigger the motor control system to exit and return to bootloader mode.
|
inlinenoexcept |
Get direct access to the bootloader instance.
Allows advanced users to send custom bootloader commands after using applyConfiguration() with startMotorControl =false.
|
inlinestaticconstexprnoexcept |
Get the compiled driver version string.
|
inlinestaticconstexprnoexcept |
Get the compiled driver major version number.
|
inlinestaticconstexprnoexcept |
Get the compiled driver minor version number.
|
inlinestaticconstexprnoexcept |
Get the compiled driver patch version number.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
Read a global parameter from the TMC9660.
| id | Global parameter ID number. | |
| bank | Bank number or index associated with the parameter (can be Bank1, Bank2, or Bank3 enum). | |
| [out] | value | Reference to store the read 32-bit value. |
|
noexcept |
Read an axis (motor-specific) parameter from the TMC9660.
| id | Parameter ID number to read. | |
| [out] | value | Reference to store the 32-bit parameter value read. |
| motor_index | Index of the motor/axis (0 or 1). |
|
noexcept |
Send a TMCL command. Optionally return the 32-bit reply value.
|
noexcept |
Set (write) a global parameter on the TMC9660.
| id | Global parameter ID number. |
| bank | Bank number for global parameter (can be Bank1, Bank2, or Bank3 enum). |
| value | 32-bit value to write. |
|
noexcept |
Set (write) an axis (motor-specific) parameter on the TMC9660.
| id | Parameter ID number (see TMC9660 documentation for the full list). |
| value | 32-bit value to write to the parameter. |
| motor_index | Index of the motor/axis (0 or 1). Typically 0 unless the device controls multiple axes. |
|
private |
Module address (0-127). Used primarily for UART multi-drop addressing.
|
private |
|
private |
Bootloader helper.
|
private |
sending/receiving data.
Communication interface (transport) for
| struct tmc9660::TMC9660::Ramp* tmc9660::TMC9660< CommType >::this |
| struct tmc9660::TMC9660::IIT* tmc9660::TMC9660< CommType >::this |
| struct tmc9660::TMC9660::GPIO* tmc9660::TMC9660< CommType >::this |
|
private |