HF-TMC9660 Driver
Hardware Agnostic C++ Driver for the TMC9660
Loading...
Searching...
No Matches
TMC9660.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstdint>
5#include <cstdlib>
6#include <span>
7#include <variant>
8#include <vector>
9
10#include "TMC9660Bootloader.hpp"
13
26class TMC9660 {
27public:
34 TMC9660(TMC9660CommInterface &comm, uint8_t address = 0,
35 const tmc9660::BootloaderConfig *bootCfg = nullptr) noexcept;
36
38 ~TMC9660() noexcept;
39
43 [[nodiscard]] TMC9660CommInterface &comm() noexcept {
44 return comm_;
45 }
46
47 //***************************************************************************
48 //** BOOTLOADER INITIALIZATION **//
49 //***************************************************************************
50
54 enum class BootloaderInitResult { Success, NoConfig, Failure };
55
64 TMC9660::BootloaderInitResult
65 bootloaderInit(const tmc9660::BootloaderConfig *cfg = nullptr) noexcept;
66
67 //***************************************************************************
68 //** CORE PARAMETER ACCESS METHODS **//
69 //***************************************************************************
70
80 [[nodiscard]] bool writeParameter(tmc9660::tmcl::Parameters id, uint32_t value,
81 uint8_t motorIndex = 0) noexcept;
89 [[nodiscard]] bool readParameter(tmc9660::tmcl::Parameters id, uint32_t &value,
90 uint8_t motorIndex = 0) noexcept;
91
92 // Variant type for global parameter banks (can be index or any bank enum)
94 std::variant<uint8_t, tmc9660::tmcl::GlobalParamBank0, tmc9660::tmcl::GlobalParamBank2,
95 tmc9660::tmcl::GlobalParamBank3>;
96
103 [[nodiscard]] bool writeGlobalParameter(GlobalParamBankVariant id, uint8_t bank,
104 uint32_t value) noexcept;
105
113 [[nodiscard]] bool readGlobalParameter(GlobalParamBankVariant id, uint8_t bank,
114 uint32_t &value) noexcept;
115
117 bool sendCommand(tmc9660::tmcl::Op opcode, uint16_t type = 0, uint8_t motor = 0,
118 uint32_t value = 0, uint32_t *reply = nullptr) noexcept;
119
120 //***************************************************************************
121 //** SUBSYSTEM: Motor Configuration **//
122 //***************************************************************************
123
125 struct MotorConfig {
139 bool setType(tmc9660::tmcl::MotorType type, uint8_t polePairs = 1) noexcept;
140
148 bool setDirection(tmc9660::tmcl::MotorDirection direction) noexcept;
149
155 bool setPWMFrequency(uint32_t frequencyHz) noexcept;
156
187 bool setCommutationMode(tmc9660::tmcl::CommutationMode mode) noexcept;
188
197 bool setOutputVoltageLimit(uint16_t limit) noexcept;
198
209 bool setMaxTorqueCurrent(uint16_t milliamps) noexcept;
210
222 bool setMaxFluxCurrent(uint16_t milliamps) noexcept;
223
241 bool setPWMSwitchingScheme(tmc9660::tmcl::PwmSwitchingScheme scheme) noexcept;
242
314 bool setIdleMotorPWMBehavior(
316 tmc9660::tmcl::IdleMotorPwmBehavior::PWM_OFF_WHEN_MOTOR_IDLE) noexcept;
317
318 private:
319 friend class TMC9660;
320 explicit MotorConfig(TMC9660 &parent) noexcept : driver(parent) {}
322 } motorConfig{*this};
323
324 //***************************************************************************
325 //** SUBSYSTEM: Current Measurement **//
326 //***************************************************************************
327
335 bool setShuntType(tmc9660::tmcl::AdcShuntType shuntType) noexcept;
336
341 bool getShuntType(tmc9660::tmcl::AdcShuntType &shuntType) noexcept;
342
350 bool readRaw(int16_t &adc0, int16_t &adc1, int16_t &adc2, int16_t &adc3) noexcept;
351
358 bool setCSAGain(tmc9660::tmcl::CsaGain gain012, tmc9660::tmcl::CsaGain gain3) noexcept;
359
366 bool getCSAGain(tmc9660::tmcl::CsaGain &gain012, tmc9660::tmcl::CsaGain &gain3) noexcept;
367
375 tmc9660::tmcl::CsaFilter filter3) noexcept;
376
384 tmc9660::tmcl::CsaFilter &filter3) noexcept;
385
390 bool setScalingFactor(uint16_t scalingFactor) noexcept;
391
396 bool getScalingFactor(uint16_t &scalingFactor) noexcept;
397
408
419
428 bool setScalingFactors(uint16_t scale0, uint16_t scale1, uint16_t scale2,
429 uint16_t scale3) noexcept;
430
439 bool getScalingFactors(uint16_t &scale0, uint16_t &scale1, uint16_t &scale2,
440 uint16_t &scale3) noexcept;
441
452
463 tmc9660::tmcl::AdcInversion &inv3) noexcept;
464
473 bool setOffsets(int16_t offset0, int16_t offset1, int16_t offset2, int16_t offset3) noexcept;
474
483 bool getOffsets(int16_t &offset0, int16_t &offset1, int16_t &offset2,
484 int16_t &offset3) noexcept;
485
494 bool readScaledAndOffset(int16_t &adc0, int16_t &adc1, int16_t &adc2, int16_t &adc3) noexcept;
495
507 bool calibrateOffsets(bool waitForCompletion = false, uint32_t timeoutMs = 1000) noexcept;
508
514 bool getCalibrationStatus(bool &isCalibrated) noexcept;
515
516 private:
517 friend class TMC9660;
518 explicit CurrentSensing(TMC9660 &parent) noexcept : driver(parent) {}
520 } currentSensing{*this};
521
522 //***************************************************************************
523 //** SUBSYSTEM: Gate Driver **//
524 //***************************************************************************
525
528 struct GateDriver {
539 tmc9660::tmcl::PwmOutputPolarity highSide) noexcept;
540
555 bool configureBreakBeforeMakeTiming(uint8_t lowSideUVW, uint8_t highSideUVW, uint8_t lowSideY2,
556 uint8_t highSideY2) noexcept;
557
566 bool enableAdaptiveDriveTime(bool enableUVW, bool enableY2) noexcept;
567
579 bool configureDriveTimes(uint8_t sinkTimeUVW, uint8_t sourceTimeUVW, uint8_t sinkTimeY2,
580 uint8_t sourceTimeY2) noexcept;
581
594 tmc9660::tmcl::GateCurrentSource sourceCurrentUVW,
595 tmc9660::tmcl::GateCurrentSink sinkCurrentY2,
596 tmc9660::tmcl::GateCurrentSource sourceCurrentY2) noexcept;
597
605
621 tmc9660::tmcl::UndervoltageEnable enableBstY2) noexcept;
622
636 tmc9660::tmcl::OvercurrentEnable enableUVWHighSide,
637 tmc9660::tmcl::OvercurrentEnable enableY2LowSide,
638 tmc9660::tmcl::OvercurrentEnable enableY2HighSide) noexcept;
639
653 tmc9660::tmcl::OvercurrentThreshold uvwHighSideThreshold,
654 tmc9660::tmcl::OvercurrentThreshold y2LowSideThreshold,
655 tmc9660::tmcl::OvercurrentThreshold y2HighSideThreshold) noexcept;
656
673 tmc9660::tmcl::OvercurrentTiming uvwHighSideTime,
675 tmc9660::tmcl::OvercurrentTiming y2HighSideTime) noexcept;
676
693 tmc9660::tmcl::OvercurrentTiming uvwHighSideTime,
695 tmc9660::tmcl::OvercurrentTiming y2HighSideTime) noexcept;
696
707 tmc9660::tmcl::VdsUsage y2Enable) noexcept;
708
722 tmc9660::tmcl::VgsShortEnable enableLowSideOff,
723 tmc9660::tmcl::VgsShortEnable enableHighSideOn,
724 tmc9660::tmcl::VgsShortEnable enableHighSideOff) noexcept;
725
739 tmc9660::tmcl::VgsShortEnable enableLowSideOff,
740 tmc9660::tmcl::VgsShortEnable enableHighSideOn,
741 tmc9660::tmcl::VgsShortEnable enableHighSideOff) noexcept;
742
752 tmc9660::tmcl::VgsBlankingTime y2Time) noexcept;
753
763 tmc9660::tmcl::VgsDeglitchTime y2Time) noexcept;
764
771 bool setRetryBehavior(tmc9660::tmcl::GdrvRetryBehaviour retryBehavior) noexcept;
772
780
786 bool setFaultHandlerRetries(uint8_t retries) noexcept;
787
788 private:
789 friend class TMC9660;
790 explicit GateDriver(TMC9660 &parent) noexcept : driver(parent) {}
792 } gateDriver{*this};
793
794 //***************************************************************************
795 //** SUBSYSTEM: Feedback Sensors **//
796 //***************************************************************************
797
801 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
802 // HALL sensors (digital Hall)
803 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
804
821 bool configureHall(
822 tmc9660::tmcl::HallSectorOffset sectorOffset = tmc9660::tmcl::HallSectorOffset::DEG_0,
823 tmc9660::tmcl::Direction inverted = tmc9660::tmcl::Direction::NOT_INVERTED,
824 tmc9660::tmcl::EnableDisable enableExtrapolation = tmc9660::tmcl::EnableDisable::DISABLED,
825 uint8_t filterLength = 0) noexcept;
826
842 bool setHallPositionOffsets(int16_t offset0 = 0, int16_t offset60 = 10922,
843 int16_t offset120 = 21845, int16_t offset180 = -32768,
844 int16_t offset240 = -21846, int16_t offset300 = -10923,
845 int16_t globalOffset = 0) noexcept;
846
851 bool getHallPhiE(int16_t &phiE) noexcept;
852
853 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
854 // ABN encoders (ABN1, ABN2)
855 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
856
869 bool
870 configureABNEncoder(uint32_t countsPerRev,
871 tmc9660::tmcl::Direction inverted = tmc9660::tmcl::Direction::NOT_INVERTED,
872 tmc9660::tmcl::EnableDisable nChannelInverted =
873 tmc9660::tmcl::EnableDisable::DISABLED) noexcept;
874
893 tmc9660::tmcl::AbnInitMethod::FORCED_PHI_E_ZERO_WITH_ACTIVE_SWING,
894 uint16_t initDelay = 1000, int32_t initVelocity = 5, int16_t nChannelOffset = 0) noexcept;
895
902
907 bool getABNPhiE(int16_t &phiE) noexcept;
908
913 bool getABNRawValue(uint32_t &value) noexcept;
914
929 tmc9660::tmcl::AbnNChannelFiltering::FILTERING_OFF,
930 tmc9660::tmcl::EnableDisable clearOnNextNull =
931 tmc9660::tmcl::EnableDisable::DISABLED) noexcept;
932
933 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
934
949 uint32_t countsPerRev,
950 tmc9660::tmcl::Direction inverted = tmc9660::tmcl::Direction::NOT_INVERTED,
951 uint8_t gearRatio = 1) noexcept;
952
953 // ABN-2 (secondary encoder) getters
958 bool getSecondaryABNCountsPerRev(uint32_t &counts) noexcept;
959
965
970 bool getSecondaryABNGearRatio(uint8_t &ratio) noexcept;
971
976 bool setSecondaryABNEncoderEnabled(bool enable) noexcept;
977
982 bool getSecondaryABNEncoderValue(uint32_t &value) noexcept;
983
984 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
985
986 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
987 // SPI encoder timing & frame size
988 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
989
1000 bool configureSPIEncoder(uint8_t cmdSize, uint16_t csSettleTimeNs,
1001 uint8_t csIdleTimeUs) noexcept;
1002
1014 uint32_t positionMask, uint8_t positionShift = 0,
1015 tmc9660::tmcl::Direction invertDirection = tmc9660::tmcl::Direction::NOT_INVERTED) noexcept;
1016
1025 bool setSPIEncoderRequestData(const uint8_t *requestData, uint8_t size) noexcept;
1026
1038 int16_t offset = 0) noexcept;
1039
1050 int8_t shiftFactor = 0) noexcept;
1051
1058 bool uploadSPIEncoderLUTEntry(uint8_t index, int8_t value) noexcept;
1059
1060 // SPI encoder timing & frame size
1063 bool getSPIEncoderCSSettleDelay(uint16_t &timeNs) noexcept;
1064
1067 bool getSPIEncoderCSIdleDelay(uint8_t &timeUs) noexcept;
1068
1071 bool getSPIEncoderMainCmdSize(uint8_t &size) noexcept;
1072
1075 bool getSPIEncoderSecondaryCmdSize(uint8_t &size) noexcept;
1076
1077 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
1078 // SPI encoder data & status
1081 bool getSPIEncoderPositionMask(uint32_t &mask) noexcept;
1082
1085 bool getSPIEncoderPositionShift(uint8_t &shift) noexcept;
1086
1089 bool getSPIEncoderPositionValue(uint32_t &value) noexcept;
1090
1093 bool getSPIEncoderCommutationAngle(int16_t &angle) noexcept;
1094
1095 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
1096 // SPI encoder initialization & offset
1100 int16_t &offset) noexcept;
1101
1105
1106 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
1107 // SPI LUT
1110 bool getSPIEncoderLUTAddress(uint8_t &address) noexcept;
1111
1114 bool getSPIEncoderLUTData(int8_t &data) noexcept;
1115
1118 bool getSPIEncoderLUTShiftFactor(int8_t &shiftFactor) noexcept;
1119
1120 // –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
1121
1122 private:
1123 friend class TMC9660;
1124 explicit FeedbackSense(TMC9660 &parent) noexcept : driver(parent) {}
1126 } feedbackSense{*this};
1127
1128 //***************************************************************************
1129 //** SUBSYSTEM: FOC Control **//
1130 //***************************************************************************
1131
1142 struct FOCControl {
1143 //-------------------------------------------------------------------------
1144 // Torque / Flux control (104–120)
1145 //-------------------------------------------------------------------------
1149 bool stop() noexcept;
1150
1155 bool setTargetTorque(int16_t milliamps) noexcept;
1160 bool getActualTorque(int16_t &milliamps) noexcept;
1161
1166 bool setTargetFlux(int16_t milliamps) noexcept;
1171 bool getActualFlux(int32_t &milliamps) noexcept;
1172
1177 bool setTorqueOffset(int16_t milliamps) noexcept;
1182 bool getTorqueOffset(int16_t &milliamps) noexcept;
1183
1188 bool setFluxOffset(int16_t milliamps) noexcept;
1193 bool getFluxOffset(int16_t &milliamps) noexcept;
1194
1204 bool setCurrentLoopGains(uint16_t p, uint16_t i, bool separate = false, uint16_t fluxP = 0,
1205 uint16_t fluxI = 0) noexcept;
1211
1219
1224 bool getTorquePiError(int32_t &error) noexcept;
1229 bool getFluxPiError(int32_t &error) noexcept;
1234 bool getTorquePiIntegrator(int32_t &integrator) noexcept;
1239 bool getFluxPiIntegrator(int32_t &integrator) noexcept;
1240
1241 //-------------------------------------------------------------------------
1242 // Velocity control (123–139)
1243 //-------------------------------------------------------------------------
1254
1259 bool setTargetVelocity(int32_t velocity) noexcept;
1264 bool getActualVelocity(int32_t &velocity) noexcept;
1265
1270 bool setVelocityOffset(int32_t offset) noexcept;
1275 bool getVelocityOffset(int32_t &offset) noexcept;
1276
1282 bool setVelocityLoopGains(uint16_t p, uint16_t i) noexcept;
1289 tmc9660::tmcl::VelocityPiNorm iNorm) noexcept;
1290
1295 bool getVelocityPiIntegrator(int32_t &integrator) noexcept;
1300 bool getVelocityPiError(int32_t &error) noexcept;
1301
1306 bool setVelocityScalingFactor(uint16_t factor) noexcept;
1311 bool getVelocityScalingFactor(uint16_t &factor) noexcept;
1312
1318 bool setStopOnVelocityDeviation(uint32_t maxError, bool softStop = true) noexcept;
1324 bool getStopOnVelocityDeviation(uint32_t &maxError, bool &softStop) noexcept;
1325
1330 bool setVelocityLoopDownsampling(uint8_t divider) noexcept;
1335 bool getVelocityLoopDownsampling(uint8_t &divider) noexcept;
1336
1341 bool setVelocityReachedThreshold(uint32_t threshold) noexcept;
1346 bool getVelocityReachedThreshold(uint32_t &threshold) noexcept;
1347
1352 bool setVelocityMeterSwitchThreshold(uint32_t threshold) noexcept;
1357 bool getVelocityMeterSwitchThreshold(uint32_t &threshold) noexcept;
1358
1363 bool setVelocityMeterSwitchHysteresis(uint16_t hysteresis) noexcept;
1368 bool getVelocityMeterSwitchHysteresis(uint16_t &hysteresis) noexcept;
1369
1375
1376 //-------------------------------------------------------------------------
1377 // Position control (142–157)
1378 //-------------------------------------------------------------------------
1389
1394 bool setTargetPosition(int32_t position) noexcept;
1399 bool getActualPosition(int32_t &position) noexcept;
1400
1405 bool setPositionScalingFactor(uint16_t factor) noexcept;
1410 bool getPositionScalingFactor(uint16_t &factor) noexcept;
1411
1417 bool setPositionLoopGains(uint16_t p, uint16_t i) noexcept;
1424 tmc9660::tmcl::VelocityPiNorm iNorm) noexcept;
1425
1430 bool getPositionPiIntegrator(int32_t &integrator) noexcept;
1435 bool getPositionPiError(int32_t &error) noexcept;
1436
1442 bool setStopOnPositionDeviation(uint32_t maxError, bool softStop = true) noexcept;
1448 bool getStopOnPositionDeviation(uint32_t &maxError, bool &softStop) noexcept;
1449
1454 bool setPositionLoopDownsampling(uint8_t divider) noexcept;
1459 bool getPositionLoopDownsampling(uint8_t &divider) noexcept;
1460
1465 bool setPositionLimitLow(int32_t limit) noexcept;
1470 bool getPositionLimitLow(int32_t &limit) noexcept;
1471
1476 bool setPositionLimitHigh(int32_t limit) noexcept;
1481 bool getPositionLimitHigh(int32_t &limit) noexcept;
1482
1487 bool setPositionReachedThreshold(uint32_t threshold) noexcept;
1492 bool getPositionReachedThreshold(uint32_t &threshold) noexcept;
1493
1494 //-------------------------------------------------------------------------
1495 // Open‐loop support (45–47)
1496 //-------------------------------------------------------------------------
1501 bool getOpenloopAngle(int16_t &angle) noexcept;
1502
1507 bool setOpenloopCurrent(uint16_t milliamps) noexcept;
1512 bool getOpenloopCurrent(uint16_t &milliamps) noexcept;
1513
1518 bool setOpenloopVoltage(uint16_t voltage) noexcept;
1523 bool getOpenloopVoltage(uint16_t &voltage) noexcept;
1524
1525 //-------------------------------------------------------------------------
1526 // Ref switch & stop-event (161–170)
1527 //-------------------------------------------------------------------------
1532 bool setReferenceSwitchEnable(tmc9660::tmcl::ReferenceSwitchEnable enable) noexcept;
1537 bool getReferenceSwitchEnable(tmc9660::tmcl::ReferenceSwitchEnable &enable) noexcept;
1538
1543 bool setReferenceSwitchPolaritySwap(tmc9660::tmcl::ReferenceSwitchPolaritySwap config) noexcept;
1548 bool
1549 getReferenceSwitchPolaritySwap(tmc9660::tmcl::ReferenceSwitchPolaritySwap &config) noexcept;
1550
1555 bool
1556 setReferenceSwitchLatchSettings(tmc9660::tmcl::ReferenceSwitchLatchSettings setting) noexcept;
1561 bool
1562 getReferenceSwitchLatchSettings(tmc9660::tmcl::ReferenceSwitchLatchSettings &setting) noexcept;
1563
1568 bool setEventStopSettings(tmc9660::tmcl::EventStopSettings settings) noexcept;
1573 bool getEventStopSettings(tmc9660::tmcl::EventStopSettings &settings) noexcept;
1574
1579 bool setReferenceSwitchSearchMode(tmc9660::tmcl::ReferenceSwitchSearchMode mode) noexcept;
1584 bool getReferenceSwitchSearchMode(tmc9660::tmcl::ReferenceSwitchSearchMode &mode) noexcept;
1585
1590 bool setReferenceSwitchSearchSpeed(int32_t speed) noexcept;
1595 bool getReferenceSwitchSearchSpeed(int32_t &speed) noexcept;
1596
1601 bool setReferenceSwitchSpeed(int32_t speed) noexcept;
1606 bool getReferenceSwitchSpeed(int32_t &speed) noexcept;
1607
1612 bool getRightLimitSwitchPosition(int32_t &position) noexcept;
1613
1618 bool getHomeSwitchPosition(int32_t &position) noexcept;
1619
1624 bool getLastReferencePosition(int32_t &position) noexcept;
1625
1626 //-------------------------------------------------------------------------
1627 // Additional FOC telemetry and tuning parameters (305–334)
1628 //-------------------------------------------------------------------------
1629
1632 // Raw inputs for ABN, hall, reference switches, driver enabled,
1633 // hall filtered and ABN2 or Step/Dir (Parameter 304: MCC_INPUTS_RAW)
1634 bool getMccInputsRaw(uint16_t &inputs) noexcept;
1636
1639 bool getFocVoltageUx(int16_t &voltage) noexcept;
1640 bool getFocVoltageWy(int16_t &voltage) noexcept;
1641 bool getFocVoltageV(int16_t &voltage) noexcept;
1642 bool getFocVoltageUq(int16_t &voltage) noexcept;
1644
1647 bool setFieldWeakeningI(uint16_t milliamps) noexcept;
1648 bool getFieldWeakeningI(uint16_t &milliamps) noexcept;
1649 bool setFieldWeakeningVoltageThreshold(uint16_t voltage) noexcept;
1650 bool getFieldWeakeningVoltageThreshold(uint16_t &voltage) noexcept;
1652
1655 bool getFocCurrentUx(int16_t &milliamps) noexcept;
1656 bool getFocCurrentV(int16_t &milliamps) noexcept;
1657 bool getFocCurrentWy(int16_t &milliamps) noexcept;
1658 bool getFocCurrentIq(int16_t &milliamps) noexcept;
1660
1663 bool setTargetTorqueBiquadFilterEnable(bool enable) noexcept;
1664 bool getTargetTorqueBiquadFilterEnable(bool &enable) noexcept;
1665 bool setTargetTorqueBiquadFilterACoeff1(int32_t coeff) noexcept;
1666 bool getTargetTorqueBiquadFilterACoeff1(int32_t &coeff) noexcept;
1667 bool setTargetTorqueBiquadFilterACoeff2(int32_t coeff) noexcept;
1668 bool getTargetTorqueBiquadFilterACoeff2(int32_t &coeff) noexcept;
1669 bool setTargetTorqueBiquadFilterBCoeff0(int32_t coeff) noexcept;
1670 bool getTargetTorqueBiquadFilterBCoeff0(int32_t &coeff) noexcept;
1671 bool setTargetTorqueBiquadFilterBCoeff1(int32_t coeff) noexcept;
1672 bool getTargetTorqueBiquadFilterBCoeff1(int32_t &coeff) noexcept;
1673 bool setTargetTorqueBiquadFilterBCoeff2(int32_t coeff) noexcept;
1674 bool getTargetTorqueBiquadFilterBCoeff2(int32_t &coeff) noexcept;
1676
1679 bool setActualVelocityBiquadFilterEnable(bool enable) noexcept;
1680 bool getActualVelocityBiquadFilterEnable(bool &enable) noexcept;
1681 bool setActualVelocityBiquadFilterACoeff1(int32_t coeff) noexcept;
1682 bool getActualVelocityBiquadFilterACoeff1(int32_t &coeff) noexcept;
1683 bool setActualVelocityBiquadFilterACoeff2(int32_t coeff) noexcept;
1684 bool getActualVelocityBiquadFilterACoeff2(int32_t &coeff) noexcept;
1685 bool setActualVelocityBiquadFilterBCoeff0(int32_t coeff) noexcept;
1686 bool getActualVelocityBiquadFilterBCoeff0(int32_t &coeff) noexcept;
1687 bool setActualVelocityBiquadFilterBCoeff1(int32_t coeff) noexcept;
1688 bool getActualVelocityBiquadFilterBCoeff1(int32_t &coeff) noexcept;
1689 bool setActualVelocityBiquadFilterBCoeff2(int32_t coeff) noexcept;
1690 bool getActualVelocityBiquadFilterBCoeff2(int32_t &coeff) noexcept;
1692
1695 bool getTorqueFluxCombinedTargetValues(uint32_t &value) noexcept;
1696 bool getTorqueFluxCombinedActualValues(uint32_t &value) noexcept;
1697 bool getVoltageDqCombinedActualValues(uint32_t &value) noexcept;
1698 bool getIntegratedActualTorqueValue(uint32_t &value) noexcept;
1699 bool getIntegratedActualVelocityValue(uint32_t &value) noexcept;
1701
1702 private:
1703 friend class TMC9660;
1704 explicit FOCControl(TMC9660 &parent) noexcept : driver(parent) {}
1706 } focControl{*this};
1707
1708 //***************************************************************************
1709 //** SUBSYSTEM: Motion Ramp **//
1710 //***************************************************************************
1711
1728 struct Ramp {
1732 bool enable(bool on) noexcept;
1733
1739 bool setAcceleration(uint32_t a1, uint32_t a2, uint32_t aMax) noexcept;
1740
1746 bool setDeceleration(uint32_t d1, uint32_t d2, uint32_t dMax) noexcept;
1747
1755 bool setVelocities(uint32_t vStart, uint32_t vStop, uint32_t v1, uint32_t v2,
1756 uint32_t vMax) noexcept;
1757
1762 bool setTiming(uint16_t tVmaxCycles, uint16_t tZeroWaitCycles) noexcept;
1763
1776 bool enableFeedForward(bool enableVelFF, bool enableAccelFF, uint16_t accelFFGain,
1777 tmc9660::tmcl::AccelerationFFShift accelFFShift) noexcept;
1778
1782 bool setDirectVelocityMode(bool enable) noexcept;
1783
1789 bool getRampVelocity(int32_t &velocity) noexcept;
1790
1796 bool getRampPosition(int32_t &position) noexcept;
1797
1798 private:
1799 friend class TMC9660;
1800 explicit Ramp(TMC9660 &parent) noexcept : driver(parent) {}
1802 } ramp{*this};
1803
1804 //***************************************************************************
1805 //** SUBSYSTEM: Step/Dir Input Extrapolation **//
1806 //***************************************************************************
1807
1819 struct StepDir {
1820
1830
1839 bool enableInterface(bool on) noexcept;
1840
1849 bool enableExtrapolation(bool enable) noexcept;
1850
1858 bool setSignalTimeout(uint16_t timeout_ms) noexcept;
1859
1867 bool setMaxExtrapolationVelocity(uint32_t eRPM) noexcept;
1868
1877 bool enableVelocityFeedForward(bool enableVelFF) noexcept;
1878
1879 private:
1880 friend class TMC9660;
1881 explicit StepDir(TMC9660 &parent) noexcept : driver(parent) {}
1883 } stepDir{*this};
1884
1885 //***********************************************************************
1886 //** SUBSYSTEM: Reference Search **//
1887 //***********************************************************************
1888
1892 bool start() noexcept;
1894 bool stop() noexcept;
1896 bool getStatus(tmc9660::tmcl::ReferenceSearchStatus &status) noexcept;
1897
1898 private:
1899 friend class TMC9660;
1900 explicit ReferenceSearch(TMC9660 &parent) noexcept : driver(parent) {}
1902 } referenceSearch{*this};
1903
1904 //***************************************************************************
1905 //** SUBSYSTEM: Brake Chopper **//
1906 //***************************************************************************
1907
1911 struct Brake {
1916 bool enableChopper(bool enable) noexcept;
1917
1922 bool setVoltageLimit(float voltage) noexcept;
1923
1928 bool setHysteresis(float voltage) noexcept;
1929
1933 bool release() noexcept;
1934
1938 bool engage() noexcept;
1939
1944 bool setReleasingDutyCycle(uint8_t percent) noexcept;
1945
1950 bool setHoldingDutyCycle(uint8_t percent) noexcept;
1951
1956 bool setReleasingDuration(uint16_t milliseconds) noexcept;
1957
1962 bool invertOutput(bool invert) noexcept;
1963
1964 private:
1965 friend class TMC9660;
1966 explicit Brake(TMC9660 &parent) noexcept : driver(parent) {}
1968 } brake{*this};
1969
1970 //***************************************************************************
1971 //** SUBSYSTEM: I²t Overload Protection **//
1972 //***************************************************************************
1973
1984 struct IIT {
1996 bool configure(uint16_t timeConstant1_ms, float continuousCurrent1_A, uint16_t timeConstant2_ms,
1997 float continuousCurrent2_A) noexcept;
1998
2002 bool resetIntegralState() noexcept;
2003
2007 bool setThermalWindingTimeConstant1(uint16_t ms) noexcept;
2010 bool getThermalWindingTimeConstant1(uint16_t &ms) noexcept;
2011
2015 bool setLimit1(uint32_t limit) noexcept;
2018 bool getLimit1(uint32_t &limit) noexcept;
2019
2023 bool setThermalWindingTimeConstant2(uint16_t ms) noexcept;
2026 bool getThermalWindingTimeConstant2(uint16_t &ms) noexcept;
2027
2031 bool setLimit2(uint32_t limit) noexcept;
2034 bool getLimit2(uint32_t &limit) noexcept;
2035
2039 bool getActualTotalMotorCurrent(uint32_t &current, uint8_t motorIndex = 0) noexcept;
2040
2044 bool getSum1(uint32_t &sum) noexcept;
2045
2049 bool getSum2(uint32_t &sum) noexcept;
2050
2051 private:
2052 friend class TMC9660;
2053 explicit IIT(TMC9660 &parent) noexcept : driver(parent) {}
2055 } iit{*this};
2056
2057 //===========================================================================
2058 //== SUBSYSTEM: Telemetry & Status ==//
2059 //===========================================================================
2060
2064 struct Telemetry {
2069 bool getGeneralStatusFlags(uint32_t &flags) noexcept;
2070
2075 float getSupplyVoltage() noexcept;
2076
2082 float getChipTemperature() noexcept;
2083
2087 int16_t getMotorCurrent() noexcept;
2088
2093 int32_t getActualVelocity() noexcept;
2094
2099 int32_t getActualPosition() noexcept;
2100
2105 bool getGeneralErrorFlags(uint32_t &flags) noexcept;
2106
2111 bool getGateDriverErrorFlags(uint32_t &flags) noexcept;
2112
2117 bool clearGeneralErrorFlags(uint32_t mask) noexcept;
2118
2123 bool clearGateDriverErrorFlags(uint32_t mask) noexcept;
2124
2129 bool getADCStatusFlags(uint32_t &flags) noexcept;
2130
2135 bool clearADCStatusFlags(uint32_t mask) noexcept;
2136
2140 uint16_t getExternalTemperature() noexcept;
2141
2142 private:
2143 friend class TMC9660;
2144 explicit Telemetry(TMC9660 &parent) noexcept;
2146 } telemetry{*this};
2147
2148 //***************************************************************************
2149 //** SUBSYSTEM: Stop / Event **//
2150 //***************************************************************************
2151
2154 struct StopEvents {
2168 uint32_t maxVelError, uint32_t maxPosError,
2169 bool softStop = true) noexcept;
2171
2188 bool
2189 configureReferenceSwitches(uint8_t mask, bool invertL, bool invertR, bool invertH,
2190 bool swapLR) noexcept;
2192
2200 bool getAndClearLatchedPosition(int32_t &pos) noexcept;
2202
2203 private:
2204 friend class TMC9660;
2205 explicit StopEvents(TMC9660 &parent) noexcept : driver(parent) {}
2207 } stopEvents{*this};
2208
2209 //===========================================================================
2210 //== SUBSYSTEM: Protection ==//
2211 //===========================================================================
2212
2215 struct Protection {
2222 bool configureVoltage(uint16_t overVoltThreshold, uint16_t underVoltThreshold) noexcept;
2223
2234 bool configureTemperature(float warningDegC, float shutdownDegC) noexcept;
2235
2244 bool setOvercurrentEnabled(bool enabled) noexcept;
2245
2255 bool configureI2t(uint16_t timeConstant1_ms, float continuousCurrent1_A,
2256 uint16_t timeConstant2_ms, float continuousCurrent2_A) noexcept;
2257
2261 bool resetI2tState() noexcept;
2262
2263 private:
2264 friend class TMC9660;
2265 explicit Protection(TMC9660 &parent) noexcept : driver(parent) {}
2267 } protection{*this};
2268
2269 //===========================================================================
2270 //== SUBSYSTEM: Script ==//
2271 //===========================================================================
2272
2275 struct Script {
2285 bool upload(const std::vector<uint32_t> &scriptData) noexcept;
2286
2292 bool start(uint16_t address = 0) noexcept;
2293
2297 bool stop() noexcept;
2298
2304 bool step() noexcept;
2305
2311 bool reset() noexcept;
2312
2317 bool getStatus(uint32_t &status) noexcept;
2318
2324 bool readMemory(uint16_t address, uint32_t &value) noexcept;
2325
2330 bool addBreakpoint(uint16_t address) noexcept;
2331
2336 bool removeBreakpoint(uint16_t address) noexcept;
2337
2341 bool clearBreakpoints() noexcept;
2342
2347 bool getMaxBreakpointCount(uint32_t &count) noexcept;
2348
2349 private:
2350 friend class TMC9660;
2351 explicit Script(TMC9660 &parent) noexcept : driver(parent) {}
2353 } script{*this};
2354
2355 //***************************************************************************
2356 //** SUBSYSTEM: RamDebug **//
2357 //***************************************************************************
2360 struct RamDebug {
2368 bool init(uint32_t sampleCount) noexcept;
2369
2373 bool startCapture() noexcept;
2374
2380 bool readData(uint32_t index, uint32_t &data) noexcept;
2381
2387 bool getStatus(bool &isRunning) noexcept;
2388
2389 private:
2390 friend class TMC9660;
2391 explicit RamDebug(TMC9660 &parent) noexcept : driver(parent) {}
2393 } ramDebug{*this};
2394
2395 //===========================================================================
2396 //** SUBSYSTEM: FLASH STORAGE ==//
2397 //===========================================================================
2398
2410 struct NvmStorage {
2417 bool storeToFlash() noexcept;
2418
2425 bool recallFromFlash() noexcept;
2426
2434 bool eraseFlashBank(uint8_t n) noexcept;
2435
2436 private:
2437 friend class TMC9660;
2438 explicit NvmStorage(TMC9660 &parent) noexcept : driver(parent) {}
2440 } nvmStorage{*this};
2441
2442 //===========================================================================
2443 //== SUBSYSTEM: Heartbeat (Watchdog) ==//
2444 //===========================================================================
2445
2455 struct Heartbeat {
2466 bool configure(tmc9660::tmcl::HeartbeatMonitoringConfig mode, uint32_t timeout_ms) noexcept;
2467
2468 private:
2469 friend class TMC9660;
2470 explicit Heartbeat(TMC9660 &parent) noexcept : driver(parent) {}
2472 } heartbeat{*this};
2473
2474 //***************************************************************************
2475 //** SUBSYSTEM: Global Parameter Access **//
2476 //***************************************************************************
2484 struct Globals {
2486 bool writeBank0(tmc9660::tmcl::GlobalParamBank0 param, uint32_t value) noexcept;
2487
2489 bool readBank0(tmc9660::tmcl::GlobalParamBank0 param, uint32_t &value) noexcept;
2490
2492 bool writeBank2(tmc9660::tmcl::GlobalParamBank2 param, int32_t value) noexcept;
2493
2495 bool readBank2(tmc9660::tmcl::GlobalParamBank2 param, int32_t &value) noexcept;
2496
2498 bool writeBank3(tmc9660::tmcl::GlobalParamBank3 param, uint32_t value) noexcept;
2499
2501 bool readBank3(tmc9660::tmcl::GlobalParamBank3 param, uint32_t &value) noexcept;
2502
2503 // High level helpers --------------------------------------------------
2505 bool setSerialAddress(uint8_t address) noexcept;
2506
2508 bool getSerialAddress(uint8_t &address) noexcept;
2509
2511 bool setHostAddress(uint8_t address) noexcept;
2512
2514 bool getHostAddress(uint8_t &address) noexcept;
2515
2518 uint32_t timeout_ms) noexcept;
2519
2522 uint32_t &timeout_ms) noexcept;
2523
2525 bool setIODirectionMask(uint32_t mask) noexcept;
2526
2528 bool getIODirectionMask(uint32_t &mask) noexcept;
2529
2531 bool setPullEnableMask(uint32_t mask) noexcept;
2532
2534 bool getPullEnableMask(uint32_t &mask) noexcept;
2535
2537 bool setPullDirectionMask(uint32_t mask) noexcept;
2538
2540 bool getPullDirectionMask(uint32_t &mask) noexcept;
2541
2543 bool setAutoStart(bool enable) noexcept;
2544
2546 bool getAutoStart(bool &enable) noexcept;
2547
2549 bool setClearUserVariables(bool clear) noexcept;
2550
2552 bool getClearUserVariables(bool &clear) noexcept;
2553
2555 bool setUserVariable(uint8_t index, int32_t value) noexcept;
2556
2558 bool getUserVariable(uint8_t index, int32_t &value) noexcept;
2559
2561 bool setTimerPeriod(uint8_t timer, uint32_t period_ms) noexcept;
2562
2564 bool getTimerPeriod(uint8_t timer, uint32_t &period_ms) noexcept;
2565
2567 bool setInputTrigger(uint8_t index, tmc9660::tmcl::TriggerTransition transition) noexcept;
2568
2570 bool getInputTrigger(uint8_t index, tmc9660::tmcl::TriggerTransition &transition) noexcept;
2571
2572 private:
2573 friend class TMC9660;
2574 explicit Globals(TMC9660 &parent) noexcept : driver(parent) {}
2576 } globals{*this};
2577
2578 //***************************************************************************
2579 //** SUBSYSTEM: General-purpose GPIO (Digital/Analog I/O) **//
2580 //***************************************************************************
2581
2591 struct GPIO {
2600 bool setMode(uint8_t pin, bool output, bool pullEnable = false, bool pullUp = true) noexcept;
2601
2607 bool writePin(uint8_t pin, bool value) noexcept;
2608
2614 bool readDigital(uint8_t pin, bool &value) noexcept;
2615
2623 bool readAnalog(uint8_t pin, uint16_t &value) noexcept;
2624
2625 private:
2626 friend class TMC9660;
2627 explicit GPIO(TMC9660 &parent) noexcept : driver(parent) {}
2629 } gpio{*this};
2630
2631 //***************************************************************************
2632 //** SUBSYSTEM: Power Management **//
2633 //***************************************************************************
2634
2644 struct Power {
2651 bool enableWakePin(bool enable) noexcept;
2652
2659 bool enterPowerDown(tmc9660::tmcl::PowerDownTimeout period) noexcept;
2660
2661 private:
2662 friend class TMC9660;
2663 explicit Power(TMC9660 &parent) noexcept : driver(parent) {}
2665 } power{*this};
2666
2667 //==================================================
2668 // PRIVATE MEMBERS
2669 //==================================================
2670private:
2673 uint8_t address_;
2677
2678#ifdef TMC_API_EXTERNAL_CRC_TABLE
2679 extern const uint8_t tmcCRCTable_Poly7Reflected[256];
2680#else
2681 const uint8_t tmcCRCTable_Poly7Reflected[256] = {
2682 0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75, 0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA,
2683 0x7B, 0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69, 0x12, 0x83, 0xF1, 0x60, 0x15, 0x84,
2684 0xF6, 0x67, 0x38, 0xA9, 0xDB, 0x4A, 0x3F, 0xAE, 0xDC, 0x4D, 0x36, 0xA7, 0xD5, 0x44, 0x31,
2685 0xA0, 0xD2, 0x43, 0x24, 0xB5, 0xC7, 0x56, 0x23, 0xB2, 0xC0, 0x51, 0x2A, 0xBB, 0xC9, 0x58,
2686 0x2D, 0xBC, 0xCE, 0x5F, 0x70, 0xE1, 0x93, 0x02, 0x77, 0xE6, 0x94, 0x05, 0x7E, 0xEF, 0x9D,
2687 0x0C, 0x79, 0xE8, 0x9A, 0x0B, 0x6C, 0xFD, 0x8F, 0x1E, 0x6B, 0xFA, 0x88, 0x19, 0x62, 0xF3,
2688 0x81, 0x10, 0x65, 0xF4, 0x86, 0x17, 0x48, 0xD9, 0xAB, 0x3A, 0x4F, 0xDE, 0xAC, 0x3D, 0x46,
2689 0xD7, 0xA5, 0x34, 0x41, 0xD0, 0xA2, 0x33, 0x54, 0xC5, 0xB7, 0x26, 0x53, 0xC2, 0xB0, 0x21,
2690 0x5A, 0xCB, 0xB9, 0x28, 0x5D, 0xCC, 0xBE, 0x2F, 0xE0, 0x71, 0x03, 0x92, 0xE7, 0x76, 0x04,
2691 0x95, 0xEE, 0x7F, 0x0D, 0x9C, 0xE9, 0x78, 0x0A, 0x9B, 0xFC, 0x6D, 0x1F, 0x8E, 0xFB, 0x6A,
2692 0x18, 0x89, 0xF2, 0x63, 0x11, 0x80, 0xF5, 0x64, 0x16, 0x87, 0xD8, 0x49, 0x3B, 0xAA, 0xDF,
2693 0x4E, 0x3C, 0xAD, 0xD6, 0x47, 0x35, 0xA4, 0xD1, 0x40, 0x32, 0xA3, 0xC4, 0x55, 0x27, 0xB6,
2694 0xC3, 0x52, 0x20, 0xB1, 0xCA, 0x5B, 0x29, 0xB8, 0xCD, 0x5C, 0x2E, 0xBF, 0x90, 0x01, 0x73,
2695 0xE2, 0x97, 0x06, 0x74, 0xE5, 0x9E, 0x0F, 0x7D, 0xEC, 0x99, 0x08, 0x7A, 0xEB, 0x8C, 0x1D,
2696 0x6F, 0xFE, 0x8B, 0x1A, 0x68, 0xF9, 0x82, 0x13, 0x61, 0xF0, 0x85, 0x14, 0x66, 0xF7, 0xA8,
2697 0x39, 0x4B, 0xDA, 0xAF, 0x3E, 0x4C, 0xDD, 0xA6, 0x37, 0x45, 0xD4, 0xA1, 0x30, 0x42, 0xD3,
2698 0xB4, 0x25, 0x57, 0xC6, 0xB3, 0x22, 0x50, 0xC1, 0xBA, 0x2B, 0x59, 0xC8, 0xBD, 0x2C, 0x5E,
2699 0xCF,
2700 };
2701#endif
2702};
Helper for configuring the TMC9660 bootloader registers.
Communication interfaces for TMC9660 Parameter Mode devices using TMCL protocol over SPI and UART.
SPI status codes as per TMC9660 Parameter Mode.
Definition TMC9660CommInterface.hpp:224
const tmc9660::BootloaderConfig * bootCfg_
Definition TMC9660.hpp:2676
BootloaderInitResult
Bootloader initialization result codes.
Definition TMC9660.hpp:54
uint8_t address_
Definition TMC9660.hpp:2673
TMC9660CommInterface & comm_
Definition TMC9660.hpp:2671
std::variant< uint8_t, tmc9660::tmcl::GlobalParamBank0, tmc9660::tmcl::GlobalParamBank2, tmc9660::tmcl::GlobalParamBank3 > GlobalParamBankVariant
Definition TMC9660.hpp:95
tmc9660::TMC9660Bootloader bootloader_
Bootloader helper.
Definition TMC9660.hpp:2675
const uint8_t tmcCRCTable_Poly7Reflected[256]
Definition TMC9660.hpp:2681
TMC9660CommInterface & comm() noexcept
Get the communication interface used by this TMC9660 instance.
Definition TMC9660.hpp:43
Convenience wrapper around the bootloader TMCL commands.
Definition TMC9660Bootloader.hpp:210
Definition tmc9660_adc.hpp:12
UndervoltageEnable
Definition tmc9660_param_mode_tmcl.hpp:1274
AbnInitState
Definition tmc9660_param_mode_tmcl.hpp:2309
GateCurrentSource
Definition tmc9660_param_mode_tmcl.hpp:838
GateCurrentSink
Definition tmc9660_param_mode_tmcl.hpp:778
OvercurrentTiming
Definition tmc9660_param_mode_tmcl.hpp:1096
ReferenceSearchStatus
Definition tmc9660_param_mode_tmcl.hpp:4359
AdcMapping
Definition tmc9660_param_mode_tmcl.hpp:2009
OvercurrentThreshold
Definition tmc9660_param_mode_tmcl.hpp:1052
VgsShortEnable
Definition tmc9660_param_mode_tmcl.hpp:1357
PowerDownTimeout
Definition tmc9660_param_mode_tmcl.hpp:4601
CommutationMode
Definition tmc9660_param_mode_tmcl.hpp:1726
StepDirStepDividerShift
Definition tmc9660_param_mode_tmcl.hpp:4483
VelocityPiNorm
Definition tmc9660_param_mode_tmcl.hpp:2907
MotorDirection
Definition tmc9660_param_mode_tmcl.hpp:1573
VgsBlankingTime
Definition tmc9660_param_mode_tmcl.hpp:1393
DriveFaultBehaviour
Definition tmc9660_param_mode_tmcl.hpp:3735
Direction
Definition tmc9660_param_mode_tmcl.hpp:2519
BootstrapCurrentLimit
Definition tmc9660_param_mode_tmcl.hpp:882
VdsUsage
Definition tmc9660_param_mode_tmcl.hpp:1128
GdrvRetryBehaviour
Definition tmc9660_param_mode_tmcl.hpp:3696
CsaFilter
Definition tmc9660_param_mode_tmcl.hpp:1973
PwmSwitchingScheme
Definition tmc9660_param_mode_tmcl.hpp:1607
EnableDisable
Definition tmc9660_param_mode_tmcl.hpp:2487
VelocityMeterMode
Definition tmc9660_param_mode_tmcl.hpp:2944
AdcShuntType
Definition tmc9660_param_mode_tmcl.hpp:1899
CurrentPiNormalization
Definition tmc9660_param_mode_tmcl.hpp:2693
PwmOutputPolarity
Definition tmc9660_param_mode_tmcl.hpp:718
SpiInitMethod
Definition tmc9660_param_mode_tmcl.hpp:2455
AdcInversion
Definition tmc9660_param_mode_tmcl.hpp:2041
GlobalParamBank3
Definition tmc9660_param_mode_tmcl.hpp:538
GlobalParamBank0
Definition tmc9660_param_mode_tmcl.hpp:449
TorqueFluxPiSeparation
Definition tmc9660_param_mode_tmcl.hpp:2658
OvercurrentEnable
Definition tmc9660_param_mode_tmcl.hpp:992
CsaGain
Definition tmc9660_param_mode_tmcl.hpp:1937
VelocitySensorSelection
Definition tmc9660_param_mode_tmcl.hpp:2868
MotorType
Definition tmc9660_param_mode_tmcl.hpp:1541
VgsDeglitchTime
Definition tmc9660_param_mode_tmcl.hpp:1437
HeartbeatMonitoringConfig
Definition tmc9660_param_mode_tmcl.hpp:3998
AbnNChannelFiltering
Definition tmc9660_param_mode_tmcl.hpp:2347
HallSectorOffset
Definition tmc9660_param_mode_tmcl.hpp:2387
PositionSensorSelection
Definition tmc9660_param_mode_tmcl.hpp:3116
UndervoltageLevel
Definition tmc9660_param_mode_tmcl.hpp:1242
TriggerTransition
Definition tmc9660_param_mode_tmcl.hpp:581
AbnInitMethod
Definition tmc9660_param_mode_tmcl.hpp:2273
GlobalParamBank2
Definition tmc9660_param_mode_tmcl.hpp:489
AccelerationFFShift
Definition tmc9660_param_mode_tmcl.hpp:2989
IdleMotorPwmBehavior
Definition tmc9660_param_mode_tmcl.hpp:1761
Definition tmc9660_param_mode_tmcl.hpp:14
Subsystem controlling the brake chopper and mechanical brake features.
Definition TMC9660.hpp:1911
bool release() noexcept
Trigger a release of the mechanical brake.
Definition TMC9660.cpp:1997
TMC9660 & driver
Definition TMC9660.hpp:1967
bool setReleasingDutyCycle(uint8_t percent) noexcept
Set the PWM duty cycle for releasing the brake.
Definition TMC9660.cpp:2005
bool setHysteresis(float voltage) noexcept
Set the hysteresis for the brake chopper threshold.
Definition TMC9660.cpp:1992
bool setHoldingDutyCycle(uint8_t percent) noexcept
Set the PWM duty cycle for holding the brake released.
Definition TMC9660.cpp:2011
bool engage() noexcept
Engage (lock) the mechanical brake.
Definition TMC9660.cpp:2001
Brake(TMC9660 &parent) noexcept
Definition TMC9660.hpp:1966
bool enableChopper(bool enable) noexcept
Enable or disable the brake chopper functionality.
Definition TMC9660.cpp:1983
bool setReleasingDuration(uint16_t milliseconds) noexcept
Set the duration of the brake release initial phase.
Definition TMC9660.cpp:2017
bool invertOutput(bool invert) noexcept
Invert or normalize the brake output signal polarity.
Definition TMC9660.cpp:2021
bool setVoltageLimit(float voltage) noexcept
Set the overvoltage threshold for the brake chopper.
Definition TMC9660.cpp:1987
Subsystem for configuring ADC-based current measurement.
Definition TMC9660.hpp:330
bool getShuntType(tmc9660::tmcl::AdcShuntType &shuntType) noexcept
Get the ADC shunt type (Parameter 12: ADC_SHUNT_TYPE).
Definition TMC9660.cpp:130
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,...
Definition TMC9660.cpp:178
TMC9660 & driver
Definition TMC9660.hpp:519
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).
Definition TMC9660.cpp:228
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).
Definition TMC9660.cpp:156
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).
Definition TMC9660.cpp:326
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,...
Definition TMC9660.cpp:188
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).
Definition TMC9660.cpp:258
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).
Definition TMC9660.cpp:138
bool setShuntType(tmc9660::tmcl::AdcShuntType shuntType) noexcept
Set the ADC shunt type (Parameter 12: ADC_SHUNT_TYPE).
Definition TMC9660.cpp:125
CurrentSensing(TMC9660 &parent) noexcept
Definition TMC9660.hpp:518
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).
Definition TMC9660.cpp:292
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).
Definition TMC9660.cpp:166
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).
Definition TMC9660.cpp:344
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).
Definition TMC9660.cpp:212
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).
Definition TMC9660.cpp:276
bool setScalingFactor(uint16_t scalingFactor) noexcept
Set current scaling factor (Parameter 21: CURRENT_SCALING_FACTOR).
Definition TMC9660.cpp:200
bool calibrateOffsets(bool waitForCompletion=false, uint32_t timeoutMs=1000) noexcept
Calibrate the ADC offsets for current measurement.
Definition TMC9660.cpp:362
bool getScalingFactor(uint16_t &scalingFactor) noexcept
Get current scaling factor (Parameter 21: CURRENT_SCALING_FACTOR).
Definition TMC9660.cpp:204
bool getCalibrationStatus(bool &isCalibrated) noexcept
Check if ADC offset calibration has been completed.
Definition TMC9660.cpp:387
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).
Definition TMC9660.cpp:312
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).
Definition TMC9660.cpp:248
Subsystem for FOC control: torque/flux, velocity, position loops, open‐loop support,...
Definition TMC9660.hpp:1142
bool setPositionReachedThreshold(uint32_t threshold) noexcept
Set position reached threshold.
Definition TMC9660.cpp:1391
bool getVelocityMeterSwitchHysteresis(uint16_t &hysteresis) noexcept
Read velocity meter hysteresis.
Definition TMC9660.cpp:1239
bool setTargetFlux(int16_t milliamps) noexcept
Set desired flux current.
Definition TMC9660.cpp:996
bool getActualFlux(int32_t &milliamps) noexcept
Read actual flux current.
Definition TMC9660.cpp:1001
bool getReferenceSwitchPolaritySwap(tmc9660::tmcl::ReferenceSwitchPolaritySwap &config) noexcept
Read switch polarity/swap config.
Definition TMC9660.cpp:1464
bool getReferenceSwitchEnable(tmc9660::tmcl::ReferenceSwitchEnable &enable) noexcept
Read reference switch enable mask.
Definition TMC9660.cpp:1449
bool getTorqueFluxCombinedTargetValues(uint32_t &value) noexcept
Definition TMC9660.cpp:1824
bool getTorqueOffset(int16_t &milliamps) noexcept
Read torque offset.
Definition TMC9660.cpp:1014
bool setPositionLimitHigh(int32_t limit) noexcept
Set high position limit.
Definition TMC9660.cpp:1378
bool setTargetTorqueBiquadFilterACoeff1(int32_t coeff) noexcept
Definition TMC9660.cpp:1681
bool getFluxPiError(int32_t &error) noexcept
Read flux PI error.
Definition TMC9660.cpp:1076
bool setReferenceSwitchPolaritySwap(tmc9660::tmcl::ReferenceSwitchPolaritySwap config) noexcept
Configure switch polarity and swap.
Definition TMC9660.cpp:1458
bool setStopOnVelocityDeviation(uint32_t maxError, bool softStop=true) noexcept
Configure stop-on-velocity-deviation.
Definition TMC9660.cpp:1186
bool setTargetTorqueBiquadFilterBCoeff0(int32_t coeff) noexcept
Definition TMC9660.cpp:1707
bool getEventStopSettings(tmc9660::tmcl::EventStopSettings &settings) noexcept
Read event-stop settings.
Definition TMC9660.cpp:1493
bool setReferenceSwitchEnable(tmc9660::tmcl::ReferenceSwitchEnable enable) noexcept
Enable/disable reference switch stops.
Definition TMC9660.cpp:1443
bool getOpenloopVoltage(uint16_t &voltage) noexcept
Read open-loop voltage.
Definition TMC9660.cpp:1431
bool getIntegratedActualTorqueValue(uint32_t &value) noexcept
Definition TMC9660.cpp:1836
bool setTargetTorque(int16_t milliamps) noexcept
Set desired torque.
Definition TMC9660.cpp:983
bool getVoltageDqCombinedActualValues(uint32_t &value) noexcept
Definition TMC9660.cpp:1832
bool getVelocityOffset(int32_t &offset) noexcept
Read velocity offset.
Definition TMC9660.cpp:1133
bool getActualVelocityBiquadFilterBCoeff1(int32_t &coeff) noexcept
Definition TMC9660.cpp:1803
bool setVelocityOffset(int32_t offset) noexcept
Set velocity offset.
Definition TMC9660.cpp:1129
bool getOpenloopCurrent(uint16_t &milliamps) noexcept
Read open-loop current.
Definition TMC9660.cpp:1419
bool getReferenceSwitchSearchSpeed(int32_t &speed) noexcept
Read reference search speed.
Definition TMC9660.cpp:1522
bool getPositionLimitHigh(int32_t &limit) noexcept
Read high position limit.
Definition TMC9660.cpp:1383
bool getReferenceSwitchLatchSettings(tmc9660::tmcl::ReferenceSwitchLatchSettings &setting) noexcept
Read switch latch settings.
Definition TMC9660.cpp:1479
bool getOpenloopAngle(int16_t &angle) noexcept
Read open-loop angle.
Definition TMC9660.cpp:1407
bool getRightLimitSwitchPosition(int32_t &position) noexcept
Read right-limit-switch position.
Definition TMC9660.cpp:1543
bool getPositionScalingFactor(uint16_t &factor) noexcept
Read position scaling factor.
Definition TMC9660.cpp:1289
bool getReferenceSwitchSpeed(int32_t &speed) noexcept
Read reference positioning speed.
Definition TMC9660.cpp:1535
bool getTargetTorqueBiquadFilterEnable(bool &enable) noexcept
Definition TMC9660.cpp:1673
bool getStopOnPositionDeviation(uint32_t &maxError, bool &softStop) noexcept
Read stop-on-position-deviation settings.
Definition TMC9660.cpp:1340
bool getFieldWeakeningVoltageThreshold(uint16_t &voltage) noexcept
Definition TMC9660.cpp:1628
bool getFocVoltageV(int16_t &voltage) noexcept
Definition TMC9660.cpp:1595
TMC9660 & driver
Definition TMC9660.hpp:1705
bool getFluxPiIntegrator(int32_t &integrator) noexcept
Read flux-PI integrator state.
Definition TMC9660.cpp:1092
bool setPositionScalingFactor(uint16_t factor) noexcept
Set position scaling factor.
Definition TMC9660.cpp:1285
bool getFieldWeakeningI(uint16_t &milliamps) noexcept
Definition TMC9660.cpp:1615
bool setVelocityReachedThreshold(uint32_t threshold) noexcept
Set velocity reached threshold.
bool getPositionLimitLow(int32_t &limit) noexcept
Read low position limit.
Definition TMC9660.cpp:1370
bool setStopOnPositionDeviation(uint32_t maxError, bool softStop=true) noexcept
Configure stop-on-position-deviation.
Definition TMC9660.cpp:1330
bool getActualPosition(int32_t &position) noexcept
Read actual position.
Definition TMC9660.cpp:1277
bool getPositionSensor(tmc9660::tmcl::PositionSensorSelection &sel) noexcept
Read position feedback sensor.
Definition TMC9660.cpp:1264
bool setVelocityScalingFactor(uint16_t factor) noexcept
Set velocity scaling factor.
Definition TMC9660.cpp:1174
bool setTargetTorqueBiquadFilterACoeff2(int32_t coeff) noexcept
Definition TMC9660.cpp:1694
bool setVelocitySensor(tmc9660::tmcl::VelocitySensorSelection sel) noexcept
Select velocity feedback sensor.
Definition TMC9660.cpp:1104
bool setPositionSensor(tmc9660::tmcl::PositionSensorSelection sel) noexcept
Select position feedback sensor.
Definition TMC9660.cpp:1259
bool getTorquePiIntegrator(int32_t &integrator) noexcept
Read torque-PI integrator state.
Definition TMC9660.cpp:1084
bool setVelocityNormalization(tmc9660::tmcl::VelocityPiNorm pNorm, tmc9660::tmcl::VelocityPiNorm iNorm) noexcept
Set velocity PI normalization.
Definition TMC9660.cpp:1148
bool setTargetPosition(int32_t position) noexcept
Set target position.
Definition TMC9660.cpp:1272
bool getStopOnVelocityDeviation(uint32_t &maxError, bool &softStop) noexcept
Read stop-on-velocity-deviation settings.
Definition TMC9660.cpp:1196
bool setFluxOffset(int16_t milliamps) noexcept
Set flux offset (feed-forward).
Definition TMC9660.cpp:1022
bool setActualVelocityBiquadFilterACoeff2(int32_t coeff) noexcept
Definition TMC9660.cpp:1772
bool setActualVelocityBiquadFilterACoeff1(int32_t coeff) noexcept
Definition TMC9660.cpp:1759
bool getActualTorque(int16_t &milliamps) noexcept
Read actual torque.
Definition TMC9660.cpp:988
bool getFluxOffset(int16_t &milliamps) noexcept
Read flux offset.
Definition TMC9660.cpp:1027
bool getHomeSwitchPosition(int32_t &position) noexcept
Read home-switch position.
Definition TMC9660.cpp:1551
bool getPositionPiIntegrator(int32_t &integrator) noexcept
Read position-PI integrator.
Definition TMC9660.cpp:1314
bool getActualVelocityBiquadFilterACoeff2(int32_t &coeff) noexcept
Definition TMC9660.cpp:1777
bool getPositionReachedThreshold(uint32_t &threshold) noexcept
Read position reached threshold.
Definition TMC9660.cpp:1395
bool getTorqueFluxCombinedActualValues(uint32_t &value) noexcept
Definition TMC9660.cpp:1828
bool getMccInputsRaw(uint16_t &inputs) noexcept
Definition TMC9660.cpp:1571
bool getVelocitySensor(tmc9660::tmcl::VelocitySensorSelection &sel) noexcept
Read velocity feedback sensor.
Definition TMC9660.cpp:1109
bool getFocVoltageUx(int16_t &voltage) noexcept
Definition TMC9660.cpp:1579
bool setTorqueOffset(int16_t milliamps) noexcept
Set torque offset (feed-forward).
Definition TMC9660.cpp:1009
bool setActualVelocityBiquadFilterBCoeff1(int32_t coeff) noexcept
Definition TMC9660.cpp:1798
bool setTargetTorqueBiquadFilterEnable(bool enable) noexcept
Definition TMC9660.cpp:1668
bool setPositionLoopDownsampling(uint8_t divider) noexcept
Set position loop downsampling.
Definition TMC9660.cpp:1353
bool getTargetTorqueBiquadFilterBCoeff0(int32_t &coeff) noexcept
Definition TMC9660.cpp:1712
bool getVelocityPiIntegrator(int32_t &integrator) noexcept
Read velocity-PI integrator.
Definition TMC9660.cpp:1158
bool setTargetVelocity(int32_t velocity) noexcept
Set target velocity.
Definition TMC9660.cpp:1116
bool getActualVelocityBiquadFilterBCoeff0(int32_t &coeff) noexcept
Definition TMC9660.cpp:1790
bool getFocCurrentV(int16_t &milliamps) noexcept
Definition TMC9660.cpp:1644
bool setVelocityMeterSwitchThreshold(uint32_t threshold) noexcept
Set velocity meter switch threshold.
Definition TMC9660.cpp:1221
bool setPositionLoopGains(uint16_t p, uint16_t i) noexcept
Configure position PI gains.
Definition TMC9660.cpp:1297
bool setPositionLimitLow(int32_t limit) noexcept
Set low position limit.
Definition TMC9660.cpp:1365
bool setReferenceSwitchSearchSpeed(int32_t speed) noexcept
Set reference search speed.
Definition TMC9660.cpp:1517
bool setOpenloopCurrent(uint16_t milliamps) noexcept
Set open-loop current.
Definition TMC9660.cpp:1415
bool getVelocityMeterSwitchThreshold(uint32_t &threshold) noexcept
Read velocity meter switch threshold.
Definition TMC9660.cpp:1226
bool setEventStopSettings(tmc9660::tmcl::EventStopSettings settings) noexcept
Configure event-stop settings.
Definition TMC9660.cpp:1488
bool getLastReferencePosition(int32_t &position) noexcept
Read last reference position.
Definition TMC9660.cpp:1559
bool getPositionPiError(int32_t &error) noexcept
Read position-PI error.
Definition TMC9660.cpp:1322
bool getVelocityMeterMode(tmc9660::tmcl::VelocityMeterMode &mode) noexcept
Read current velocity meter mode.
Definition TMC9660.cpp:1247
bool getVelocityReachedThreshold(uint32_t &threshold) noexcept
Read velocity reached threshold.
bool getActualVelocity(int32_t &velocity) noexcept
Read actual velocity.
Definition TMC9660.cpp:1121
bool getVelocityPiError(int32_t &error) noexcept
Read velocity-PI error.
Definition TMC9660.cpp:1166
bool getVelocityScalingFactor(uint16_t &factor) noexcept
Read velocity scaling factor.
Definition TMC9660.cpp:1178
bool getActualVelocityBiquadFilterACoeff1(int32_t &coeff) noexcept
Definition TMC9660.cpp:1764
bool getFocCurrentIq(int16_t &milliamps) noexcept
Definition TMC9660.cpp:1660
bool setReferenceSwitchLatchSettings(tmc9660::tmcl::ReferenceSwitchLatchSettings setting) noexcept
Configure switch latch settings.
Definition TMC9660.cpp:1473
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.
Definition TMC9660.cpp:1035
bool setOpenloopVoltage(uint16_t voltage) noexcept
Set open-loop voltage.
Definition TMC9660.cpp:1427
bool setActualVelocityBiquadFilterBCoeff0(int32_t coeff) noexcept
Definition TMC9660.cpp:1785
bool setVelocityMeterSwitchHysteresis(uint16_t hysteresis) noexcept
Set velocity meter hysteresis.
Definition TMC9660.cpp:1234
bool getIntegratedActualVelocityValue(uint32_t &value) noexcept
Definition TMC9660.cpp:1840
bool setTorqueFluxPiSeparation(tmc9660::tmcl::TorqueFluxPiSeparation sep) noexcept
Select combined or separate torque/flux PI parameters.
Definition TMC9660.cpp:1051
bool setPositionNormalization(tmc9660::tmcl::VelocityPiNorm pNorm, tmc9660::tmcl::VelocityPiNorm iNorm) noexcept
Set position PI normalization.
Definition TMC9660.cpp:1304
bool getPositionLoopDownsampling(uint8_t &divider) noexcept
Read position loop downsampling.
Definition TMC9660.cpp:1357
bool getFocCurrentUx(int16_t &milliamps) noexcept
Definition TMC9660.cpp:1636
bool setVelocityLoopGains(uint16_t p, uint16_t i) noexcept
Configure velocity PI gains.
Definition TMC9660.cpp:1141
bool setVelocityLoopDownsampling(uint8_t divider) noexcept
Set velocity loop downsampling.
Definition TMC9660.cpp:1209
bool getActualVelocityBiquadFilterBCoeff2(int32_t &coeff) noexcept
Definition TMC9660.cpp:1816
bool getFocVoltageUq(int16_t &voltage) noexcept
Definition TMC9660.cpp:1603
bool getReferenceSwitchSearchMode(tmc9660::tmcl::ReferenceSwitchSearchMode &mode) noexcept
Read reference search mode.
Definition TMC9660.cpp:1508
bool getTargetTorqueBiquadFilterACoeff1(int32_t &coeff) noexcept
Definition TMC9660.cpp:1686
bool setTargetTorqueBiquadFilterBCoeff2(int32_t coeff) noexcept
Definition TMC9660.cpp:1733
bool getActualVelocityBiquadFilterEnable(bool &enable) noexcept
Definition TMC9660.cpp:1751
bool setTargetTorqueBiquadFilterBCoeff1(int32_t coeff) noexcept
Definition TMC9660.cpp:1720
bool getTargetTorqueBiquadFilterACoeff2(int32_t &coeff) noexcept
Definition TMC9660.cpp:1699
bool getFocCurrentWy(int16_t &milliamps) noexcept
Definition TMC9660.cpp:1652
bool getTorquePiError(int32_t &error) noexcept
Read torque PI error.
Definition TMC9660.cpp:1068
bool getTargetTorqueBiquadFilterBCoeff1(int32_t &coeff) noexcept
Definition TMC9660.cpp:1725
bool getVelocityLoopDownsampling(uint8_t &divider) noexcept
Read velocity loop downsampling.
Definition TMC9660.cpp:1213
bool setCurrentNormalization(tmc9660::tmcl::CurrentPiNormalization pNorm, tmc9660::tmcl::CurrentPiNormalization iNorm) noexcept
Set normalization for current-PI outputs.
Definition TMC9660.cpp:1057
bool setFieldWeakeningI(uint16_t milliamps) noexcept
Definition TMC9660.cpp:1611
bool getTargetTorqueBiquadFilterBCoeff2(int32_t &coeff) noexcept
Definition TMC9660.cpp:1738
bool setReferenceSwitchSpeed(int32_t speed) noexcept
Set reference positioning speed.
Definition TMC9660.cpp:1530
bool setReferenceSwitchSearchMode(tmc9660::tmcl::ReferenceSwitchSearchMode mode) noexcept
Set reference search mode.
Definition TMC9660.cpp:1502
bool setActualVelocityBiquadFilterEnable(bool enable) noexcept
Definition TMC9660.cpp:1746
bool setFieldWeakeningVoltageThreshold(uint16_t voltage) noexcept
Definition TMC9660.cpp:1623
bool stop() noexcept
Stop torque/flux control (SYSTEM_OFF).
Definition TMC9660.cpp:979
bool getFocVoltageWy(int16_t &voltage) noexcept
Definition TMC9660.cpp:1587
bool setActualVelocityBiquadFilterBCoeff2(int32_t coeff) noexcept
Definition TMC9660.cpp:1811
Subsystem for feedback sensor configuration.
Definition TMC9660.hpp:800
bool getABNInitializationState(tmc9660::tmcl::AbnInitState &state) noexcept
Read the current state of ABN encoder initialization.
Definition TMC9660.cpp:716
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.
Definition TMC9660.cpp:702
bool getSecondaryABNEncoderValue(uint32_t &value) noexcept
Read the raw ABN2 encoder internal counter value.
Definition TMC9660.cpp:790
bool setSecondaryABNEncoderEnabled(bool enable) noexcept
Enable or disable the secondary ABN encoder.
Definition TMC9660.cpp:786
bool configureSPIEncoderDataFormat(uint32_t positionMask, uint8_t positionShift=0, tmc9660::tmcl::Direction invertDirection=tmc9660::tmcl::Direction::NOT_INVERTED) noexcept
Configure SPI encoder data format and processing.
Definition TMC9660.cpp:809
bool getSPIEncoderPositionValue(uint32_t &value) noexcept
Read SPI_ENCODER_POSITION_COUNTER_VALUE.
Definition TMC9660.cpp:919
bool configureSPIEncoder(uint8_t cmdSize, uint16_t csSettleTimeNs, uint8_t csIdleTimeUs) noexcept
Configure a SPI-based encoder for feedback.
Definition TMC9660.cpp:797
bool getSPIEncoderDirection(tmc9660::tmcl::Direction &dir) noexcept
Read SPI_ENCODER_DIRECTION.
Definition TMC9660.cpp:943
bool getSPIEncoderInitialization(tmc9660::tmcl::SpiInitMethod &method, int16_t &offset) noexcept
Read SPI_ENCODER_INITIALIZATION_METHOD and SPI_ENCODER_OFFSET.
Definition TMC9660.cpp:931
bool setSPIEncoderLUTCorrection(tmc9660::tmcl::EnableDisable enable, int8_t shiftFactor=0) noexcept
Enable or disable SPI encoder lookup table correction.
Definition TMC9660.cpp:857
bool getSPIEncoderCSIdleDelay(uint8_t &timeUs) noexcept
Read SPI_ENCODER_CS_IDLE_DELAY_TIME (0…102 µs).
Definition TMC9660.cpp:883
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.
Definition TMC9660.cpp:653
bool getSPIEncoderCSSettleDelay(uint16_t &timeNs) noexcept
Read SPI_ENCODE_CS_SETTLE_DELAY_TIME (0…6375 ns).
Definition TMC9660.cpp:875
bool getSPIEncoderLUTAddress(uint8_t &address) noexcept
Read SPI_LUT_ADDRESS_SELECT.
Definition TMC9660.cpp:951
bool getSecondaryABNCountsPerRev(uint32_t &counts) noexcept
Read ABN_2_STEPS (encoder steps per rotation, 0…16777215).
Definition TMC9660.cpp:766
bool getABNRawValue(uint32_t &value) noexcept
Read the raw ABN encoder internal counter value.
Definition TMC9660.cpp:733
bool getSecondaryABNDirection(tmc9660::tmcl::Direction &dir) noexcept
Read ABN_2_DIRECTION (normal/inverted).
Definition TMC9660.cpp:770
bool getSPIEncoderCommutationAngle(int16_t &angle) noexcept
Read SPI_ENCODER_COMMUTATION_ANGLE (-32768…32767).
Definition TMC9660.cpp:923
bool uploadSPIEncoderLUTEntry(uint8_t index, int8_t value) noexcept
Upload a single entry to the SPI encoder correction lookup table.
Definition TMC9660.cpp:867
bool getSPIEncoderPositionShift(uint8_t &shift) noexcept
Read SPI_ENCODER_POSITION_COUNTER_SHIFT.
Definition TMC9660.cpp:911
TMC9660 & driver
Definition TMC9660.hpp:1125
bool getABNPhiE(int16_t &phiE) noexcept
Read the electrical angle (phi_e) calculated from ABN feedback.
Definition TMC9660.cpp:725
bool getSPIEncoderLUTShiftFactor(int8_t &shiftFactor) noexcept
Read SPI_LUT_COMMON_SHIFT_FACTOR.
Definition TMC9660.cpp:967
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.
Definition TMC9660.cpp:636
bool getSecondaryABNGearRatio(uint8_t &ratio) noexcept
Read ABN_2_GEAR_RATIO (1…255).
Definition TMC9660.cpp:778
bool getSPIEncoderMainCmdSize(uint8_t &size) noexcept
Read SPI_ENCODER_MAIN_TRANSFER_CMD_SIZE (1…16 bytes).
Definition TMC9660.cpp:891
bool getSPIEncoderSecondaryCmdSize(uint8_t &size) noexcept
Read SPI_ENCODER_SECONDARY_TRANSFER_CMD_SIZE (0…15 bytes).
Definition TMC9660.cpp:899
bool configureABNEncoder(uint32_t countsPerRev, 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.
Definition TMC9660.cpp:687
bool getHallPhiE(int16_t &phiE) noexcept
Read the electrical angle (phi_e) calculated from Hall feedback.
Definition TMC9660.cpp:675
bool setSPIEncoderRequestData(const uint8_t *requestData, uint8_t size) noexcept
Set up SPI encoder request data for continuous transfer mode.
Definition TMC9660.cpp:822
bool getSPIEncoderLUTData(int8_t &data) noexcept
Read SPI_LUT_DATA.
Definition TMC9660.cpp:959
FeedbackSense(TMC9660 &parent) noexcept
Definition TMC9660.hpp:1124
bool configureSPIEncoderInitialization(tmc9660::tmcl::SpiInitMethod initMethod, int16_t offset=0) noexcept
Configure SPI encoder initialization method.
Definition TMC9660.cpp:847
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.
Definition TMC9660.cpp:737
bool configureSecondaryABNEncoder(uint32_t countsPerRev, tmc9660::tmcl::Direction inverted=tmc9660::tmcl::Direction::NOT_INVERTED, uint8_t gearRatio=1) noexcept
Configure the secondary ABN encoder input.
Definition TMC9660.cpp:748
bool getSPIEncoderPositionMask(uint32_t &mask) noexcept
Read SPI_ENCODER_POSITION_COUNTER_MASK.
Definition TMC9660.cpp:907
Subsystem for configuring general-purpose IOs (GPIOs).
Definition TMC9660.hpp:2591
bool setMode(uint8_t pin, bool output, bool pullEnable=false, bool pullUp=true) noexcept
Configure a GPIO pin as input or output.
Definition TMC9660.cpp:2610
bool readAnalog(uint8_t pin, uint16_t &value) noexcept
Read an analog input (e.g. external temperature or potentiometer).
Definition TMC9660.cpp:2651
GPIO(TMC9660 &parent) noexcept
Definition TMC9660.hpp:2627
TMC9660 & driver
Definition TMC9660.hpp:2628
bool writePin(uint8_t pin, bool value) noexcept
Write a digital value to a configured output pin.
Definition TMC9660.cpp:2635
bool readDigital(uint8_t pin, bool &value) noexcept
Read a digital input pin.
Definition TMC9660.cpp:2641
Subsystem for configuring the MOSFET gate driver.
Definition TMC9660.hpp:528
bool setRetryBehavior(tmc9660::tmcl::GdrvRetryBehaviour retryBehavior) noexcept
Configure fault retry behavior.
Definition TMC9660.cpp:612
bool configureVgsShortProtectionUVW(tmc9660::tmcl::VgsShortEnable enableLowSideOn, tmc9660::tmcl::VgsShortEnable enableLowSideOff, tmc9660::tmcl::VgsShortEnable enableHighSideOn, tmc9660::tmcl::VgsShortEnable enableHighSideOff) noexcept
Configure gate-to-source short protection for UVW phases.
Definition TMC9660.cpp:560
TMC9660 & driver
Definition TMC9660.hpp:791
bool setFaultHandlerRetries(uint8_t retries) noexcept
Set the maximum number of retries for fault handling.
Definition TMC9660.cpp:624
bool setOvercurrentDeglitch(tmc9660::tmcl::OvercurrentTiming uvwLowSideTime, tmc9660::tmcl::OvercurrentTiming uvwHighSideTime, tmc9660::tmcl::OvercurrentTiming y2LowSideTime, tmc9660::tmcl::OvercurrentTiming y2HighSideTime) noexcept
Configure the overcurrent protection deglitch time for UVW and Y2 phases.
Definition TMC9660.cpp:533
bool configureBootstrapCurrentLimit(tmc9660::tmcl::BootstrapCurrentLimit limit) noexcept
Configure bootstrap current limit.
Definition TMC9660.cpp:460
bool configureVgsShortProtectionY2(tmc9660::tmcl::VgsShortEnable enableLowSideOn, tmc9660::tmcl::VgsShortEnable enableLowSideOff, tmc9660::tmcl::VgsShortEnable enableHighSideOn, tmc9660::tmcl::VgsShortEnable enableHighSideOff) noexcept
Configure gate-to-source short protection for Y2 phase.
Definition TMC9660.cpp:576
bool setOvercurrentBlanking(tmc9660::tmcl::OvercurrentTiming uvwLowSideTime, tmc9660::tmcl::OvercurrentTiming uvwHighSideTime, tmc9660::tmcl::OvercurrentTiming y2LowSideTime, tmc9660::tmcl::OvercurrentTiming y2HighSideTime) noexcept
Configure the overcurrent protection blanking time for UVW and Y2 phases.
Definition TMC9660.cpp:516
bool setVgsShortBlankingTime(tmc9660::tmcl::VgsBlankingTime uvwTime, tmc9660::tmcl::VgsBlankingTime y2Time) noexcept
Set gate-to-source short protection blanking time.
Definition TMC9660.cpp:592
bool configureCurrentLimits(tmc9660::tmcl::GateCurrentSink sinkCurrentUVW, tmc9660::tmcl::GateCurrentSource sourceCurrentUVW, tmc9660::tmcl::GateCurrentSink sinkCurrentY2, tmc9660::tmcl::GateCurrentSource sourceCurrentY2) noexcept
Configure gate driver current limits for UVW and Y2 phases.
Definition TMC9660.cpp:444
bool setVgsShortDeglitchTime(tmc9660::tmcl::VgsDeglitchTime uvwTime, tmc9660::tmcl::VgsDeglitchTime y2Time) noexcept
Set gate-to-source short protection deglitch time.
Definition TMC9660.cpp:602
bool setOvercurrentThresholds(tmc9660::tmcl::OvercurrentThreshold uvwLowSideThreshold, tmc9660::tmcl::OvercurrentThreshold uvwHighSideThreshold, tmc9660::tmcl::OvercurrentThreshold y2LowSideThreshold, tmc9660::tmcl::OvercurrentThreshold y2HighSideThreshold) noexcept
Configure overcurrent protection thresholds for UVW and Y2 phases.
Definition TMC9660.cpp:499
bool enableOvercurrentProtection(tmc9660::tmcl::OvercurrentEnable enableUVWLowSide, tmc9660::tmcl::OvercurrentEnable enableUVWHighSide, tmc9660::tmcl::OvercurrentEnable enableY2LowSide, tmc9660::tmcl::OvercurrentEnable enableY2HighSide) noexcept
Enable or disable overcurrent protection for UVW and Y2 phases.
Definition TMC9660.cpp:482
bool configureBreakBeforeMakeTiming(uint8_t lowSideUVW, uint8_t highSideUVW, uint8_t lowSideY2, uint8_t highSideY2) noexcept
Configure the break-before-make timing for the gate driver.
Definition TMC9660.cpp:411
bool configureUndervoltageProtection(tmc9660::tmcl::UndervoltageLevel supplyLevel, tmc9660::tmcl::UndervoltageEnable enableVdrv, tmc9660::tmcl::UndervoltageEnable enableBstUVW, tmc9660::tmcl::UndervoltageEnable enableBstY2) noexcept
Configure undervoltage protection settings.
Definition TMC9660.cpp:466
bool enableAdaptiveDriveTime(bool enableUVW, bool enableY2) noexcept
Enable or disable adaptive drive time for UVW and Y2 phases.
Definition TMC9660.cpp:425
bool configureDriveTimes(uint8_t sinkTimeUVW, uint8_t sourceTimeUVW, uint8_t sinkTimeY2, uint8_t sourceTimeY2) noexcept
Configure drive times for UVW and Y2 phases.
Definition TMC9660.cpp:434
bool setOutputPolarity(tmc9660::tmcl::PwmOutputPolarity lowSide, tmc9660::tmcl::PwmOutputPolarity highSide) noexcept
Set the gate driver output polarity.
Definition TMC9660.cpp:401
GateDriver(TMC9660 &parent) noexcept
Definition TMC9660.hpp:790
bool setDriveFaultBehavior(tmc9660::tmcl::DriveFaultBehaviour faultBehavior) noexcept
Configure drive fault behavior.
Definition TMC9660.cpp:618
bool enableVdsMonitoringLow(tmc9660::tmcl::VdsUsage uvwEnable, tmc9660::tmcl::VdsUsage y2Enable) noexcept
Enable or disable VDS monitoring for overcurrent protection on UVW and Y2 low sides.
Definition TMC9660.cpp:550
Convenience helpers for reading and writing global parameters.
Definition TMC9660.hpp:2484
bool getIODirectionMask(uint32_t &mask) noexcept
Get GPIO direction mask (bank0:IO_DIRECTION_MASK).
Definition TMC9660.cpp:2512
bool setTimerPeriod(uint8_t timer, uint32_t period_ms) noexcept
Set interrupt timer period (bank3).
Definition TMC9660.cpp:2570
Globals(TMC9660 &parent) noexcept
Definition TMC9660.hpp:2574
bool setSerialAddress(uint8_t address) noexcept
Set module serial address (bank0:SERIAL_ADDRESS).
Definition TMC9660.cpp:2467
bool getPullEnableMask(uint32_t &mask) noexcept
Get pull-up/down enable mask.
Definition TMC9660.cpp:2520
bool readBank2(tmc9660::tmcl::GlobalParamBank2 param, int32_t &value) noexcept
Read a signed user variable from bank 2.
Definition TMC9660.cpp:2447
bool setInputTrigger(uint8_t index, tmc9660::tmcl::TriggerTransition transition) noexcept
Set trigger transition for digital input n (bank3 INPUT_n_TRIGGER_TRANSITION).
Definition TMC9660.cpp:2584
bool setPullDirectionMask(uint32_t mask) noexcept
Set pull direction mask (bank0:IO_INPUT_PULLUP_PULLDOWN_DIRECTION_MASK).
Definition TMC9660.cpp:2524
bool readBank0(tmc9660::tmcl::GlobalParamBank0 param, uint32_t &value) noexcept
Read a value from bank 0 (system settings).
Definition TMC9660.cpp:2439
bool getUserVariable(uint8_t index, int32_t &value) noexcept
Read user variable by index (bank2).
Definition TMC9660.cpp:2563
bool getClearUserVariables(bool &clear) noexcept
Get clear-user-variable flag.
Definition TMC9660.cpp:2548
TMC9660 & driver
Definition TMC9660.hpp:2575
bool setClearUserVariables(bool clear) noexcept
Configure clearing of user variables on startup (bank0:CLEAR_USER_VARIABLES).
Definition TMC9660.cpp:2544
bool setPullEnableMask(uint32_t mask) noexcept
Set pull-up/down enable mask (bank0:IO_INPUT_PULLUP_PULLDOWN_ENABLE_MASK).
Definition TMC9660.cpp:2516
bool setUserVariable(uint8_t index, int32_t value) noexcept
Set user variable by index (bank2).
Definition TMC9660.cpp:2556
bool writeBank2(tmc9660::tmcl::GlobalParamBank2 param, int32_t value) noexcept
Write a signed user variable in bank 2.
Definition TMC9660.cpp:2443
bool readBank3(tmc9660::tmcl::GlobalParamBank3 param, uint32_t &value) noexcept
Read a value from bank 3 (interrupt configuration).
Definition TMC9660.cpp:2459
bool configureHeartbeat(tmc9660::tmcl::HeartbeatMonitoringConfig iface, uint32_t timeout_ms) noexcept
Configure heartbeat monitoring interface and timeout.
Definition TMC9660.cpp:2491
bool getTimerPeriod(uint8_t timer, uint32_t &period_ms) noexcept
Get interrupt timer period (bank3).
Definition TMC9660.cpp:2577
bool setHostAddress(uint8_t address) noexcept
Set host serial address (bank0:SERIAL_HOST_ADDRESS).
Definition TMC9660.cpp:2479
bool getHostAddress(uint8_t &address) noexcept
Get host serial address (bank0:SERIAL_HOST_ADDRESS).
Definition TMC9660.cpp:2483
bool writeBank3(tmc9660::tmcl::GlobalParamBank3 param, uint32_t value) noexcept
Write a value to bank 3 (interrupt configuration).
Definition TMC9660.cpp:2455
bool getInputTrigger(uint8_t index, tmc9660::tmcl::TriggerTransition &transition) noexcept
Get trigger transition for digital input n.
Definition TMC9660.cpp:2593
bool setIODirectionMask(uint32_t mask) noexcept
Set GPIO direction mask (bank0:IO_DIRECTION_MASK).
Definition TMC9660.cpp:2508
bool setAutoStart(bool enable) noexcept
Enable or disable auto-start of stored program (bank0:AUTO_START_ENABLE).
Definition TMC9660.cpp:2532
bool getHeartbeat(tmc9660::tmcl::HeartbeatMonitoringConfig &iface, uint32_t &timeout_ms) noexcept
Read heartbeat monitoring configuration.
Definition TMC9660.cpp:2499
bool getSerialAddress(uint8_t &address) noexcept
Get module serial address (bank0:SERIAL_ADDRESS).
Definition TMC9660.cpp:2471
bool writeBank0(tmc9660::tmcl::GlobalParamBank0 param, uint32_t value) noexcept
Write a value to bank 0 (system settings).
Definition TMC9660.cpp:2435
bool getAutoStart(bool &enable) noexcept
Read auto-start enable flag.
Definition TMC9660.cpp:2536
bool getPullDirectionMask(uint32_t &mask) noexcept
Get pull direction mask.
Definition TMC9660.cpp:2528
Subsystem for configuring the communication watchdog (heartbeat).
Definition TMC9660.hpp:2455
bool configure(tmc9660::tmcl::HeartbeatMonitoringConfig mode, uint32_t timeout_ms) noexcept
Enable the heartbeat monitor and set timeout.
Definition TMC9660.cpp:2414
Heartbeat(TMC9660 &parent) noexcept
Definition TMC9660.hpp:2470
TMC9660 & driver
Definition TMC9660.hpp:2471
Subsystem for motor thermal overload protection via I²t integration.
Definition TMC9660.hpp:1984
bool getActualTotalMotorCurrent(uint32_t &current, uint8_t motorIndex=0) noexcept
Read the total motor current (torque+flux).
Definition TMC9660.cpp:2087
bool setLimit2(uint32_t limit) noexcept
Set the I²t limit for window 2.
Definition TMC9660.cpp:2079
bool getSum2(uint32_t &sum) noexcept
Read the current integrated sum of window 2.
Definition TMC9660.cpp:2096
bool getSum1(uint32_t &sum) noexcept
Read the current integrated sum of window 1.
Definition TMC9660.cpp:2092
bool getThermalWindingTimeConstant2(uint16_t &ms) noexcept
Get the winding time constant for window 2.
Definition TMC9660.cpp:2071
bool setThermalWindingTimeConstant1(uint16_t ms) noexcept
Set the winding time constant for window 1.
Definition TMC9660.cpp:2047
bool resetIntegralState() noexcept
Reset both I²t accumulators to zero.
Definition TMC9660.cpp:2043
bool setThermalWindingTimeConstant2(uint16_t ms) noexcept
Set the winding time constant for window 2.
Definition TMC9660.cpp:2067
bool setLimit1(uint32_t limit) noexcept
Set the I²t limit for window 1.
Definition TMC9660.cpp:2059
IIT(TMC9660 &parent) noexcept
Definition TMC9660.hpp:2053
bool getThermalWindingTimeConstant1(uint16_t &ms) noexcept
Get the winding time constant for window 1.
Definition TMC9660.cpp:2051
TMC9660 & driver
Definition TMC9660.hpp:2054
bool configure(uint16_t timeConstant1_ms, float continuousCurrent1_A, uint16_t timeConstant2_ms, float continuousCurrent2_A) noexcept
Configure the two I²t monitoring windows.
Definition TMC9660.cpp:2029
bool getLimit2(uint32_t &limit) noexcept
Get the I²t limit for window 2.
Definition TMC9660.cpp:2083
bool getLimit1(uint32_t &limit) noexcept
Get the I²t limit for window 1.
Definition TMC9660.cpp:2063
Subsystem for configuring motor type and basic settings.
Definition TMC9660.hpp:125
MotorConfig(TMC9660 &parent) noexcept
Definition TMC9660.hpp:320
TMC9660 & driver
Definition TMC9660.hpp:321
Subsystem for storing and recalling parameters from nonvolatile flash.
Definition TMC9660.hpp:2410
NvmStorage(TMC9660 &parent) noexcept
Definition TMC9660.hpp:2438
bool storeToFlash() noexcept
Store all writable parameters to flash or EEPROM.
Definition TMC9660.cpp:2385
bool recallFromFlash() noexcept
Restore parameters previously saved to NVM.
Definition TMC9660.cpp:2390
TMC9660 & driver
Definition TMC9660.hpp:2439
bool eraseFlashBank(uint8_t n) noexcept
Erase a configuration bank from external memory.
Definition TMC9660.cpp:2405
Subsystem for entering low-power hibernation mode and configuring wake.
Definition TMC9660.hpp:2644
Power(TMC9660 &parent) noexcept
Definition TMC9660.hpp:2663
bool enableWakePin(bool enable) noexcept
Enable or disable the external wake-up pin.
Definition TMC9660.cpp:2421
bool enterPowerDown(tmc9660::tmcl::PowerDownTimeout period) noexcept
Put the chip into power-down mode for a set duration.
Definition TMC9660.cpp:2426
TMC9660 & driver
Definition TMC9660.hpp:2664
Subsystem for motor protection features.
Definition TMC9660.hpp:2215
TMC9660 & driver
Definition TMC9660.hpp:2266
Protection(TMC9660 &parent) noexcept
Definition TMC9660.hpp:2265
bool resetI2tState() noexcept
Reset the integrated I²t sum accumulators.
Definition TMC9660.cpp:2286
bool configureVoltage(uint16_t overVoltThreshold, uint16_t underVoltThreshold) noexcept
Configure overvoltage and undervoltage protection thresholds.
Definition TMC9660.cpp:2231
bool configureTemperature(float warningDegC, float shutdownDegC) noexcept
Configure over-temperature protection thresholds.
Definition TMC9660.cpp:2241
bool setOvercurrentEnabled(bool enabled) noexcept
Enable or disable overcurrent protection on the driver outputs.
Definition TMC9660.cpp:2263
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.
Definition TMC9660.cpp:2269
Subsystem for debug and data logging features.
Definition TMC9660.hpp:2360
RamDebug(TMC9660 &parent) noexcept
Definition TMC9660.hpp:2391
bool startCapture() noexcept
Start capturing data using RAMDebug.
Definition TMC9660.cpp:2358
bool getStatus(bool &isRunning) noexcept
Get the current state of the RAM debug engine.
Definition TMC9660.cpp:2368
bool readData(uint32_t index, uint32_t &data) noexcept
Read a captured sample from RAMDebug buffer.
Definition TMC9660.cpp:2362
TMC9660 & driver
Definition TMC9660.hpp:2392
bool init(uint32_t sampleCount) noexcept
Initialize and configure the RAMDebug feature (data logging).
Definition TMC9660.cpp:2349
Hardware 8-segment acceleration/dec-acc profile controller.
Definition TMC9660.hpp:1728
bool enable(bool on) noexcept
Enable or disable the ramp generator block.
Definition TMC9660.cpp:1848
bool enableFeedForward(bool enableVelFF, bool enableAccelFF, uint16_t accelFFGain, tmc9660::tmcl::AccelerationFFShift accelFFShift) noexcept
Enable hardware feed-forward terms and set gain/shift.
Definition TMC9660.cpp:1886
bool setDeceleration(uint32_t d1, uint32_t d2, uint32_t dMax) noexcept
Set deceleration segments D1, D2, Dmax (µ units/s²).
Definition TMC9660.cpp:1860
bool getRampVelocity(int32_t &velocity) noexcept
Get the current target velocity calculated by the ramp controller.
Definition TMC9660.cpp:1903
TMC9660 & driver
Definition TMC9660.hpp:1801
bool setDirectVelocityMode(bool enable) noexcept
Direct-velocity mode instead of classic PI velocity loop.
Definition TMC9660.cpp:1899
bool setTiming(uint16_t tVmaxCycles, uint16_t tZeroWaitCycles) noexcept
Timing constraints at Vmax and between moves.
Definition TMC9660.cpp:1879
Ramp(TMC9660 &parent) noexcept
Definition TMC9660.hpp:1800
bool setAcceleration(uint32_t a1, uint32_t a2, uint32_t aMax) noexcept
Set acceleration segments A1, A2, Amax (µ units/s²).
Definition TMC9660.cpp:1852
bool getRampPosition(int32_t &position) noexcept
Get the current target position calculated by the ramp controller.
Definition TMC9660.cpp:1911
bool setVelocities(uint32_t vStart, uint32_t vStop, uint32_t v1, uint32_t v2, uint32_t vMax) noexcept
Configure velocity thresholds and limits.
Definition TMC9660.cpp:1868
Subsystem for executing a reference search (homing) routine.
Definition TMC9660.hpp:1890
bool start() noexcept
Start the reference search procedure.
Definition TMC9660.cpp:1957
bool stop() noexcept
Abort an ongoing reference search.
Definition TMC9660.cpp:1963
TMC9660 & driver
Definition TMC9660.hpp:1901
bool getStatus(tmc9660::tmcl::ReferenceSearchStatus &status) noexcept
Query the current reference search status code.
Definition TMC9660.cpp:1969
ReferenceSearch(TMC9660 &parent) noexcept
Definition TMC9660.hpp:1900
Subsystem for TMCL script execution control.
Definition TMC9660.hpp:2275
bool readMemory(uint16_t address, uint32_t &value) noexcept
Read a 32-bit instruction from script memory.
Definition TMC9660.cpp:2325
bool getStatus(uint32_t &status) noexcept
Query the execution state of the running script.
Definition TMC9660.cpp:2321
bool upload(const std::vector< uint32_t > &scriptData) noexcept
Upload a TMCL script to the TMC9660's internal memory.
Definition TMC9660.cpp:2294
bool reset() noexcept
Reset the TMCL program counter.
Definition TMC9660.cpp:2317
bool getMaxBreakpointCount(uint32_t &count) noexcept
Query the maximum number of supported breakpoints.
Definition TMC9660.cpp:2341
bool clearBreakpoints() noexcept
Remove all breakpoints from the script.
Definition TMC9660.cpp:2337
bool start(uint16_t address=0) noexcept
Start or restart execution of the stored script.
Definition TMC9660.cpp:2304
Script(TMC9660 &parent) noexcept
Definition TMC9660.hpp:2351
bool stop() noexcept
Stop execution of the running script.
Definition TMC9660.cpp:2309
bool removeBreakpoint(uint16_t address) noexcept
Remove a previously set breakpoint.
Definition TMC9660.cpp:2333
bool addBreakpoint(uint16_t address) noexcept
Add a breakpoint at the given address.
Definition TMC9660.cpp:2329
TMC9660 & driver
Definition TMC9660.hpp:2352
bool step() noexcept
Execute a single TMCL instruction of the loaded script.
Definition TMC9660.cpp:2313
Subsystem for controlling the STEP/DIR pulse input interface.
Definition TMC9660.hpp:1819
bool setMicrostepResolution(tmc9660::tmcl::StepDirStepDividerShift µSteps) noexcept
Configure microstep resolution for each STEP pulse.
Definition TMC9660.cpp:1923
bool setSignalTimeout(uint16_t timeout_ms) noexcept
Timeout before extrapolated motion stops after last pulse.
Definition TMC9660.cpp:1938
bool enableInterface(bool on) noexcept
Enable or disable the STEP/DIR interface.
Definition TMC9660.cpp:1929
bool enableVelocityFeedForward(bool enableVelFF) noexcept
Enable hardware feed-forward terms and set gain/shift.
Definition TMC9660.cpp:1948
TMC9660 & driver
Definition TMC9660.hpp:1882
bool setMaxExtrapolationVelocity(uint32_t eRPM) noexcept
Set maximum allowed extrapolation velocity.
Definition TMC9660.cpp:1943
StepDir(TMC9660 &parent) noexcept
Definition TMC9660.hpp:1881
bool enableExtrapolation(bool enable) noexcept
Enable signal extrapolation between STEP pulses.
Definition TMC9660.cpp:1933
Configure automatic stop/latch behaviour for deviation, switches.
Definition TMC9660.hpp:2154
bool configureReferenceSwitches(uint8_t mask, bool invertL, bool invertR, bool invertH, bool swapLR) noexcept
Configure reference / limit-switch inputs.
Definition TMC9660.cpp:2207
bool enableDeviationStop(uint32_t maxVelError, uint32_t maxPosError, bool softStop=true) noexcept
Stop when ramp target deviates from actual > thresholds.
Definition TMC9660.cpp:2180
bool getAndClearLatchedPosition(int32_t &pos) noexcept
Read and clear the latched position from a switch event.
Definition TMC9660.cpp:2217
TMC9660 & driver
Definition TMC9660.hpp:2206
StopEvents(TMC9660 &parent) noexcept
Definition TMC9660.hpp:2205
Subsystem for reading various telemetry and status information from the driver.
Definition TMC9660.hpp:2064
int16_t getMotorCurrent() noexcept
Read the current motor current (torque current).
Definition TMC9660.cpp:2124
bool clearGeneralErrorFlags(uint32_t mask) noexcept
Clear bits in the GENERAL_ERROR_FLAGS register.
Definition TMC9660.cpp:2153
bool getGeneralErrorFlags(uint32_t &flags) noexcept
Read the GENERAL_ERROR_FLAGS register.
Definition TMC9660.cpp:2145
TMC9660 & driver
Definition TMC9660.hpp:2145
bool getADCStatusFlags(uint32_t &flags) noexcept
Read the ADC_STATUS_FLAGS register (clipped ADC channels).
Definition TMC9660.cpp:2161
bool clearADCStatusFlags(uint32_t mask) noexcept
Clear bits in the ADC_STATUS_FLAGS register (write-1-to-clear).
Definition TMC9660.cpp:2165
int32_t getActualPosition() noexcept
Read the measured actual position of the motor.
Definition TMC9660.cpp:2138
uint16_t getExternalTemperature() noexcept
Read the external temperature sensor raw value.
Definition TMC9660.cpp:2169
float getSupplyVoltage() noexcept
Read the current supply (bus) voltage.
Definition TMC9660.cpp:2110
float getChipTemperature() noexcept
Read the internal chip temperature.
Definition TMC9660.cpp:2117
bool getGateDriverErrorFlags(uint32_t &flags) noexcept
Read the GDRV_ERROR_FLAGS register.
Definition TMC9660.cpp:2149
bool clearGateDriverErrorFlags(uint32_t mask) noexcept
Clear bits in the GDRV_ERROR_FLAGS register.
Definition TMC9660.cpp:2157
bool getGeneralStatusFlags(uint32_t &flags) noexcept
Read the GENERAL_STATUS_FLAGS register.
Definition TMC9660.cpp:2106
int32_t getActualVelocity() noexcept
Read the measured actual velocity of the motor.
Definition TMC9660.cpp:2131
Aggregated bootloader configuration written by ::TMC9660Bootloader.
Definition TMC9660Bootloader.hpp:191