31#include "tmc9660_version.h"
123template <
typename CommType>
146 [[nodiscard]] CommType&
comm() noexcept {
232 bool performReset =
true,
233 bool retrieveBootloaderInfo =
false,
234 bool failOnVerifyError =
true) noexcept;
296 return sendCommand(tmc9660::tmcl::Op::Boot, 0x81, 0x92, 0xA3B4C5D6,
nullptr);
316 uint8_t motorIndex = 0) noexcept;
326 uint8_t motorIndex = 0) noexcept;
330 std::variant<uint8_t,
tmc9660::tmcl::GlobalParamBank0,
tmc9660::tmcl::GlobalParamBank2,
331 tmc9660::tmcl::GlobalParamBank3>;
340 uint32_t value) noexcept;
350 uint32_t& value) noexcept;
354 uint32_t value = 0, uint32_t* reply =
nullptr) noexcept;
403 bool setDirection(
tmc9660::tmcl::MotorDirection direction) noexcept;
410 bool setPWMFrequency(uint32_t frequency_hz) noexcept;
442 bool setCommutationMode(
tmc9660::tmcl::CommutationMode mode) noexcept;
452 bool setOutputVoltageLimit(uint16_t limit) noexcept;
459 bool getOutputVoltageLimit(uint16_t& limit) noexcept;
471 bool setMaxTorqueCurrent(uint16_t milliamps) noexcept;
484 bool setMaxFluxCurrent(uint16_t milliamps) noexcept;
503 bool setPWMSwitchingScheme(
tmc9660::tmcl::PwmSwitchingScheme scheme) noexcept;
594 bool setIdleMotorPWMBehavior(
595 tmc9660::tmcl::IdleMotorPwmBehavior pwmOffWhenIdle =
596 tmc9660::tmcl::IdleMotorPwmBehavior::PWM_OFF_WHEN_MOTOR_IDLE) noexcept;
618 tmc9660::tmcl::MotorDirection::FORWARD;
620 tmc9660::tmcl::PwmSwitchingScheme::SVPWM;
622 float maxFluxCurrent_A =
623 std::numeric_limits<float>::quiet_NaN();
626 uint16_t outputVoltageLimit =
629 tmc9660::tmcl::IdleMotorPwmBehavior::PWM_OFF_WHEN_MOTOR_IDLE;
631 std::optional<tmc9660::tmcl::CommutationMode>
664 } motorConfig{*
this};
693 bool readRaw(int16_t& adc0, int16_t& adc1, int16_t& adc2, int16_t& adc3)
noexcept;
772 uint16_t scale3)
noexcept;
783 uint16_t& scale3)
noexcept;
816 bool setOffsets(int16_t offset0, int16_t offset1, int16_t offset2, int16_t offset3)
noexcept;
826 bool getOffsets(int16_t& offset0, int16_t& offset1, int16_t& offset2,
827 int16_t& offset3)
noexcept;
895 bool usePeakScaling =
898 tmc9660::tmcl::AdcShuntType::BOTTOM_SHUNTS;
900 tmc9660::tmcl::CsaFilter::T_1_0_MICROSEC;
904 float actualShuntR_adc0_mOhm =
905 std::numeric_limits<float>::quiet_NaN();
906 float actualShuntR_adc1_mOhm =
907 std::numeric_limits<float>::quiet_NaN();
908 float actualShuntR_adc2_mOhm =
909 std::numeric_limits<float>::quiet_NaN();
910 float actualShuntR_adc3_mOhm =
911 std::numeric_limits<float>::quiet_NaN();
915 std::optional<tmc9660::tmcl::AdcMapping>
917 std::optional<tmc9660::tmcl::AdcMapping>
919 std::optional<tmc9660::tmcl::AdcMapping>
921 std::optional<tmc9660::tmcl::AdcMapping>
929 std::optional<tmc9660::tmcl::AdcInversion>
931 std::optional<tmc9660::tmcl::AdcInversion>
933 std::optional<tmc9660::tmcl::AdcInversion>
935 std::optional<tmc9660::tmcl::AdcInversion>
941 uint32_t calibrationTimeoutMs =
1039 } currentSensing{*
this};
1085 uint8_t high_side_y2)
noexcept;
1103 float lowSideY2_ns,
float highSideY2_ns)
noexcept;
1143 uint8_t source_time_y2)
noexcept;
1161 float sourceTimeY2_ns)
noexcept;
1433 std::numeric_limits<float>::quiet_NaN();
1443 tmc9660::tmcl::GdrvRetryBehaviour::OPEN_CIRCUIT;
1446 tmc9660::tmcl::DriveFaultBehaviour::OPEN_CIRCUIT;
1452 std::optional<float>
1455 std::optional<float>
1461 tmc9660::tmcl::PwmOutputPolarity::ACTIVE_HIGH;
1465 tmc9660::tmcl::PwmOutputPolarity::ACTIVE_HIGH;
1471 tmc9660::tmcl::UndervoltageLevel::DISABLED;
1598 } gateDriver{*
this};
1631 uint8_t filterLength = 0) noexcept;
1649 int16_t offset120 = 21845, int16_t offset180 = -32768,
1650 int16_t offset240 = -21846, int16_t offset300 = -10923,
1651 int16_t globalOffset = 0) noexcept;
1668 float offset120Deg = 120.0f,
float offset180Deg = 180.0f,
1669 float offset240Deg = 240.0f,
float offset300Deg = 300.0f,
1670 float globalOffsetDeg = 0.0f) noexcept;
1687 float offset120Rad = 2.09439510f,
1688 float offset180Rad = 3.14159265f,
1689 float offset240Rad = 4.18879020f,
1690 float offset300Rad = 5.23598775f,
1691 float globalOffsetRad = 0.0f) noexcept;
1736 uint32_t counts_per_rev,
1737 tmc9660::tmcl::Direction inverted =
tmc9660::tmcl::Direction::NOT_INVERTED,
1738 tmc9660::tmcl::EnableDisable nChannelInverted =
1739 tmc9660::tmcl::EnableDisable::DISABLED) noexcept;
1758 tmc9660::tmcl::AbnInitMethod initMethod =
1759 tmc9660::tmcl::AbnInitMethod::FORCED_PHI_E_ZERO_WITH_ACTIVE_SWING,
1760 uint16_t initDelay = 1000, int32_t initVelocity = 5, int16_t nChannelOffset = 0) noexcept;
1795 tmc9660::tmcl::AbnNChannelFiltering::FILTERING_OFF,
1796 tmc9660::tmcl::EnableDisable clearOnNextNull =
1797 tmc9660::tmcl::EnableDisable::DISABLED) noexcept;
1815 uint32_t counts_per_rev,
1816 tmc9660::tmcl::Direction inverted =
tmc9660::tmcl::Direction::NOT_INVERTED,
1817 uint8_t gearRatio = 1) noexcept;
1867 uint8_t cs_idle_time_us) noexcept;
1880 uint32_t position_mask, uint8_t positionShift = 0,
1881 tmc9660::tmcl::Direction invertDirection =
tmc9660::tmcl::Direction::NOT_INVERTED) noexcept;
1904 int16_t offset = 0) noexcept;
1916 int8_t shiftFactor = 0) noexcept;
1966 int16_t& offset) noexcept;
1995 tmc9660::tmcl::HallSectorOffset::DEG_0;
2000 tmc9660::tmcl::Direction::NOT_INVERTED;
2002 tmc9660::tmcl::EnableDisable::DISABLED;
2004 uint8_t filterLength =
2008 std::optional<float>
2010 std::optional<float>
2012 std::optional<float>
2014 std::optional<float>
2016 std::optional<float>
2018 std::optional<float>
2031 tmc9660::tmcl::Direction::NOT_INVERTED;
2033 tmc9660::tmcl::EnableDisable::DISABLED;
2038 FORCED_PHI_E_ZERO_WITH_ACTIVE_SWING;
2046 tmc9660::tmcl::AbnNChannelFiltering::FILTERING_OFF;
2049 tmc9660::tmcl::EnableDisable::DISABLED;
2061 tmc9660::tmcl::Direction::NOT_INVERTED;
2079 tmc9660::tmcl::Direction::NOT_INVERTED;
2083 FORCED_PHI_E_ZERO_WITH_ACTIVE_SWING;
2088 std::optional<std::array<uint8_t, 16>>
2094 tmc9660::tmcl::EnableDisable::DISABLED;
2143 } feedbackSense{*
this};
2221 uint16_t fluxI = 0) noexcept;
2234 tmc9660::tmcl::CurrentPiNormalization i_norm) noexcept;
2370 std::optional<uint16_t>
2372 std::optional<uint16_t>
2383 bool separateTorqueFluxLoops =
2391 std::optional<uint16_t>
2393 std::optional<uint16_t>
2408 std::optional<tmc9660::tmcl::CurrentPiNormalization>
2410 std::optional<tmc9660::tmcl::CurrentPiNormalization>
2426 bool enableFieldWeakening =
false;
2440 float fieldWeakeningVoltageThresholdPercent =
2455 uint16_t fieldWeakeningI = 100;
2468 int16_t torqueOffset_mA = 0;
2469 int16_t fluxOffset_mA = 0;
2486 bool enableTorqueBiquadFilter =
2522 std::optional<int32_t>
2545 } torqueFluxControl{*
this};
2613 tmc9660::tmcl::VelocityPiNorm i_norm) noexcept;
2742 tmc9660::tmcl::VelocityPiNorm::SHIFT_16_BIT;
2745 tmc9660::tmcl::VelocityPiNorm::SHIFT_16_BIT;
2768 std::optional<uint16_t>
2780 std::optional<uint32_t>
2790 std::optional<uint8_t>
2820 uint8_t loopDownsampling = 5;
2823 uint32_t velocityReachedThreshold = 1000;
2826 std::optional<uint32_t>
2829 bool stopOnDeviationSoftStop =
2853 uint16_t meterHysteresis = 500;
2856 int32_t velocityOffset = 0;
2926 } velocityControl{*
this};
2994 tmc9660::tmcl::VelocityPiNorm i_norm) noexcept;
3088 tmc9660::tmcl::ReferenceSwitchPolaritySwap& config) noexcept;
3095 tmc9660::tmcl::ReferenceSwitchLatchSettings setting) noexcept;
3101 tmc9660::tmcl::ReferenceSwitchLatchSettings& setting) noexcept;
3199 tmc9660::tmcl::VelocityPiNorm::SHIFT_16_BIT;
3202 tmc9660::tmcl::VelocityPiNorm::SHIFT_16_BIT;
3206 std::optional<uint16_t>
3209 std::optional<uint32_t>
3238 uint8_t loopDownsampling = 1;
3241 std::optional<int32_t>
3243 std::optional<int32_t>
3247 uint32_t positionReachedThreshold = 100;
3250 std::optional<uint32_t>
3253 bool stopOnDeviationSoftStop =
3271 } positionControl{*
this};
3321 uint32_t v_max)
noexcept;
3327 bool setTiming(uint16_t t_vmax_cycles, uint16_t t_zero_wait_cycles)
noexcept;
3384 std::optional<uint32_t>
3392 std::optional<uint32_t>
3400 std::optional<uint32_t>
3408 std::optional<uint32_t>
3415 std::optional<uint32_t>
3422 std::optional<uint32_t>
3429 std::optional<uint32_t>
3436 std::optional<uint32_t>
3443 std::optional<uint32_t>
3450 std::optional<uint32_t>
3501 std::optional<uint16_t>
3508 std::optional<tmc9660::tmcl::AccelerationFFShift>
3626 } referenceSearch{*
this};
3720 std::optional<float>
3729 std::optional<uint8_t>
3737 std::optional<uint8_t>
3745 std::optional<uint16_t>
3797 bool configure(uint16_t timeConstant1_ms,
float continuousCurrent1_A, uint16_t timeConstant2_ms,
3798 float continuousCurrent2_A)
noexcept;
3969 uint32_t max_vel_error, uint32_t max_pos_error,
3970 bool softStop =
true) noexcept;
3989 bool configureReferenceSwitches(
3990 uint8_t mask,
bool invert_l,
bool invert_r,
bool invert_h,
3991 bool swap_lr) noexcept;
4001 bool getAndClearLatchedPosition(int32_t& pos) noexcept;
4048 std::optional<uint8_t>
4082 } stopEvents{*
this};
4131 uint16_t timeConstant2_ms,
float continuousCurrent2_A)
noexcept;
4154 std::optional<float>
4165 std::optional<float>
4176 std::optional<float>
4204 std::optional<uint16_t>
4220 std::optional<uint16_t>
4246 } protection{*
this};
4264 bool upload(
const std::vector<uint32_t>& script_data)
noexcept;
4271 bool start(uint16_t address = 0) noexcept;
4276 bool stop() noexcept;
4283 bool step() noexcept;
4290 bool reset() noexcept;
4296 bool getStatus(uint32_t& status) noexcept;
4303 bool readMemory(uint16_t address, uint32_t& value) noexcept;
4309 bool addBreakpoint(uint16_t address) noexcept;
4315 bool removeBreakpoint(uint16_t address) noexcept;
4320 bool clearBreakpoints() noexcept;
4326 bool getMaxBreakpointCount(uint32_t& count) noexcept;
4347 bool init(uint32_t sample_count)
noexcept;
4359 bool readData(uint32_t index, uint32_t& data) noexcept;
4366 bool getStatus(
bool& is_running) noexcept;
4404 bool recallFromFlash() noexcept;
4413 bool eraseFlashBank(uint8_t n) noexcept;
4419 } nvmStorage{*
this};
4528 uint32_t timeout_ms)
noexcept;
4532 uint32_t& timeout_ms)
noexcept;
4610 bool setMode(uint8_t pin,
bool output,
bool pullEnable =
false,
bool pullUp =
true) noexcept;
4617 bool writePin(uint8_t pin,
bool value) noexcept;
4624 bool readDigital(uint8_t pin,
bool& value) noexcept;
4633 bool readAnalog(uint8_t pin, uint16_t& value) noexcept;
4690 std::optional<tmc9660::tmcl::PowerDownTimeout>
4715 return HF_TMC9660_VERSION_STRING;
4720 return HF_TMC9660_VERSION_MAJOR;
4725 return HF_TMC9660_VERSION_MINOR;
4730 return HF_TMC9660_VERSION_PATCH;
4744#ifdef TMC_API_EXTERNAL_CRC_TABLE
4748 0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75, 0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA,
4749 0x7B, 0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69, 0x12, 0x83, 0xF1, 0x60, 0x15, 0x84,
4750 0xF6, 0x67, 0x38, 0xA9, 0xDB, 0x4A, 0x3F, 0xAE, 0xDC, 0x4D, 0x36, 0xA7, 0xD5, 0x44, 0x31,
4751 0xA0, 0xD2, 0x43, 0x24, 0xB5, 0xC7, 0x56, 0x23, 0xB2, 0xC0, 0x51, 0x2A, 0xBB, 0xC9, 0x58,
4752 0x2D, 0xBC, 0xCE, 0x5F, 0x70, 0xE1, 0x93, 0x02, 0x77, 0xE6, 0x94, 0x05, 0x7E, 0xEF, 0x9D,
4753 0x0C, 0x79, 0xE8, 0x9A, 0x0B, 0x6C, 0xFD, 0x8F, 0x1E, 0x6B, 0xFA, 0x88, 0x19, 0x62, 0xF3,
4754 0x81, 0x10, 0x65, 0xF4, 0x86, 0x17, 0x48, 0xD9, 0xAB, 0x3A, 0x4F, 0xDE, 0xAC, 0x3D, 0x46,
4755 0xD7, 0xA5, 0x34, 0x41, 0xD0, 0xA2, 0x33, 0x54, 0xC5, 0xB7, 0x26, 0x53, 0xC2, 0xB0, 0x21,
4756 0x5A, 0xCB, 0xB9, 0x28, 0x5D, 0xCC, 0xBE, 0x2F, 0xE0, 0x71, 0x03, 0x92, 0xE7, 0x76, 0x04,
4757 0x95, 0xEE, 0x7F, 0x0D, 0x9C, 0xE9, 0x78, 0x0A, 0x9B, 0xFC, 0x6D, 0x1F, 0x8E, 0xFB, 0x6A,
4758 0x18, 0x89, 0xF2, 0x63, 0x11, 0x80, 0xF5, 0x64, 0x16, 0x87, 0xD8, 0x49, 0x3B, 0xAA, 0xDF,
4759 0x4E, 0x3C, 0xAD, 0xD6, 0x47, 0x35, 0xA4, 0xD1, 0x40, 0x32, 0xA3, 0xC4, 0x55, 0x27, 0xB6,
4760 0xC3, 0x52, 0x20, 0xB1, 0xCA, 0x5B, 0x29, 0xB8, 0xCD, 0x5C, 0x2E, 0xBF, 0x90, 0x01, 0x73,
4761 0xE2, 0x97, 0x06, 0x74, 0xE5, 0x9E, 0x0F, 0x7D, 0xEC, 0x99, 0x08, 0x7A, 0xEB, 0x8C, 0x1D,
4762 0x6F, 0xFE, 0x8B, 0x1A, 0x68, 0xF9, 0x82, 0x13, 0x61, 0xF0, 0x85, 0x14, 0x66, 0xF7, 0xA8,
4763 0x39, 0x4B, 0xDA, 0xAF, 0x3E, 0x4C, 0xDD, 0xA6, 0x37, 0x45, 0xD4, 0xA1, 0x30, 0x42, 0xD3,
4764 0xB4, 0x25, 0x57, 0xC6, 0xB3, 0x22, 0x50, 0xC1, 0xBA, 0x2B, 0x59, 0xC8, 0xBD, 0x2C, 0x5E,
4771#define TMC9660_HEADER_INCLUDED
4773#include "../src/tmc9660.ipp"
4774#undef TMC9660_HEADER_INCLUDED
4778 return HF_TMC9660_VERSION_STRING;
Main TMC9660 bootloader interface class.
Definition tmc9660_bootloader.hpp:53
Main class representing a TMC9660 motor driver in Parameter Mode.
Definition tmc9660.hpp:124
BootloaderInitResult
Bootloader initialization result codes.
Definition tmc9660.hpp:172
@ Success
Successfully initialized the bootloader.
@ NoConfig
No bootloader configuration provided.
@ Failure
Failed to initialize the bootloader.
bool writeParameter(tmc9660::tmcl::Parameters id, uint32_t value, uint8_t motorIndex=0) noexcept
Set (write) an axis (motor-specific) parameter on the TMC9660.
bool enterBootloaderMode() noexcept
Exit parameter mode and return to bootloader mode.
Definition tmc9660.hpp:294
CommType & comm_
sending/receiving data.
Definition tmc9660.hpp:4737
const tmc9660::BootloaderConfig * bootCfg_
Definition tmc9660.hpp:4742
const uint8_t tmcCRCTable_Poly7Reflected[256]
Definition tmc9660.hpp:4747
bool GpioSet(TMC9660CtrlPin pin, GpioSignal signal) noexcept
std::unique_ptr< tmc9660::TMC9660Bootloader< CommType > > bootloader_
Bootloader helper.
Definition tmc9660.hpp:4741
bool GpioRead(TMC9660CtrlPin pin, GpioSignal &signal) noexcept
uint8_t address_
Definition tmc9660.hpp:4739
static constexpr uint8_t GetDriverVersionMajor() noexcept
Get the compiled driver major version number.
Definition tmc9660.hpp:4719
static constexpr uint8_t GetDriverVersionPatch() noexcept
Get the compiled driver patch version number.
Definition tmc9660.hpp:4729
tmc9660::TMC9660Bootloader< CommType > * getBootloader() noexcept
Get direct access to the bootloader instance.
Definition tmc9660.hpp:267
bool readGlobalParameter(GlobalParamBankVariant id, uint8_t bank, uint32_t &value) noexcept
Read a global parameter from the TMC9660.
std::variant< uint8_t, tmc9660::tmcl::GlobalParamBank0, tmc9660::tmcl::GlobalParamBank2, tmc9660::tmcl::GlobalParamBank3 > GlobalParamBankVariant
Definition tmc9660.hpp:329
CommType & comm() noexcept
Get the communication interface used by this TMC9660 instance.
Definition tmc9660.hpp:146
TMC9660(CommType &comm, uint8_t address=0, const tmc9660::BootloaderConfig *bootCfg=nullptr) noexcept
Construct a TMC9660 driver instance.
TMC9660::BootloaderInitResult bootloaderInit(const tmc9660::BootloaderConfig *cfg=nullptr, bool performReset=true, bool retrieveBootloaderInfo=false, bool failOnVerifyError=true) noexcept
Complete bootloader initialization and transition to parameter mode.
static constexpr uint8_t GetDriverVersionMinor() noexcept
Get the compiled driver minor version number.
Definition tmc9660.hpp:4724
bool writeGlobalParameter(GlobalParamBankVariant id, uint8_t bank, uint32_t value) noexcept
Set (write) a global parameter on the TMC9660.
bool GpioSetInactive(TMC9660CtrlPin pin) noexcept
bool sendCommand(tmc9660::tmcl::Op opcode, uint16_t type=0, uint8_t motor=0, uint32_t value=0, uint32_t *reply=nullptr) noexcept
Send a TMCL command. Optionally return the 32-bit reply value.
static constexpr const char * GetDriverVersion() noexcept
Get the compiled driver version string.
Definition tmc9660.hpp:4714
bool readParameter(tmc9660::tmcl::Parameters id, uint32_t &value, uint8_t motorIndex=0) noexcept
Read an axis (motor-specific) parameter from the TMC9660.
bool GpioSetActive(TMC9660CtrlPin pin) noexcept
UndervoltageEnable
Definition tmc9660_param_mode_tmcl.hpp:1313
GateCurrentSource
Definition tmc9660_param_mode_tmcl.hpp:868
GateCurrentSink
Definition tmc9660_param_mode_tmcl.hpp:808
OvercurrentTiming
Definition tmc9660_param_mode_tmcl.hpp:1135
AdcMapping
Definition tmc9660_param_mode_tmcl.hpp:2048
OvercurrentThreshold
Definition tmc9660_param_mode_tmcl.hpp:1091
VgsShortEnable
Definition tmc9660_param_mode_tmcl.hpp:1396
PowerDownTimeout
Definition tmc9660_param_mode_tmcl.hpp:4640
StepDirStepDividerShift
Definition tmc9660_param_mode_tmcl.hpp:4522
VelocityPiNorm
Definition tmc9660_param_mode_tmcl.hpp:2946
MotorDirection
Definition tmc9660_param_mode_tmcl.hpp:1612
VgsBlankingTime
Definition tmc9660_param_mode_tmcl.hpp:1432
DriveFaultBehaviour
Definition tmc9660_param_mode_tmcl.hpp:3774
Direction
Definition tmc9660_param_mode_tmcl.hpp:2558
BootstrapCurrentLimit
Definition tmc9660_param_mode_tmcl.hpp:912
VdsUsage
Definition tmc9660_param_mode_tmcl.hpp:1167
GdrvRetryBehaviour
Definition tmc9660_param_mode_tmcl.hpp:3735
CsaFilter
Definition tmc9660_param_mode_tmcl.hpp:2012
PwmSwitchingScheme
Definition tmc9660_param_mode_tmcl.hpp:1646
EnableDisable
Definition tmc9660_param_mode_tmcl.hpp:2526
AdcShuntType
Definition tmc9660_param_mode_tmcl.hpp:1938
PwmOutputPolarity
Definition tmc9660_param_mode_tmcl.hpp:748
SpiInitMethod
Definition tmc9660_param_mode_tmcl.hpp:2494
AdcInversion
Definition tmc9660_param_mode_tmcl.hpp:2080
GlobalParamBank3
Definition tmc9660_param_mode_tmcl.hpp:568
GlobalParamBank0
Definition tmc9660_param_mode_tmcl.hpp:479
OvercurrentEnable
Definition tmc9660_param_mode_tmcl.hpp:1022
Parameters
Definition tmc9660_param_mode_tmcl.hpp:5228
CsaGain
Definition tmc9660_param_mode_tmcl.hpp:1976
VelocitySensorSelection
Definition tmc9660_param_mode_tmcl.hpp:2907
MotorType
Definition tmc9660_param_mode_tmcl.hpp:1580
VgsDeglitchTime
Definition tmc9660_param_mode_tmcl.hpp:1476
HeartbeatMonitoringConfig
Definition tmc9660_param_mode_tmcl.hpp:4037
AbnNChannelFiltering
Definition tmc9660_param_mode_tmcl.hpp:2386
HallSectorOffset
Definition tmc9660_param_mode_tmcl.hpp:2426
PositionSensorSelection
Definition tmc9660_param_mode_tmcl.hpp:3155
UndervoltageLevel
Definition tmc9660_param_mode_tmcl.hpp:1281
TriggerTransition
Definition tmc9660_param_mode_tmcl.hpp:611
AbnInitMethod
Definition tmc9660_param_mode_tmcl.hpp:2312
GlobalParamBank2
Definition tmc9660_param_mode_tmcl.hpp:519
AccelerationFFShift
Definition tmc9660_param_mode_tmcl.hpp:3028
IdleMotorPwmBehavior
Definition tmc9660_param_mode_tmcl.hpp:1800
Definition bootloader_config.hpp:9
TMC9660CtrlPin
TMC9660 control pin identifiers with board-agnostic naming.
Definition tmc9660_comm_interface.hpp:126
GpioSignal
GPIO signal states with board-agnostic naming.
Definition tmc9660_comm_interface.hpp:140
Complete bootloader configuration structure.
Definition bootloader_config.hpp:998
Configuration structure for brake auto-configuration.
Definition tmc9660.hpp:3694
std::optional< bool > enableChopper
Enable brake chopper (optional, default: false).
Definition tmc9660.hpp:3701
std::optional< uint8_t > holdingDutyCycle
PWM duty cycle for brake holding in percent (optional, default: 30%).
Definition tmc9660.hpp:3738
std::optional< float > chopperHysteresis_V
Brake chopper hysteresis in volts (optional, default: 2.0V).
Definition tmc9660.hpp:3721
std::optional< float > chopperVoltageThreshold_V
Brake chopper voltage threshold in volts (optional, default: 30.0V for 24V systems).
Definition tmc9660.hpp:3712
std::optional< bool > invertOutput
Invert brake output polarity (optional, default: false).
Definition tmc9660.hpp:3752
std::optional< uint8_t > releasingDutyCycle
PWM duty cycle for brake release in percent (optional, default: 50%).
Definition tmc9660.hpp:3730
std::optional< uint16_t > releasingDuration_ms
Brake release duration in milliseconds (optional, default: 100ms).
Definition tmc9660.hpp:3746
Subsystem controlling the brake chopper and mechanical brake features.
Definition tmc9660.hpp:3635
TMC9660 & driver
Definition tmc9660.hpp:3768
bool setHysteresis(float voltage) noexcept
Set the hysteresis for the brake chopper threshold.
bool setReleasingDutyCycle(uint8_t percent) noexcept
Set the PWM duty cycle for releasing the brake.
bool setHoldingDutyCycle(uint8_t percent) noexcept
Set the PWM duty cycle for holding the brake released.
bool invertOutput(bool invert) noexcept
Invert or normalize the brake output signal polarity.
bool configureAuto(const BrakeConfig &config) noexcept
Auto-configure brake parameters.
bool release() noexcept
Trigger a release of the mechanical brake.
Brake(TMC9660 &parent) noexcept
Definition tmc9660.hpp:3767
bool engage() noexcept
Engage (lock) the mechanical brake.
bool setReleasingDuration(uint16_t milliseconds) noexcept
Set the duration of the brake release initial phase.
bool enableChopper(bool enable) noexcept
Enable or disable the brake chopper functionality.
bool setVoltageLimit(float voltage) noexcept
Set the overvoltage threshold for the brake chopper.
Configuration structure for auto-configuring current sensing.
Definition tmc9660.hpp:888
std::optional< tmc9660::tmcl::AdcMapping > phaseY2_adcMapping
ADC mapping for phase Y2. Default: ADC_I3.
Definition tmc9660.hpp:922
std::optional< tmc9660::tmcl::AdcMapping > phaseW_adcMapping
ADC mapping for phase W (WY1). Default: ADC_I2.
Definition tmc9660.hpp:920
std::optional< tmc9660::tmcl::AdcInversion > adc1_inverted
Inversion for ADC_I1. Default: based on motor type.
Definition tmc9660.hpp:932
tmc9660::tmcl::MotorType motorType
Motor type (used for default ADC inversion settings)
Definition tmc9660.hpp:892
std::optional< tmc9660::tmcl::AdcInversion > adc0_inverted
Inversion for ADC_I0. Default: based on motor type.
Definition tmc9660.hpp:930
float expectedPeakCurrent_A
Expected peak phase current in amperes (e.g., 3.0 for 3A)
Definition tmc9660.hpp:891
std::optional< tmc9660::tmcl::AdcInversion > adc2_inverted
Inversion for ADC_I2. Default: based on motor type.
Definition tmc9660.hpp:934
std::optional< tmc9660::tmcl::AdcInversion > adc3_inverted
Inversion for ADC_I3. Default: based on motor type.
Definition tmc9660.hpp:936
std::optional< tmc9660::tmcl::AdcMapping > phaseU_adcMapping
ADC mapping for phase U (UX1). Default: ADC_I0.
Definition tmc9660.hpp:916
float shuntResistance_mOhm
Nominal shunt resistor value in milliohms (e.g. 3.0 for 3 mΩ)
Definition tmc9660.hpp:890
std::optional< tmc9660::tmcl::AdcMapping > phaseV_adcMapping
ADC mapping for phase V (VX2). Default: ADC_I1.
Definition tmc9660.hpp:918
Subsystem for configuring ADC-based current measurement.
Definition tmc9660.hpp:672
bool readRaw(int16_t &adc0, int16_t &adc1, int16_t &adc2, int16_t &adc3) noexcept
Read raw ADC values (Parameters 13-16: ADC_I0_RAW ... ADC_I3_RAW).
bool getCalibrationStatus(bool &is_calibrated) noexcept
Check if ADC offset calibration has been completed.
bool setOffsets(int16_t offset0, int16_t offset1, int16_t offset2, int16_t offset3) noexcept
Set ADC offset (Parameters 34-37: ADC_I0_OFFSET ... ADC_I3_OFFSET).
bool configureAuto(const AutoConfig &config) noexcept
Auto-configure current sensing based on shunt resistance and expected current.
TMC9660 & driver
Definition tmc9660.hpp:1038
bool getInversion(tmc9660::tmcl::AdcInversion &inv0, tmc9660::tmcl::AdcInversion &inv1, tmc9660::tmcl::AdcInversion &inv2, tmc9660::tmcl::AdcInversion &inv3) noexcept
Get ADC inversion (Parameters 30-33: ADC_I0_INVERTED ... ADC_I3_INVERTED).
bool setScalingFactor(uint16_t scaling_factor) noexcept
Set current scaling factor (Parameter 21: CURRENT_SCALING_FACTOR).
bool getCSAFilter(tmc9660::tmcl::CsaFilter &filter012, tmc9660::tmcl::CsaFilter &filter3) noexcept
Get current sense amplifier filter (Parameters 19/20: CSA_FILTER_ADC_I0_TO_ADC_I2,...
bool calibrateOffsets(bool waitForCompletion=false, uint32_t timeoutMs=1000) noexcept
Calibrate the ADC offsets for current measurement.
bool getScalingFactors(uint16_t &scale0, uint16_t &scale1, uint16_t &scale2, uint16_t &scale3) noexcept
Get individual ADC scaling factors (Parameters 26-29: ADC_I0_SCALE ... ADC_I3_SCALE).
bool setPhaseAdcMapping(tmc9660::tmcl::AdcMapping ux1, tmc9660::tmcl::AdcMapping vx2, tmc9660::tmcl::AdcMapping wy1, tmc9660::tmcl::AdcMapping y2) noexcept
Set ADC mapping for each phase (Parameters 22-25: PHASE_UX1_ADC_MAPPING ... PHASE_Y2_ADC_MAPPING).
bool setShuntType(tmc9660::tmcl::AdcShuntType shuntType) noexcept
Set the ADC shunt type (Parameter 12: ADC_SHUNT_TYPE).
bool getCSAGain(tmc9660::tmcl::CsaGain &gain012, tmc9660::tmcl::CsaGain &gain3) noexcept
Get current sense amplifier gain (Parameters 17/18: CSA_GAIN_ADC_I0_TO_ADC_I2, CSA_GAIN_ADC_I3).
bool getScalingFactor(uint16_t &scaling_factor) noexcept
Get current scaling factor (Parameter 21: CURRENT_SCALING_FACTOR).
bool getShuntType(tmc9660::tmcl::AdcShuntType &shuntType) noexcept
Get the ADC shunt type (Parameter 12: ADC_SHUNT_TYPE).
bool getPhaseAdcMapping(tmc9660::tmcl::AdcMapping &ux1, tmc9660::tmcl::AdcMapping &vx2, tmc9660::tmcl::AdcMapping &wy1, tmc9660::tmcl::AdcMapping &y2) noexcept
Get ADC mapping for each phase (Parameters 22-25: PHASE_UX1_ADC_MAPPING ... PHASE_Y2_ADC_MAPPING).
bool setCSAFilter(tmc9660::tmcl::CsaFilter filter012, tmc9660::tmcl::CsaFilter filter3) noexcept
Set current sense amplifier filter (Parameters 19/20: CSA_FILTER_ADC_I0_TO_ADC_I2,...
bool setScalingFactors(uint16_t scale0, uint16_t scale1, uint16_t scale2, uint16_t scale3) noexcept
Set individual ADC scaling factors (Parameters 26-29: ADC_I0_SCALE ... ADC_I3_SCALE).
CurrentSensing(TMC9660 &parent) noexcept
Definition tmc9660.hpp:1037
bool readScaledAndOffset(int16_t &adc0, int16_t &adc1, int16_t &adc2, int16_t &adc3) noexcept
Read scaled and offset-compensated ADC values (Parameters 38-41: ADC_I0 ... ADC_I3).
bool setInversion(tmc9660::tmcl::AdcInversion inv0, tmc9660::tmcl::AdcInversion inv1, tmc9660::tmcl::AdcInversion inv2, tmc9660::tmcl::AdcInversion inv3) noexcept
Set ADC inversion (Parameters 30-33: ADC_I0_INVERTED ... ADC_I3_INVERTED).
bool setCSAGain(tmc9660::tmcl::CsaGain gain012, tmc9660::tmcl::CsaGain gain3) noexcept
Set current sense amplifier gain (Parameters 17/18: CSA_GAIN_ADC_I0_TO_ADC_I2, CSA_GAIN_ADC_I3).
bool getOffsets(int16_t &offset0, int16_t &offset1, int16_t &offset2, int16_t &offset3) noexcept
Get ADC offset (Parameters 34-37: ADC_I0_OFFSET ... ADC_I3_OFFSET).
Configuration structure for ABN2 (secondary) encoder auto-configuration.
Definition tmc9660.hpp:2055
uint32_t countsPerRev
Encoder resolution in counts per revolution (CPR) [0-16777215].
Definition tmc9660.hpp:2057
tmc9660::tmcl::Direction direction
Encoder direction (default: NOT_INVERTED)
Definition tmc9660.hpp:2060
bool enable
Enable the ABN2 encoder (default: true)
Definition tmc9660.hpp:2064
uint8_t gearRatio
Gear ratio between encoder and motor shaft [1-255] (default: 1, directly coupled)
Definition tmc9660.hpp:2062
Configuration structure for ABN encoder auto-configuration.
Definition tmc9660.hpp:2025
uint16_t initDelay
Initialization delay in ms [1000-10000] (default: 1000ms)
Definition tmc9660.hpp:2040
tmc9660::tmcl::AbnInitMethod initMethod
Definition tmc9660.hpp:2037
int32_t initVelocity
Initialization velocity [-200000 to 200000] (default: 5)
Definition tmc9660.hpp:2041
tmc9660::tmcl::EnableDisable clearOnNextNull
Definition tmc9660.hpp:2048
uint32_t countsPerRev
Encoder resolution in counts per revolution (CPR) [0-16777215].
Definition tmc9660.hpp:2027
tmc9660::tmcl::AbnNChannelFiltering nChannelFiltering
Definition tmc9660.hpp:2045
int16_t nChannelOffset
N-channel offset [-32768 to 32767] (default: 0)
Definition tmc9660.hpp:2042
tmc9660::tmcl::EnableDisable nChannelInverted
Definition tmc9660.hpp:2032
tmc9660::tmcl::Direction direction
Encoder direction (default: NOT_INVERTED)
Definition tmc9660.hpp:2030
Configuration structure for Hall sensor auto-configuration.
Definition tmc9660.hpp:1992
std::optional< float > offset300Deg
Offset for 300° Hall position in degrees (optional, default: 300°)
Definition tmc9660.hpp:2019
std::optional< float > offset0Deg
Offset for 0° Hall position in degrees (optional, default: 0°)
Definition tmc9660.hpp:2009
std::optional< float > offset60Deg
Offset for 60° Hall position in degrees (optional, default: 60°)
Definition tmc9660.hpp:2011
std::optional< float > offset240Deg
Offset for 240° Hall position in degrees (optional, default: 240°)
Definition tmc9660.hpp:2017
std::optional< float > offset180Deg
Offset for 180° Hall position in degrees (optional, default: 180°)
Definition tmc9660.hpp:2015
std::optional< float > offset120Deg
Offset for 120° Hall position in degrees (optional, default: 120°)
Definition tmc9660.hpp:2013
std::optional< float > globalOffsetDeg
Global offset in degrees (optional, default: 0°)
Definition tmc9660.hpp:2020
Configuration structure for SPI encoder auto-configuration.
Definition tmc9660.hpp:2069
uint32_t positionMask
Bit mask to extract position from SPI response [0-4294967295].
Definition tmc9660.hpp:2072
uint8_t positionShift
Right shift for position counter [0-127] (default: 0)
Definition tmc9660.hpp:2077
uint8_t csIdleTimeUs
CS idle time between frames [0-102 µs] (default: 0)
Definition tmc9660.hpp:2076
uint8_t cmdSize
Size of SPI transfer frame [1-16 bytes].
Definition tmc9660.hpp:2071
int8_t lutShiftFactor
LUT common shift factor [0-4] (default: 0)
Definition tmc9660.hpp:2096
int16_t offset
Manual offset for USE_OFFSET initialization method (default: 0)
Definition tmc9660.hpp:2085
tmc9660::tmcl::EnableDisable lutCorrection
Definition tmc9660.hpp:2093
uint16_t csSettleTimeNs
CS settle delay time [0-6375 ns] (default: 0)
Definition tmc9660.hpp:2075
tmc9660::tmcl::Direction direction
SPI encoder direction (default: NOT_INVERTED)
Definition tmc9660.hpp:2078
tmc9660::tmcl::SpiInitMethod initMethod
Definition tmc9660.hpp:2082
std::optional< std::array< uint8_t, 16 > > requestData
Definition tmc9660.hpp:2089
Subsystem for feedback sensor configuration.
Definition tmc9660.hpp:1606
bool configureAuto(const Abn2Config &config) noexcept
Auto-configure ABN2 (secondary) encoder feedback.
bool getSecondaryABNEncoderValue(uint32_t &value) noexcept
Read the raw ABN2 encoder internal counter value.
bool getSPIEncoderSecondaryCmdSize(uint8_t &size) noexcept
Read SPI_ENCODER_SECONDARY_TRANSFER_CMD_SIZE (0…15 bytes).
bool getSPIEncoderPositionValue(uint32_t &value) noexcept
Read SPI_ENCODER_POSITION_COUNTER_VALUE.
bool getSPIEncoderLUTShiftFactor(int8_t &shift_factor) noexcept
Read SPI_LUT_COMMON_SHIFT_FACTOR.
bool getSPIEncoderPositionShift(uint8_t &shift) noexcept
Read SPI_ENCODER_POSITION_COUNTER_SHIFT.
bool configureSecondaryABNEncoder(uint32_t counts_per_rev, tmc9660::tmcl::Direction inverted=tmc9660::tmcl::Direction::NOT_INVERTED, uint8_t gearRatio=1) noexcept
Configure the secondary ABN encoder input.
bool getABNPhiE(int16_t &phi_e) noexcept
Read the electrical angle (phi_e) calculated from ABN feedback.
bool getSPIEncoderInitialization(tmc9660::tmcl::SpiInitMethod &method, int16_t &offset) noexcept
Read SPI_ENCODER_INITIALIZATION_METHOD and SPI_ENCODER_OFFSET.
bool setHallPositionOffsetsRadians(float offset0Rad=0.0f, float offset60Rad=1.04719755f, float offset120Rad=2.09439510f, float offset180Rad=3.14159265f, float offset240Rad=4.18879020f, float offset300Rad=5.23598775f, float globalOffsetRad=0.0f) noexcept
Set Hall sensor position offsets using radians.
bool getSecondaryABNCountsPerRev(uint32_t &counts) noexcept
Read ABN_2_STEPS (encoder steps per rotation, 0…16777215).
bool setSPIEncoderLUTCorrection(tmc9660::tmcl::EnableDisable enable, int8_t shiftFactor=0) noexcept
Enable or disable SPI encoder lookup table correction.
bool configureHall(tmc9660::tmcl::HallSectorOffset sectorOffset=tmc9660::tmcl::HallSectorOffset::DEG_0, tmc9660::tmcl::Direction inverted=tmc9660::tmcl::Direction::NOT_INVERTED, tmc9660::tmcl::EnableDisable enableExtrapolation=tmc9660::tmcl::EnableDisable::DISABLED, uint8_t filterLength=0) noexcept
Configure digital Hall sensors for BLDC commutation.
bool configureABNNChannel(tmc9660::tmcl::AbnNChannelFiltering filterMode=tmc9660::tmcl::AbnNChannelFiltering::FILTERING_OFF, tmc9660::tmcl::EnableDisable clearOnNextNull=tmc9660::tmcl::EnableDisable::DISABLED) noexcept
Configure N-channel filtering for ABN encoder.
bool getSPIEncoderMainCmdSize(uint8_t &size) noexcept
Read SPI_ENCODER_MAIN_TRANSFER_CMD_SIZE (1…16 bytes).
bool getHallPhiE(int16_t &phi_e) noexcept
Read the electrical angle (phi_e) calculated from Hall feedback.
TMC9660 & driver
Definition tmc9660.hpp:2142
bool getSPIEncoderLUTAddress(uint8_t &address) noexcept
Read SPI_LUT_ADDRESS_SELECT.
bool uploadSPIEncoderLUTEntry(uint8_t index, int8_t value) noexcept
Upload a single entry to the SPI encoder correction lookup table.
bool setHallPositionOffsetsDegrees(float offset0Deg=0.0f, float offset60Deg=60.0f, float offset120Deg=120.0f, float offset180Deg=180.0f, float offset240Deg=240.0f, float offset300Deg=300.0f, float globalOffsetDeg=0.0f) noexcept
Set Hall sensor position offsets using degrees.
bool getSPIEncoderLUTData(int8_t &data) noexcept
Read SPI_LUT_DATA.
bool getSPIEncoderCSSettleDelay(uint16_t &timeNs) noexcept
Read SPI_ENCODE_CS_SETTLE_DELAY_TIME (0…6375 ns).
static int16_t radiansToHallOffset(float radians) noexcept
Convert electrical angle from radians to 16-bit format.
FeedbackSense(TMC9660 &parent) noexcept
Definition tmc9660.hpp:2141
bool configureSPIEncoderInitialization(tmc9660::tmcl::SpiInitMethod init_method, int16_t offset=0) noexcept
Configure SPI encoder initialization method.
bool getABNRawValue(uint32_t &value) noexcept
Read the raw ABN encoder internal counter value.
bool getSPIEncoderCommutationAngle(int16_t &angle) noexcept
Read SPI_ENCODER_COMMUTATION_ANGLE (-32768…32767).
bool getSPIEncoderCSIdleDelay(uint8_t &timeUs) noexcept
Read SPI_ENCODER_CS_IDLE_DELAY_TIME (0…102 µs).
bool configureAuto(const AbnConfig &config) noexcept
Auto-configure ABN encoder feedback.
static int16_t degreesToHallOffset(float degrees) noexcept
Convert electrical angle from degrees to 16-bit format.
bool configureSPIEncoderDataFormat(uint32_t position_mask, uint8_t positionShift=0, tmc9660::tmcl::Direction invertDirection=tmc9660::tmcl::Direction::NOT_INVERTED) noexcept
Configure SPI encoder data format and processing.
bool getSPIEncoderPositionMask(uint32_t &mask) noexcept
Read SPI_ENCODER_POSITION_COUNTER_MASK.
bool configureAuto(const HallConfig &config) noexcept
Auto-configure Hall sensor feedback.
bool configureSPIEncoder(uint8_t cmd_size, uint16_t cs_settle_time_ns, uint8_t cs_idle_time_us) noexcept
Configure a SPI-based encoder for feedback.
bool getSecondaryABNDirection(tmc9660::tmcl::Direction &dir) noexcept
Read ABN_2_DIRECTION (normal/inverted).
bool getSecondaryABNGearRatio(uint8_t &ratio) noexcept
Read ABN_2_GEAR_RATIO (1…255).
bool configureABNInitialization(tmc9660::tmcl::AbnInitMethod initMethod=tmc9660::tmcl::AbnInitMethod::FORCED_PHI_E_ZERO_WITH_ACTIVE_SWING, uint16_t initDelay=1000, int32_t initVelocity=5, int16_t nChannelOffset=0) noexcept
Configure ABN encoder initialization method.
bool getSPIEncoderDirection(tmc9660::tmcl::Direction &dir) noexcept
Read SPI_ENCODER_DIRECTION.
bool setHallPositionOffsets(int16_t offset0=0, int16_t offset60=10922, int16_t offset120=21845, int16_t offset180=-32768, int16_t offset240=-21846, int16_t offset300=-10923, int16_t globalOffset=0) noexcept
Set Hall sensor position offsets for improved accuracy.
bool getABNInitializationState(tmc9660::tmcl::AbnInitState &state) noexcept
Read the current state of ABN encoder initialization.
bool setSPIEncoderRequestData(const uint8_t *requestData, uint8_t size) noexcept
Set up SPI encoder request data for continuous transfer mode.
bool configureABNEncoder(uint32_t counts_per_rev, tmc9660::tmcl::Direction inverted=tmc9660::tmcl::Direction::NOT_INVERTED, tmc9660::tmcl::EnableDisable nChannelInverted=tmc9660::tmcl::EnableDisable::DISABLED) noexcept
Configure an ABN incremental encoder for feedback.
bool configureAuto(const SpiEncoderConfig &config) noexcept
Auto-configure SPI encoder feedback.
bool setSecondaryABNEncoderEnabled(bool enable) noexcept
Enable or disable the secondary ABN encoder.
Subsystem for configuring general-purpose IOs (GPIOs).
Definition tmc9660.hpp:4601
bool setMode(uint8_t pin, bool output, bool pullEnable=false, bool pullUp=true) noexcept
Configure a GPIO pin as input or output.
TMC9660 & driver
Definition tmc9660.hpp:4638
Configuration structure for auto-configuring power stage protection.
Definition tmc9660.hpp:1421
float blankingMargin
Blanking time safety margin multiplier (default: 1.2x)
Definition tmc9660.hpp:1439
tmc9660::tmcl::UndervoltageLevel supplyLevel
Definition tmc9660.hpp:1470
float expectedPeakCurrent_A
Expected peak phase current in amperes.
Definition tmc9660.hpp:1429
tmc9660::tmcl::PwmOutputPolarity pwmHighPolarity
Definition tmc9660.hpp:1464
tmc9660::tmcl::DriveFaultBehaviour faultBehaviour
Definition tmc9660.hpp:1445
float shuntResistance_mOhm
Definition tmc9660.hpp:1425
float motorInductance_uH
Definition tmc9660.hpp:1432
tmc9660::tmcl::PwmOutputPolarity pwmLowPolarity
Definition tmc9660.hpp:1460
float overcurrentMargin
Overcurrent threshold margin above expected peak (default: 1.5x)
Definition tmc9660.hpp:1437
float mosfet_gateCharge_nC
MOSFET gate charge in nanocoulombs (Qg from datasheet)
Definition tmc9660.hpp:1424
uint8_t faultHandlerRetries
Maximum number of retries per detected fault [0-255] (default: 5)
Definition tmc9660.hpp:1448
float pwmFrequency_Hz
PWM switching frequency in Hz.
Definition tmc9660.hpp:1428
float mosfet_RdsOn_mOhm
MOSFET on-resistance in milliohms (at operating junction temp)
Definition tmc9660.hpp:1423
std::optional< float > targetTurnOffTime_ns
Definition tmc9660.hpp:1456
float busVoltage_V
DC bus voltage in volts.
Definition tmc9660.hpp:1427
std::optional< float > targetTurnOnTime_ns
Definition tmc9660.hpp:1453
tmc9660::tmcl::GdrvRetryBehaviour retryBehaviour
Definition tmc9660.hpp:1442
Subsystem for configuring the MOSFET gate driver.
Definition tmc9660.hpp:1047
bool setFaultHandlerRetries(uint8_t retries) noexcept
Set the maximum number of retries for fault handling.
bool enableVdsMonitoringLow(tmc9660::tmcl::VdsUsage uvw_enable, tmc9660::tmcl::VdsUsage y2Enable) noexcept
Enable or disable VDS monitoring for overcurrent protection on UVW and Y2 low sides.
bool setDriveFaultBehavior(tmc9660::tmcl::DriveFaultBehaviour fault_behavior) noexcept
Configure drive fault behavior.
bool enableAdaptiveDriveTime(bool enable_uvw, bool enable_y2) noexcept
Enable or disable adaptive drive time for UVW and Y2 phases.
bool configureDriveTimes_ns(float sinkTimeUVW_ns, float sourceTimeUVW_ns, float sinkTimeY2_ns, float sourceTimeY2_ns) noexcept
Configure drive times using nanoseconds (recommended API).
bool configureBreakBeforeMakeTiming(uint8_t low_side_uvw, uint8_t high_side_uvw, uint8_t low_side_y2, uint8_t high_side_y2) noexcept
Configure the break-before-make timing for the gate driver (advanced API).
bool configureBreakBeforeMakeTiming_ns(float lowSideUVW_ns, float highSideUVW_ns, float lowSideY2_ns, float highSideY2_ns) noexcept
Configure break-before-make timing using nanoseconds (recommended API).
bool configureCurrentLimits(tmc9660::tmcl::GateCurrentSink sink_current_uvw, tmc9660::tmcl::GateCurrentSource source_current_uvw, tmc9660::tmcl::GateCurrentSink sink_current_y2, tmc9660::tmcl::GateCurrentSource source_current_y2) noexcept
Configure gate driver current limits for UVW and Y2 phases.
bool configureVgsShortProtectionY2(tmc9660::tmcl::VgsShortEnable enable_low_side_on, tmc9660::tmcl::VgsShortEnable enable_low_side_off, tmc9660::tmcl::VgsShortEnable enable_high_side_on, tmc9660::tmcl::VgsShortEnable enable_high_side_off) noexcept
Configure gate-to-source short protection for Y2 phase.
bool setOvercurrentDeglitch(tmc9660::tmcl::OvercurrentTiming uvw_low_side_time, tmc9660::tmcl::OvercurrentTiming uvw_high_side_time, tmc9660::tmcl::OvercurrentTiming y2LowSideTime, tmc9660::tmcl::OvercurrentTiming y2HighSideTime) noexcept
Configure the overcurrent protection deglitch time for UVW and Y2 phases.
bool configureBootstrapCurrentLimit(tmc9660::tmcl::BootstrapCurrentLimit limit) noexcept
Configure bootstrap current limit.
bool configureDriveTimes(uint8_t sink_time_uvw, uint8_t source_time_uvw, uint8_t sink_time_y2, uint8_t source_time_y2) noexcept
Configure drive times for UVW and Y2 phases (advanced API).
bool setOvercurrentBlanking(tmc9660::tmcl::OvercurrentTiming uvw_low_side_time, tmc9660::tmcl::OvercurrentTiming uvw_high_side_time, tmc9660::tmcl::OvercurrentTiming y2LowSideTime, tmc9660::tmcl::OvercurrentTiming y2HighSideTime) noexcept
Configure the overcurrent protection blanking time for UVW and Y2 phases.
bool setVgsShortBlankingTime(tmc9660::tmcl::VgsBlankingTime uvw_time, tmc9660::tmcl::VgsBlankingTime y2Time) noexcept
Set gate-to-source short protection blanking time.
bool setVgsShortDeglitchTime(tmc9660::tmcl::VgsDeglitchTime uvw_time, tmc9660::tmcl::VgsDeglitchTime y2Time) noexcept
Set gate-to-source short protection deglitch time.
bool configureVgsShortProtectionUVW(tmc9660::tmcl::VgsShortEnable enable_low_side_on, tmc9660::tmcl::VgsShortEnable enable_low_side_off, tmc9660::tmcl::VgsShortEnable enable_high_side_on, tmc9660::tmcl::VgsShortEnable enable_high_side_off) noexcept
Configure gate-to-source short protection for UVW phases.
bool enableOvercurrentProtection(tmc9660::tmcl::OvercurrentEnable enable_uvw_low_side, tmc9660::tmcl::OvercurrentEnable enable_uvw_high_side, tmc9660::tmcl::OvercurrentEnable enable_y2_low_side, tmc9660::tmcl::OvercurrentEnable enable_y2_high_side) noexcept
Enable or disable overcurrent protection for UVW and Y2 phases.
bool setOvercurrentThresholds(tmc9660::tmcl::OvercurrentThreshold uvw_low_side_threshold, tmc9660::tmcl::OvercurrentThreshold uvw_high_side_threshold, tmc9660::tmcl::OvercurrentThreshold y2LowSideThreshold, tmc9660::tmcl::OvercurrentThreshold y2HighSideThreshold) noexcept
Configure overcurrent protection thresholds for UVW and Y2 phases.
TMC9660 & driver
Definition tmc9660.hpp:1597
bool configureUndervoltageProtection(tmc9660::tmcl::UndervoltageLevel supplyLevel, tmc9660::tmcl::UndervoltageEnable enable_vdrv, tmc9660::tmcl::UndervoltageEnable enable_bst_uvw, tmc9660::tmcl::UndervoltageEnable enable_bst_y2) noexcept
Configure undervoltage protection settings.
bool configurePowerStageProtection(const PowerStageProfile &profile) noexcept
Auto-configure complete power stage based on physical properties.
bool setOutputPolarity(tmc9660::tmcl::PwmOutputPolarity low_side, tmc9660::tmcl::PwmOutputPolarity high_side) noexcept
Set the gate driver output polarity.
GateDriver(TMC9660 &parent) noexcept
Definition tmc9660.hpp:1596
bool setRetryBehavior(tmc9660::tmcl::GdrvRetryBehaviour retry_behavior) noexcept
Configure fault retry behavior.
Convenience helpers for reading and writing global parameters.
Definition tmc9660.hpp:4494
bool getSerialAddress(uint8_t &address) noexcept
Get module serial address (bank0:SERIAL_ADDRESS).
bool readBank2(tmc9660::tmcl::GlobalParamBank2 param, int32_t &value) noexcept
Read a signed user variable from bank 2.
bool writeBank2(tmc9660::tmcl::GlobalParamBank2 param, int32_t value) noexcept
Write a signed user variable in bank 2.
bool getClearUserVariables(bool &clear) noexcept
Get clear-user-variable flag.
bool setAutoStart(bool enable) noexcept
Enable or disable auto-start of stored program (bank0:AUTO_START_ENABLE).
bool getTimerPeriod(uint8_t timer, uint32_t &period_ms) noexcept
Get interrupt timer period (bank3).
bool getPullDirectionMask(uint32_t &mask) noexcept
Get pull direction mask.
bool setPullDirectionMask(uint32_t mask) noexcept
Set pull direction mask (bank0:IO_INPUT_PULLUP_PULLDOWN_DIRECTION_MASK).
TMC9660 & driver
Definition tmc9660.hpp:4585
bool setInputTrigger(uint8_t index, tmc9660::tmcl::TriggerTransition transition) noexcept
Set trigger transition for digital input n (bank3 INPUT_n_TRIGGER_TRANSITION).
bool setClearUserVariables(bool clear) noexcept
Configure clearing of user variables on startup (bank0:CLEAR_USER_VARIABLES).
bool setUserVariable(uint8_t index, int32_t value) noexcept
Set user variable by index (bank2).
bool writeBank0(tmc9660::tmcl::GlobalParamBank0 param, uint32_t value) noexcept
Write a value to bank 0 (system settings).
bool getIODirectionMask(uint32_t &mask) noexcept
Get GPIO direction mask (bank0:IO_DIRECTION_MASK).
bool setSerialAddress(uint8_t address) noexcept
Set module serial address (bank0:SERIAL_ADDRESS).
bool getHostAddress(uint8_t &address) noexcept
Get host serial address (bank0:SERIAL_HOST_ADDRESS).
bool readBank0(tmc9660::tmcl::GlobalParamBank0 param, uint32_t &value) noexcept
Read a value from bank 0 (system settings).
bool getAutoStart(bool &enable) noexcept
Read auto-start enable flag.
bool getUserVariable(uint8_t index, int32_t &value) noexcept
Read user variable by index (bank2).
bool getHeartbeat(tmc9660::tmcl::HeartbeatMonitoringConfig &iface, uint32_t &timeout_ms) noexcept
Read heartbeat monitoring configuration.
bool getInputTrigger(uint8_t index, tmc9660::tmcl::TriggerTransition &transition) noexcept
Get trigger transition for digital input n.
bool setHostAddress(uint8_t address) noexcept
Set host serial address (bank0:SERIAL_HOST_ADDRESS).
bool setPullEnableMask(uint32_t mask) noexcept
Set pull-up/down enable mask (bank0:IO_INPUT_PULLUP_PULLDOWN_ENABLE_MASK).
bool writeBank3(tmc9660::tmcl::GlobalParamBank3 param, uint32_t value) noexcept
Write a value to bank 3 (interrupt configuration).
Globals(TMC9660 &parent) noexcept
Definition tmc9660.hpp:4584
bool configureHeartbeat(tmc9660::tmcl::HeartbeatMonitoringConfig iface, uint32_t timeout_ms) noexcept
Configure heartbeat monitoring interface and timeout.
bool readBank3(tmc9660::tmcl::GlobalParamBank3 param, uint32_t &value) noexcept
Read a value from bank 3 (interrupt configuration).
bool getPullEnableMask(uint32_t &mask) noexcept
Get pull-up/down enable mask.
bool setTimerPeriod(uint8_t timer, uint32_t period_ms) noexcept
Set interrupt timer period (bank3).
bool setIODirectionMask(uint32_t mask) noexcept
Set GPIO direction mask (bank0:IO_DIRECTION_MASK).
Configuration structure for heartbeat auto-configuration.
Definition tmc9660.hpp:4453
std::optional< bool > enable
Enable heartbeat monitoring (optional, default: false).
Definition tmc9660.hpp:4459
std::optional< uint32_t > timeoutMs
Heartbeat timeout in milliseconds (optional, default: 1000ms).
Definition tmc9660.hpp:4466
Subsystem for configuring the communication watchdog (heartbeat).
Definition tmc9660.hpp:4434
TMC9660 & driver
Definition tmc9660.hpp:4481
bool configure(tmc9660::tmcl::HeartbeatMonitoringConfig mode, uint32_t timeout_ms) noexcept
Enable the heartbeat monitor and set timeout.
bool configureAuto(const HeartbeatConfig &config) noexcept
Auto-configure heartbeat parameters.
Heartbeat(TMC9660 &parent) noexcept
Definition tmc9660.hpp:4480
Subsystem for motor thermal overload protection via I²t integration.
Definition tmc9660.hpp:3785
bool configure(uint16_t timeConstant1_ms, float continuousCurrent1_A, uint16_t timeConstant2_ms, float continuousCurrent2_A) noexcept
Configure the two I²t monitoring windows.
bool setThermalWindingTimeConstant2(uint16_t ms) noexcept
Set the winding time constant for window 2.
bool getLimit1(uint32_t &limit) noexcept
Get the I²t limit for window 1.
bool getThermalWindingTimeConstant2(uint16_t &ms) noexcept
Get the winding time constant for window 2.
bool getLimit2(uint32_t &limit) noexcept
Get the I²t limit for window 2.
TMC9660 & driver
Definition tmc9660.hpp:3855
bool setLimit2(uint32_t limit) noexcept
Set the I²t limit for window 2.
bool getActualTotalMotorCurrent(uint32_t ¤t, uint8_t motorIndex=0) noexcept
Read the total motor current (torque+flux).
bool setThermalWindingTimeConstant1(uint16_t ms) noexcept
Set the winding time constant for window 1.
bool resetIntegralState() noexcept
Reset both I²t accumulators to zero.
bool getSum1(uint32_t &sum) noexcept
Read the current integrated sum of window 1.
bool setLimit1(uint32_t limit) noexcept
Set the I²t limit for window 1.
bool getThermalWindingTimeConstant1(uint16_t &ms) noexcept
Get the winding time constant for window 1.
bool getSum2(uint32_t &sum) noexcept
Read the current integrated sum of window 2.
Configuration structure for auto-configuring motor parameters.
Definition tmc9660.hpp:607
std::optional< tmc9660::tmcl::CommutationMode > commutationMode
Definition tmc9660.hpp:632
tmc9660::tmcl::MotorType motorType
Motor type (DC, BLDC, STEPPER)
Definition tmc9660.hpp:609
float maxPhaseCurrent_A
Definition tmc9660.hpp:613
uint8_t polePairs
Number of pole pairs (for BLDC/Stepper, typically 1-21)
Definition tmc9660.hpp:610
uint32_t pwmFrequency_Hz
Definition tmc9660.hpp:611
Motor configuration and control subsystem.
Definition tmc9660.hpp:380
TMC9660 & driver
Definition tmc9660.hpp:663
bool configureAuto(const MotorProfile &profile) noexcept
Auto-configure motor parameters based on high-level motor characteristics.
bool setType(tmc9660::tmcl::MotorType type, uint8_t polePairs=1) noexcept
Configure the motor type (DC, BLDC, or stepper) and basic motor settings.
MotorConfig(TMC9660 &parent) noexcept
Definition tmc9660.hpp:662
Subsystem for storing and recalling parameters from nonvolatile flash.
Definition tmc9660.hpp:4389
bool storeToFlash() noexcept
Store all writable parameters to flash or EEPROM.
TMC9660 & driver
Definition tmc9660.hpp:4418
Configuration structure for position control auto-configuration.
Definition tmc9660.hpp:3178
tmc9660::tmcl::PositionSensorSelection sensorSelection
Position feedback sensor selection (required)
Definition tmc9660.hpp:3181
std::optional< int32_t > positionLimitLow
Low position limit (optional, disabled if not provided)
Definition tmc9660.hpp:3242
std::optional< uint32_t > stopOnDeviationMaxError
Definition tmc9660.hpp:3251
std::optional< uint16_t > positionI
Position I gain [0-32767] (optional, default: 100).
Definition tmc9660.hpp:3196
std::optional< int32_t > positionLimitHigh
High position limit (optional, disabled if not provided)
Definition tmc9660.hpp:3244
std::optional< uint16_t > positionScalingFactor
Definition tmc9660.hpp:3207
std::optional< uint32_t > encoderCountsPerRev
Definition tmc9660.hpp:3210
std::optional< uint16_t > positionP
Position P gain [0-32767] (optional, default: 2000).
Definition tmc9660.hpp:3189
Subsystem for position control (FOC outer loop).
Definition tmc9660.hpp:2940
bool getReferenceSwitchPolaritySwap(tmc9660::tmcl::ReferenceSwitchPolaritySwap &config) noexcept
Read switch polarity/swap config.
bool getPositionScalingFactor(uint16_t &factor) noexcept
Read position scaling factor.
bool setReferenceSwitchPolaritySwap(tmc9660::tmcl::ReferenceSwitchPolaritySwap config) noexcept
Configure switch polarity and swap.
bool getPositionLoopDownsampling(uint8_t ÷r) noexcept
Read position loop downsampling.
bool getReferenceSwitchSpeed(int32_t &speed) noexcept
Read reference positioning speed.
bool setStopOnPositionDeviation(uint32_t max_error, bool softStop=true) noexcept
Configure stop-on-position-deviation.
bool getReferenceSwitchSearchSpeed(int32_t &speed) noexcept
Read reference search speed.
bool getStopOnPositionDeviation(uint32_t &max_error, bool &soft_stop) noexcept
Read stop-on-position-deviation settings.
PositionControl(TMC9660 &parent) noexcept
Definition tmc9660.hpp:3269
bool getPositionReachedThreshold(uint32_t &threshold) noexcept
Read position reached threshold.
bool setPositionSensor(tmc9660::tmcl::PositionSensorSelection sel) noexcept
Select position feedback sensor.
bool getRightLimitSwitchPosition(int32_t &position) noexcept
Read right-limit-switch position.
bool setReferenceSwitchSpeed(int32_t speed) noexcept
Set reference positioning speed.
bool getActualPosition(int32_t &position) noexcept
Read actual position.
bool setPositionNormalization(tmc9660::tmcl::VelocityPiNorm p_norm, tmc9660::tmcl::VelocityPiNorm i_norm) noexcept
Set position PI normalization.
bool getMccInputsRaw(uint16_t &inputs) noexcept
bool setPositionScalingFactor(uint16_t factor) noexcept
Set position scaling factor.
bool setPositionLoopGains(uint16_t p, uint16_t i) noexcept
Configure position PI gains.
bool setReferenceSwitchLatchSettings(tmc9660::tmcl::ReferenceSwitchLatchSettings setting) noexcept
Configure switch latch settings.
bool setPositionLoopDownsampling(uint8_t divider) noexcept
Set position loop downsampling.
TMC9660 & driver
Definition tmc9660.hpp:3270
bool getPositionLimitHigh(int32_t &limit) noexcept
Read high position limit.
bool stop() noexcept
Stop position control (SYSTEM_OFF).
bool setReferenceSwitchSearchSpeed(int32_t speed) noexcept
Set reference search speed.
bool getReferenceSwitchSearchMode(tmc9660::tmcl::ReferenceSwitchSearchMode &mode) noexcept
Read reference search mode.
bool getHomeSwitchPosition(int32_t &position) noexcept
Read home-switch position.
bool setEventStopSettings(tmc9660::tmcl::EventStopSettings settings) noexcept
Configure event-stop settings.
bool setPositionLimitLow(int32_t limit) noexcept
Set low position limit.
bool getPositionLimitLow(int32_t &limit) noexcept
Read low position limit.
bool getPositionSensor(tmc9660::tmcl::PositionSensorSelection &sel) noexcept
Read position feedback sensor.
bool getPositionPiError(int32_t &error) noexcept
Read position-PI error.
bool getReferenceSwitchEnable(tmc9660::tmcl::ReferenceSwitchEnable &enable) noexcept
Read reference switch enable mask.
bool setReferenceSwitchEnable(tmc9660::tmcl::ReferenceSwitchEnable enable) noexcept
Enable/disable reference switch stops.
bool setPositionLimitHigh(int32_t limit) noexcept
Set high position limit.
bool getReferenceSwitchLatchSettings(tmc9660::tmcl::ReferenceSwitchLatchSettings &setting) noexcept
Read switch latch settings.
bool setReferenceSwitchSearchMode(tmc9660::tmcl::ReferenceSwitchSearchMode mode) noexcept
Set reference search mode.
bool getEventStopSettings(tmc9660::tmcl::EventStopSettings &settings) noexcept
Read event-stop settings.
bool setTargetPosition(int32_t position) noexcept
Set target position.
bool getPositionPiIntegrator(int32_t &integrator) noexcept
Read position-PI integrator.
bool configureAuto(const PositionConfig &config) noexcept
Auto-configure position control parameters.
bool getLastReferencePosition(int32_t &position) noexcept
Read last reference position.
bool setPositionReachedThreshold(uint32_t threshold) noexcept
Set position reached threshold.
Configuration structure for power management auto-configuration.
Definition tmc9660.hpp:4677
std::optional< bool > enableWakePin
Enable external wake-up pin (optional, default: false).
Definition tmc9660.hpp:4683
std::optional< tmc9660::tmcl::PowerDownTimeout > powerDownTimeout
Power-down timeout period (optional, default: disabled).
Definition tmc9660.hpp:4691
Subsystem for entering low-power hibernation mode and configuring wake.
Definition tmc9660.hpp:4654
bool enableWakePin(bool enable) noexcept
Enable or disable the external wake-up pin.
Power(TMC9660 &parent) noexcept
Definition tmc9660.hpp:4705
bool configureAuto(const PowerConfig &config) noexcept
Auto-configure power management parameters.
TMC9660 & driver
Definition tmc9660.hpp:4706
bool enterPowerDown(tmc9660::tmcl::PowerDownTimeout period) noexcept
Put the chip into power-down mode for a set duration.
Configuration structure for protection auto-configuration.
Definition tmc9660.hpp:4144
std::optional< float > undervoltageThreshold_V
Undervoltage threshold in volts (optional, default: 20.0V for 24V systems).
Definition tmc9660.hpp:4166
std::optional< uint16_t > i2tTimeConstant2_ms
I²t window 2 time constant in milliseconds (optional, default: 1000ms).
Definition tmc9660.hpp:4221
std::optional< float > i2tContinuousCurrent1_A
I²t window 1 continuous current limit in Amps (optional, default: 1.5A).
Definition tmc9660.hpp:4212
std::optional< float > temperatureShutdown_C
Temperature shutdown threshold in °C (optional, default: 100.0°C).
Definition tmc9660.hpp:4186
std::optional< float > i2tContinuousCurrent2_A
I²t window 2 continuous current limit in Amps (optional, default: 1.25A).
Definition tmc9660.hpp:4228
std::optional< uint16_t > i2tTimeConstant1_ms
I²t window 1 time constant in milliseconds (optional, default: 100ms).
Definition tmc9660.hpp:4205
std::optional< float > overvoltageThreshold_V
Overvoltage threshold in volts (optional, default: 28.0V for 24V systems).
Definition tmc9660.hpp:4155
std::optional< float > temperatureWarning_C
Temperature warning threshold in °C (optional, default: 80.0°C).
Definition tmc9660.hpp:4177
std::optional< bool > enableOvercurrent
Enable overcurrent protection (optional, default: true).
Definition tmc9660.hpp:4196
Subsystem for motor protection features.
Definition tmc9660.hpp:4090
bool configureVoltage(uint16_t over_volt_threshold, uint16_t under_volt_threshold) noexcept
Configure overvoltage and undervoltage protection thresholds.
Protection(TMC9660 &parent) noexcept
Definition tmc9660.hpp:4244
bool resetI2tState() noexcept
Reset the integrated I²t sum accumulators.
bool configureTemperature(float warning_deg_c, float shutdown_deg_c) noexcept
Configure over-temperature protection thresholds.
TMC9660 & driver
Definition tmc9660.hpp:4245
bool setOvercurrentEnabled(bool enabled) noexcept
Enable or disable overcurrent protection on the driver outputs.
bool configureAuto(const ProtectionConfig &config) noexcept
Auto-configure protection parameters.
bool configureI2t(uint16_t timeConstant1_ms, float continuousCurrent1_A, uint16_t timeConstant2_ms, float continuousCurrent2_A) noexcept
Configure the two I²t monitoring windows for motor current.
Subsystem for debug and data logging features.
Definition tmc9660.hpp:4339
bool init(uint32_t sample_count) noexcept
Initialize and configure the RAMDebug feature (data logging).
bool startCapture() noexcept
Start capturing data using RAMDebug.
TMC9660 & driver
Definition tmc9660.hpp:4371
Configuration structure for ramp auto-configuration.
Definition tmc9660.hpp:3369
std::optional< uint16_t > timeZeroWait
Wait time at end of ramp (optional, default: 0).
Definition tmc9660.hpp:3465
std::optional< uint32_t > maxAcceleration
Maximum acceleration in µ units/s² (optional, default: 1000).
Definition tmc9660.hpp:3385
std::optional< bool > enableRamp
Enable ramp generator (optional, default: false).
Definition tmc9660.hpp:3472
std::optional< uint16_t > timeAtVmax
Minimum time at VMAX before deceleration (optional, default: 0).
Definition tmc9660.hpp:3458
std::optional< uint32_t > velocityThreshold1
Velocity threshold 1 in internal units (optional, default: 0).
Definition tmc9660.hpp:3430
std::optional< bool > enableVelocityFeedForward
Enable velocity feedforward (optional, default: false).
Definition tmc9660.hpp:3487
std::optional< uint32_t > maxDeceleration
Maximum deceleration in µ units/s² (optional, default: 1000).
Definition tmc9660.hpp:3409
std::optional< tmc9660::tmcl::AccelerationFFShift > accelerationFeedForwardShift
Acceleration feedforward shift (optional, default: SHIFT_4).
Definition tmc9660.hpp:3509
std::optional< uint32_t > stopVelocity
Stop velocity in internal units (optional, default: 1).
Definition tmc9660.hpp:3451
std::optional< bool > enableAccelerationFeedForward
Enable acceleration feedforward (optional, default: false).
Definition tmc9660.hpp:3493
std::optional< uint32_t > startVelocity
Start velocity in internal units (optional, default: 0).
Definition tmc9660.hpp:3444
std::optional< uint32_t > deceleration1
First deceleration segment in µ units/s² (optional, default: 8000).
Definition tmc9660.hpp:3416
std::optional< uint32_t > acceleration2
Second acceleration segment in µ units/s² (optional, default: 4000).
Definition tmc9660.hpp:3401
uint32_t maxVelocity
Maximum velocity in internal units (required).
Definition tmc9660.hpp:3376
std::optional< uint32_t > deceleration2
Second deceleration segment in µ units/s² (optional, default: 8000).
Definition tmc9660.hpp:3423
std::optional< bool > enableDirectVelocityMode
Enable direct velocity mode (optional, default: true).
Definition tmc9660.hpp:3480
std::optional< uint32_t > acceleration1
First acceleration segment in µ units/s² (optional, default: 8000).
Definition tmc9660.hpp:3393
std::optional< uint32_t > velocityThreshold2
Velocity threshold 2 in internal units (optional, default: 0).
Definition tmc9660.hpp:3437
std::optional< uint16_t > accelerationFeedForwardGain
Acceleration feedforward gain (optional, default: 8).
Definition tmc9660.hpp:3502
Hardware 8-segment acceleration/dec-acc profile controller.
Definition tmc9660.hpp:3293
bool setTiming(uint16_t t_vmax_cycles, uint16_t t_zero_wait_cycles) noexcept
Timing constraints at Vmax and between moves.
bool setDirectVelocityMode(bool enable) noexcept
Direct-velocity mode instead of classic PI velocity loop.
bool getRampVelocity(int32_t &velocity) noexcept
Get the current target velocity calculated by the ramp controller.
TMC9660 & driver
Definition tmc9660.hpp:3525
bool enableFeedForward(bool enable_vel_ff, bool enable_accel_ff, uint16_t accel_ff_gain, tmc9660::tmcl::AccelerationFFShift accel_ff_shift) noexcept
Enable hardware feed-forward terms and set gain/shift.
bool getRampPosition(int32_t &position) noexcept
Get the current target position calculated by the ramp controller.
bool enable(bool on) noexcept
Enable or disable the ramp generator block.
Ramp(TMC9660 &parent) noexcept
Definition tmc9660.hpp:3524
bool setDeceleration(uint32_t d1, uint32_t d2, uint32_t d_max) noexcept
Set deceleration segments D1, D2, Dmax (µ units/s²).
bool setAcceleration(uint32_t a1, uint32_t a2, uint32_t a_max) noexcept
Set acceleration segments A1, A2, Amax (µ units/s²).
bool setVelocities(uint32_t v_start, uint32_t v_stop, uint32_t v1, uint32_t v2, uint32_t v_max) noexcept
Configure velocity thresholds and limits.
bool configureAuto(const RampConfig &config) noexcept
Auto-configure ramp parameters.
Subsystem for executing a reference search (homing) routine.
Definition tmc9660.hpp:3614
TMC9660 & driver
Definition tmc9660.hpp:3625
bool start() noexcept
Start the reference search procedure.
bool getStatus(tmc9660::tmcl::ReferenceSearchStatus &status) noexcept
Query the current reference search status code.
bool stop() noexcept
Abort an ongoing reference search.
Subsystem for TMCL script execution control.
Definition tmc9660.hpp:4254
bool start(uint16_t address=0) noexcept
Start or restart execution of the stored script.
TMC9660 & driver
Definition tmc9660.hpp:4331
bool upload(const std::vector< uint32_t > &script_data) noexcept
Upload a TMCL script to the TMC9660's internal memory.
Subsystem for controlling the STEP/DIR pulse input interface.
Definition tmc9660.hpp:3543
bool enableExtrapolation(bool enable) noexcept
Enable signal extrapolation between STEP pulses.
bool setMaxExtrapolationVelocity(uint32_t e_rpm) noexcept
Set maximum allowed extrapolation velocity.
bool enableInterface(bool on) noexcept
Enable or disable the STEP/DIR interface.
StepDir(TMC9660 &parent) noexcept
Definition tmc9660.hpp:3605
bool enableVelocityFeedForward(bool enable_vel_ff) noexcept
Enable hardware feed-forward terms and set gain/shift.
bool setMicrostepResolution(tmc9660::tmcl::StepDirStepDividerShift µSteps) noexcept
Configure microstep resolution for each STEP pulse.
bool setSignalTimeout(uint16_t timeout_ms) noexcept
Timeout before extrapolated motion stops after last pulse.
TMC9660 & driver
Definition tmc9660.hpp:3606
Configuration structure for stop events auto-configuration.
Definition tmc9660.hpp:4010
std::optional< uint32_t > maxPositionDeviation
Maximum allowed position deviation for stop condition (optional, disabled if not provided).
Definition tmc9660.hpp:4029
std::optional< bool > invertLeftSwitch
Invert left switch polarity (optional, default: false).
Definition tmc9660.hpp:4053
std::optional< bool > swapLeftRight
Swap left and right switch wiring (optional, default: false).
Definition tmc9660.hpp:4065
std::optional< bool > deviationSoftStop
Use soft stop (ramp down) for deviation stop (optional, default: true).
Definition tmc9660.hpp:4037
std::optional< uint32_t > maxVelocityDeviation
Maximum allowed velocity deviation for stop condition (optional, disabled if not provided).
Definition tmc9660.hpp:4019
std::optional< bool > invertRightSwitch
Invert right switch polarity (optional, default: false).
Definition tmc9660.hpp:4057
std::optional< bool > invertHomeSwitch
Invert home switch polarity (optional, default: false).
Definition tmc9660.hpp:4061
std::optional< uint8_t > referenceSwitchMask
Reference switch enable mask (optional, default: 0 = all disabled).
Definition tmc9660.hpp:4049
Configure automatic stop/latch behaviour for deviation, switches.
Definition tmc9660.hpp:3955
bool configureAuto(const StopEventsConfig &config) noexcept
Auto-configure stop events parameters.
StopEvents(TMC9660 &parent) noexcept
Definition tmc9660.hpp:4080
bool enableDeviationStop(uint32_t max_vel_error, uint32_t max_pos_error, bool softStop=true) noexcept
Stop when ramp target deviates from actual > thresholds.
TMC9660 & driver
Definition tmc9660.hpp:4081
Subsystem for reading various telemetry and status information from the driver.
Definition tmc9660.hpp:3865
bool clearADCStatusFlags(uint32_t mask) noexcept
Clear bits in the ADC_STATUS_FLAGS register (write-1-to-clear).
int16_t getMotorCurrent() noexcept
Read the current motor current (torque current).
float getChipTemperature() noexcept
Read the internal chip temperature.
int32_t getActualVelocity() noexcept
Read the measured actual velocity of the motor.
bool getGeneralStatusFlags(uint32_t &flags) noexcept
Read the GENERAL_STATUS_FLAGS register.
float getSupplyVoltage() noexcept
Read the current supply (bus) voltage.
bool getGeneralErrorFlags(uint32_t &flags) noexcept
Read the GENERAL_ERROR_FLAGS register.
int32_t getActualPosition() noexcept
Read the measured actual position of the motor.
bool clearGateDriverErrorFlags(uint32_t mask) noexcept
Clear bits in the GDRV_ERROR_FLAGS register.
bool getADCStatusFlags(uint32_t &flags) noexcept
Read the ADC_STATUS_FLAGS register (clipped ADC channels).
TMC9660 & driver
Definition tmc9660.hpp:3946
uint16_t getExternalTemperature() noexcept
Read the external temperature sensor raw value.
bool clearGeneralErrorFlags(uint32_t mask) noexcept
Clear bits in the GENERAL_ERROR_FLAGS register.
bool getGateDriverErrorFlags(uint32_t &flags) noexcept
Read the GDRV_ERROR_FLAGS register.
Configuration structure for torque/flux control auto-configuration.
Definition tmc9660.hpp:2355
std::optional< uint16_t > fluxI
Flux I gain [0-32767] (optional, only used if separateTorqueFluxLoops = true)
Definition tmc9660.hpp:2394
std::optional< int32_t > biquadBCoeff2
Definition tmc9660.hpp:2527
std::optional< tmc9660::tmcl::CurrentPiNormalization > iNormalization
I-term normalization format (optional, defaults to SHIFT_16_BIT)
Definition tmc9660.hpp:2411
std::optional< uint16_t > torqueP
Direct PI gain configuration (optional).
Definition tmc9660.hpp:2371
std::optional< int32_t > biquadACoeff2
Definition tmc9660.hpp:2520
std::optional< int32_t > biquadBCoeff1
Definition tmc9660.hpp:2525
std::optional< int32_t > biquadACoeff1
Biquad filter coefficients (optional, only used if enableTorqueBiquadFilter = true).
Definition tmc9660.hpp:2518
std::optional< uint16_t > torqueI
Torque I gain [0-32767] (optional, defaults to 100 if not provided)
Definition tmc9660.hpp:2373
std::optional< tmc9660::tmcl::CurrentPiNormalization > pNormalization
PI normalization format (optional).
Definition tmc9660.hpp:2409
std::optional< uint16_t > fluxP
Flux PI gains (only used if separateTorqueFluxLoops = true).
Definition tmc9660.hpp:2392
std::optional< int32_t > biquadBCoeff0
Definition tmc9660.hpp:2523
Subsystem for torque and flux current control (FOC inner loop).
Definition tmc9660.hpp:2158
bool setFieldWeakeningI(uint16_t milliamps) noexcept
bool getTorquePiError(int32_t &error) noexcept
Read torque PI error.
bool getFieldWeakeningVoltageThreshold(uint16_t &voltage) noexcept
bool setTorqueOffset(int16_t milliamps) noexcept
Set torque offset (feed-forward).
bool getActualFlux(int32_t &milliamps) noexcept
Read actual flux current.
TorqueFluxControl(TMC9660 &parent) noexcept
Definition tmc9660.hpp:2543
bool getTargetTorqueBiquadFilterEnable(bool &enable) noexcept
bool getTorqueFluxCombinedActualValues(uint32_t &value) noexcept
bool getFocCurrentIq(int16_t &milliamps) noexcept
bool setCurrentNormalization(tmc9660::tmcl::CurrentPiNormalization p_norm, tmc9660::tmcl::CurrentPiNormalization i_norm) noexcept
Set normalization for current-PI outputs.
bool getFocVoltageUq(int16_t &voltage) noexcept
bool getFocCurrentUx(int16_t &milliamps) noexcept
bool setOpenloopVoltage(uint16_t voltage) noexcept
Set open-loop voltage.
bool getTargetTorqueBiquadFilterBCoeff1(int32_t &coeff) noexcept
bool getTargetTorqueBiquadFilterACoeff1(int32_t &coeff) noexcept
bool setTargetTorqueBiquadFilterBCoeff1(int32_t coeff) noexcept
bool getVoltageDqCombinedActualValues(uint32_t &value) noexcept
bool configureAuto(const TorqueFluxConfig &config) noexcept
Auto-configure torque/flux control parameters.
bool getOpenloopVoltage(uint16_t &voltage) noexcept
Read open-loop voltage.
bool setFluxOffset(int16_t milliamps) noexcept
Set flux offset (feed-forward).
bool getFocCurrentWy(int16_t &milliamps) noexcept
bool getFieldWeakeningI(uint16_t &milliamps) noexcept
bool getTargetTorqueBiquadFilterBCoeff2(int32_t &coeff) noexcept
TMC9660 & driver
Definition tmc9660.hpp:2544
bool setCurrentLoopGains(uint16_t p, uint16_t i, bool separate=false, uint16_t fluxP=0, uint16_t fluxI=0) noexcept
Configure current-loop PI gains.
bool getActualTorque(int16_t &milliamps) noexcept
Read actual torque.
bool getTargetTorqueBiquadFilterACoeff2(int32_t &coeff) noexcept
bool getIntegratedActualTorqueValue(uint32_t &value) noexcept
bool getTorquePiIntegrator(int32_t &integrator) noexcept
Read torque-PI integrator state.
bool getFluxOffset(int16_t &milliamps) noexcept
Read flux offset.
bool setTargetTorqueBiquadFilterBCoeff0(int32_t coeff) noexcept
bool setTargetTorqueBiquadFilterEnable(bool enable) noexcept
bool setTargetTorqueBiquadFilterACoeff1(int32_t coeff) noexcept
bool stop() noexcept
Stop torque/flux control (SYSTEM_OFF).
bool getFluxPiError(int32_t &error) noexcept
Read flux PI error.
bool getFocCurrentV(int16_t &milliamps) noexcept
bool getOpenloopCurrent(uint16_t &milliamps) noexcept
Read open-loop current.
bool setOpenloopCurrent(uint16_t milliamps) noexcept
Set open-loop current.
bool getFocVoltageUx(int16_t &voltage) noexcept
bool getFocVoltageWy(int16_t &voltage) noexcept
bool setFieldWeakeningVoltageThreshold(uint16_t voltage) noexcept
bool getFluxPiIntegrator(int32_t &integrator) noexcept
Read flux-PI integrator state.
bool getFocVoltageV(int16_t &voltage) noexcept
bool getTargetTorqueBiquadFilterBCoeff0(int32_t &coeff) noexcept
bool getTorqueFluxCombinedTargetValues(uint32_t &value) noexcept
bool setTorqueFluxPiSeparation(tmc9660::tmcl::TorqueFluxPiSeparation sep) noexcept
Select combined or separate torque/flux PI parameters.
bool setTargetTorqueBiquadFilterBCoeff2(int32_t coeff) noexcept
bool setTargetTorqueBiquadFilterACoeff2(int32_t coeff) noexcept
bool setTargetTorque(int16_t milliamps) noexcept
Set desired torque.
bool getOpenloopAngle(int16_t &angle) noexcept
Read open-loop angle.
bool setTargetFlux(int16_t milliamps) noexcept
Set desired flux current.
bool getTorqueOffset(int16_t &milliamps) noexcept
Read torque offset.
Configuration structure for velocity control auto-configuration.
Definition tmc9660.hpp:2721
std::optional< uint16_t > velocityI
Velocity I gain [0-32767] (optional, default: 1).
Definition tmc9660.hpp:2739
std::optional< uint32_t > pwmFrequency_Hz
PWM frequency in Hz (optional, used for velocity meter threshold calculation).
Definition tmc9660.hpp:2798
std::optional< uint16_t > velocityP
Velocity P gain [0-32767] (optional, default: 800).
Definition tmc9660.hpp:2732
std::optional< int32_t > velocityBiquadBCoeff0
Definition tmc9660.hpp:2904
std::optional< int32_t > velocityBiquadACoeff2
Definition tmc9660.hpp:2902
std::optional< uint32_t > stopOnDeviationMaxError
Definition tmc9660.hpp:2827
tmc9660::tmcl::VelocitySensorSelection sensorSelection
Velocity feedback sensor selection (required)
Definition tmc9660.hpp:2724
std::optional< uint16_t > velocityScalingFactor
Velocity scaling factor [1-2047] (optional).
Definition tmc9660.hpp:2769
std::optional< uint32_t > meterSwitchThreshold
Velocity meter switch threshold (optional, auto-calculated if not provided).
Definition tmc9660.hpp:2851
std::optional< int32_t > velocityBiquadACoeff1
Velocity biquad filter coefficients (optional, only used if enableVelocityBiquadFilter is explicitly ...
Definition tmc9660.hpp:2900
std::optional< uint32_t > encoderCountsPerRev
Encoder counts per mechanical revolution (CPR) for auto-calculating velocity scaling.
Definition tmc9660.hpp:2781
std::optional< int32_t > velocityBiquadBCoeff2
Definition tmc9660.hpp:2908
std::optional< int32_t > velocityBiquadBCoeff1
Definition tmc9660.hpp:2906
std::optional< bool > enableVelocityBiquadFilter
Enable/disable biquad filter on actual velocity feedback.
Definition tmc9660.hpp:2873
std::optional< uint8_t > motor_polePairs
Motor pole pairs (optional, used for auto-calculating velocity scaling).
Definition tmc9660.hpp:2791
Subsystem for velocity control (FOC middle loop).
Definition tmc9660.hpp:2559
bool getVelocityLoopDownsampling(uint8_t ÷r) noexcept
Read velocity loop downsampling.
bool getIntegratedActualVelocityValue(uint32_t &value) noexcept
bool setVelocityNormalization(tmc9660::tmcl::VelocityPiNorm p_norm, tmc9660::tmcl::VelocityPiNorm i_norm) noexcept
Set velocity PI normalization.
bool stop() noexcept
Stop velocity control (SYSTEM_OFF).
VelocityControl(TMC9660 &parent) noexcept
Definition tmc9660.hpp:2924
bool setActualVelocityBiquadFilterBCoeff0(int32_t coeff) noexcept
bool setVelocityLoopDownsampling(uint8_t divider) noexcept
Set velocity loop downsampling.
bool getVelocityPiError(int32_t &error) noexcept
Read velocity-PI error.
bool getActualVelocityBiquadFilterBCoeff2(int32_t &coeff) noexcept
bool setVelocityMeterSwitchThreshold(uint32_t threshold) noexcept
Set velocity meter switch threshold.
bool setVelocityScalingFactor(uint16_t factor) noexcept
Set velocity scaling factor.
bool setActualVelocityBiquadFilterBCoeff1(int32_t coeff) noexcept
bool setStopOnVelocityDeviation(uint32_t max_error, bool softStop=true) noexcept
Configure stop-on-velocity-deviation.
bool setVelocitySensor(tmc9660::tmcl::VelocitySensorSelection sel) noexcept
Select velocity feedback sensor.
TMC9660 & driver
Definition tmc9660.hpp:2925
bool setActualVelocityBiquadFilterACoeff2(int32_t coeff) noexcept
bool getActualVelocityBiquadFilterEnable(bool &enable) noexcept
bool getVelocityMeterSwitchHysteresis(uint16_t &hysteresis) noexcept
Read velocity meter hysteresis.
bool setActualVelocityBiquadFilterEnable(bool enable) noexcept
bool getActualVelocityBiquadFilterBCoeff1(int32_t &coeff) noexcept
bool setVelocityMeterSwitchHysteresis(uint16_t hysteresis) noexcept
Set velocity meter hysteresis.
bool getVelocityMeterSwitchThreshold(uint32_t &threshold) noexcept
Read velocity meter switch threshold.
bool setTargetVelocity(int32_t velocity) noexcept
Set target velocity.
bool getVelocityPiIntegrator(int32_t &integrator) noexcept
Read velocity-PI integrator.
bool getActualVelocityBiquadFilterACoeff2(int32_t &coeff) noexcept
bool setVelocityLoopGains(uint16_t p, uint16_t i) noexcept
Configure velocity PI gains.
bool getActualVelocityBiquadFilterACoeff1(int32_t &coeff) noexcept
bool setActualVelocityBiquadFilterACoeff1(int32_t coeff) noexcept
bool getVelocityMeterMode(tmc9660::tmcl::VelocityMeterMode &mode) noexcept
Read current velocity meter mode.
bool getVelocitySensor(tmc9660::tmcl::VelocitySensorSelection &sel) noexcept
Read velocity feedback sensor.
bool getStopOnVelocityDeviation(uint32_t &max_error, bool &soft_stop) noexcept
Read stop-on-velocity-deviation settings.
bool getActualVelocity(int32_t &velocity) noexcept
Read actual velocity.
bool getActualVelocityBiquadFilterBCoeff0(int32_t &coeff) noexcept
bool configureAuto(const VelocityConfig &config) noexcept
Auto-configure velocity control parameters.
bool getVelocityScalingFactor(uint16_t &factor) noexcept
Read velocity scaling factor.
bool setActualVelocityBiquadFilterBCoeff2(int32_t coeff) noexcept
bool getVelocityOffset(int32_t &offset) noexcept
Read velocity offset.
bool setVelocityOffset(int32_t offset) noexcept
Set velocity offset.
Main TMC9660 bootloader interface class.
Communication interfaces for TMC9660 Parameter Mode devices using TMCL protocol over SPI.
TMCL operation and reply code enumerations for TMC9660 parameter mode.