HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
tmc51x0_register_defs.hpp
Go to the documentation of this file.
1
34#pragma once
35#include <cstdint>
36
37//--------------------------------------
38// TMC51x0 Register List
39//--------------------------------------
40// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) - Intentional: X-macro pattern
41// for register definitions
42#define REGISTER_LIST(X) \
43 /* General configuration registers */ \
44 X(0x00, GCONF, RW, CONFIG, "Global configuration flags") \
45 X(0x01, GSTAT, RWC, STATUS, \
46 "Global status flags (W1C: re-write '1' bits to clear respective flags)") \
47 X(0x02, IFCNT, R, STATUS, "UART transmission counter") \
48 X(0x03, NODECONF, W, CONFIG, \
49 "UART node address configuration (write-only per datasheet)") \
50 X(0x04, IOIN, R, IO, "Read state of all input pins and version") \
51 X(0x04, OUTPUT, W, IO, "Set SDO_CFG0 polarity / NAO output (write-only)") \
52 X(0x05, X_COMPARE, W, MOTION, "Position comparison register (write-only)") \
53 X(0x06, OTP_PROG, RW, OTP, \
54 "OTP programming register; write to program, read to refresh OTP_READ") \
55 X(0x07, OTP_READ, R, OTP, "OTP read register") \
56 X(0x08, FACTORY_CONF, RW, CONFIG, \
57 "Factory configuration (clock trim, can override OTP)") \
58 X(0x09, SHORT_CONF, W, PROTECTION, \
59 "Short detector configuration (write-only)") \
60 X(0x0A, DRV_CONF, W, CONFIG, "Driver configuration (write-only)") \
61 X(0x0B, GLOBAL_SCALER, W, CURRENT, \
62 "Global scaling of motor current (write-only)") \
63 X(0x0C, OFFSET_READ, R, STATUS, "Offset calibration results") \
64 /* Velocity dependent driver feature control registers */ \
65 X(0x10, IHOLD_IRUN, W, CURRENT, "Driver current control (write-only)") \
66 X(0x11, TPOWERDOWN, W, CONFIG, "Delay before power down (write-only)") \
67 X(0x12, TSTEP, R, STATUS, "Actual time between microsteps") \
68 X(0x13, TPWMTHRS, W, CONFIG, \
69 "Upper velocity for stealthChop voltage PWM mode (write-only)") \
70 X(0x14, TCOOLTHRS, W, CONFIG, \
71 "Lower threshold velocity for coolStep and stallGuard (write-only)") \
72 X(0x15, THIGH, W, CONFIG, \
73 "Velocity threshold for chopper mode switching and fullstepping " \
74 "(write-only)") \
75 /* Ramp generator motion control registers */ \
76 X(0x20, RAMPMODE, RW, MOTION, "Driving mode (Velocity, Positioning, Hold)") \
77 X(0x21, XACTUAL, RW, MOTION, "Actual motor position") \
78 X(0x22, VACTUAL, R, STATUS, "Actual motor velocity from ramp generator") \
79 X(0x23, VSTART, W, MOTION, "Motor start velocity (write-only)") \
80 X(0x24, A1, W, MOTION, \
81 "First acceleration between VSTART and V1 (write-only)") \
82 X(0x25, V1, W, MOTION, \
83 "First acceleration/deceleration phase target velocity (write-only)") \
84 X(0x26, AMAX, W, MOTION, \
85 "Second acceleration between V1 and VMAX (write-only)") \
86 X(0x27, VMAX, W, MOTION, "Target velocity in velocity mode (write-only)") \
87 X(0x28, DMAX, W, MOTION, "Deceleration between VMAX and V1 (write-only)") \
88 X(0x2A, D1, W, MOTION, "Deceleration between V1 and VSTOP (write-only)") \
89 X(0x2B, VSTOP, W, MOTION, "Motor stop velocity (write-only)") \
90 X(0x2C, TZEROWAIT, W, MOTION, \
91 "Waiting time after ramping down to zero velocity (write-only)") \
92 X(0x2D, XTARGET, RW, MOTION, "Target position for ramp mode") \
93 /* Ramp generator driver feature control registers */ \
94 X(0x33, VDCMIN, W, MOTION, \
95 "Velocity threshold for enabling dcStep (write-only)") \
96 X(0x34, SW_MODE, RW, CONFIG, "Switch mode configuration") \
97 X(0x35, RAMP_STAT, RWC, STATUS, "Ramp status and switch event status") \
98 X(0x36, XLATCH, R, STATUS, \
99 "Ramp generator latch position upon switch event") \
100 /* Encoder registers */ \
101 X(0x38, ENCMODE, RW, ENCODER, "Encoder configuration and use of N channel") \
102 X(0x39, X_ENC, RW, ENCODER, "Actual encoder position") \
103 X(0x3A, ENC_CONST, W, ENCODER, "Accumulation constant (write-only)") \
104 X(0x3B, ENC_STATUS, RWC, STATUS, "Encoder status information") \
105 X(0x3C, ENC_LATCH, R, STATUS, "Encoder position latched on N event") \
106 X(0x3D, ENC_DEVIATION, W, ENCODER, \
107 "Maximum number of steps deviation between encoder and XACTUAL " \
108 "(write-only)") \
109 /* Motor driver registers */ \
110 X(0x60, MSLUT_0, W, MICROSTEP, \
111 "Microstep lookup table entry 0 (write-only)") \
112 X(0x61, MSLUT_1, W, MICROSTEP, \
113 "Microstep lookup table entry 1 (write-only)") \
114 X(0x62, MSLUT_2, W, MICROSTEP, \
115 "Microstep lookup table entry 2 (write-only)") \
116 X(0x63, MSLUT_3, W, MICROSTEP, \
117 "Microstep lookup table entry 3 (write-only)") \
118 X(0x64, MSLUT_4, W, MICROSTEP, \
119 "Microstep lookup table entry 4 (write-only)") \
120 X(0x65, MSLUT_5, W, MICROSTEP, \
121 "Microstep lookup table entry 5 (write-only)") \
122 X(0x66, MSLUT_6, W, MICROSTEP, \
123 "Microstep lookup table entry 6 (write-only)") \
124 X(0x67, MSLUT_7, W, MICROSTEP, \
125 "Microstep lookup table entry 7 (write-only)") \
126 X(0x68, MSLUTSEL, W, MICROSTEP, \
127 "Look up table segmentation definition (write-only)") \
128 X(0x69, MSLUTSTART, W, MICROSTEP, \
129 "Absolute current at microstep table entries 0 and 256 (write-only)") \
130 X(0x6A, MSCNT, R, STATUS, "Actual position in the microstep table") \
131 X(0x6B, MSCURACT, R, STATUS, "Actual microstep current") \
132 X(0x6C, CHOPCONF, RW, CHOPPER, "Chopper and driver configuration") \
133 X(0x6D, COOLCONF, W, CONFIG, \
134 "coolStep smart current control and stallGuard2 configuration " \
135 "(write-only)") \
136 X(0x6E, DCCTRL, W, CONFIG, \
137 "dcStep automatic commutation configuration (write-only)") \
138 X(0x6F, DRV_STATUS, R, STATUS, "stallGuard2 value and driver error flags") \
139 X(0x70, PWMCONF, W, CHOPPER, \
140 "stealthChop voltage PWM mode chopper configuration (write-only per " \
141 "datasheet)") \
142 X(0x71, PWM_SCALE, R, STATUS, "Results of stealthChop amplitude regulator") \
143 X(0x72, PWM_AUTO, R, STATUS, "Automatically determined PWM config values") \
144 X(0x73, LOST_STEPS, R, STATUS, \
145 "Number of input steps skipped due to dcStep (SD_MODE=1 only)")
146
153const char *GetRegisterDef(uint8_t address);
const char * GetRegisterDef(uint8_t address)
Get register definition string.