HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
esp32_tmc51x0_test_config.hpp
Go to the documentation of this file.
1
130#pragma once
131#include "driver/gpio.h"
133#include "features/tmc51x0_config_builder.hpp" // For ConfigBuilder
134#include "esp32_tmc51x0_bus.hpp" // For Esp32SpiPinConfig
135
137
138// ============================================================================
139// GPIO PIN CONFIGURATION
140// ============================================================================
141// Defines all GPIO pin assignments for SPI communication and TMC51x0 control
142// pins. These are used by the Esp32SPI communication interface.
143
144// SPI bus pins
145constexpr gpio_num_t SPI_SCK = GPIO_NUM_5;
146constexpr gpio_num_t SPI_MOSI = GPIO_NUM_6;
147constexpr gpio_num_t SPI_MISO = GPIO_NUM_2;
148constexpr gpio_num_t SPI_CS = GPIO_NUM_18;
149
150// TMC51x0 control pins
151constexpr gpio_num_t DRV_EN = GPIO_NUM_11;
152constexpr gpio_num_t CLK = GPIO_NUM_10;
153
154// Mode configuration pins (if available as control pins)
155constexpr gpio_num_t SPI_MODE_PIN = GPIO_NUM_0;
156constexpr gpio_num_t SD_MODE_PIN = GPIO_NUM_1;
157
158// Diagnostic pins
159constexpr gpio_num_t DIAG0 = GPIO_NUM_23;
160constexpr gpio_num_t DIAG1 = GPIO_NUM_15;
161
162// Optional pins (not used in all tests, set to -1 if not connected)
163constexpr gpio_num_t DIR = static_cast<gpio_num_t>(-1);
164constexpr gpio_num_t STEP = static_cast<gpio_num_t>(-1);
165
166// SPI configuration
167constexpr uint32_t SPI_CLOCK_SPEED_HZ = 500000;
168constexpr spi_host_device_t SPI_HOST = SPI2_HOST;
169
178 Esp32SpiPinConfig config{};
179
180 // SPI pins
181 config.spi_mosi = static_cast<int>(SPI_MOSI);
182 config.spi_miso = static_cast<int>(SPI_MISO);
183 config.spi_sclk = static_cast<int>(SPI_SCK);
184 config.spi_cs = static_cast<int>(SPI_CS);
185
186 // TMC51x0 control pins
187 config.tmc51x0_pins.en_pin = static_cast<int>(DRV_EN);
188 config.tmc51x0_pins.clk_pin = static_cast<int>(CLK);
189 config.tmc51x0_pins.diag0_pin = static_cast<int>(DIAG0);
190 config.tmc51x0_pins.diag1_pin = static_cast<int>(DIAG1);
191 config.tmc51x0_pins.dir_pin = static_cast<int>(DIR);
192 config.tmc51x0_pins.step_pin = static_cast<int>(STEP);
193
194 // Mode configuration pins (if available as control pins)
195 config.tmc51x0_pins.spi_mode_pin = static_cast<int>(SPI_MODE_PIN);
196 config.tmc51x0_pins.sd_mode_pin = static_cast<int>(SD_MODE_PIN);
197
198 return config;
199}
200
201// ============================================================================
202// TYPE ENUMERATIONS
203// ============================================================================
204// Enumerations for compile-time selection of motor, board, platform, and test rig.
205// These types are used to select appropriate configuration namespaces at compile time.
206
271
279enum class BoardType {
282};
283
294enum class PlatformType {
297 // Add more platform types here as needed:
298 // PLATFORM_3D_PRINTER, ///< 3D printer platform configuration
299 // PLATFORM_CNC_ROUTER, ///< CNC router platform configuration
300};
301
329
330// ============================================================================
331// MOTOR CONFIGURATION STRUCTS
332// ============================================================================
333// Motor-specific parameters (physical specs, current settings, chopper, StealthChop).
334// Each motor has its own struct with optimized driver settings.
335// These configurations define motor physical properties and driver tuning parameters.
336// All values are static constexpr members for compile-time evaluation.
337
355 // ===== Physical Motor Specs =====
356 static constexpr uint16_t RATED_CURRENT_MA = 1700; // 1.7A (17HS4401 motor specification)
357 static constexpr uint32_t RESISTANCE_MOHM = 1500; // 1.5 Ω = 1500 mΩ per phase (17HS4401 motor specification)
358 static constexpr float INDUCTANCE_MH = 3.2f; // 3.2 mH per phase (17HS4401 motor specification)
359 static constexpr float GEAR_RATIO = 5.18f; // Planetary gearbox ratio (5.18:1)
360 static constexpr uint16_t MOTOR_FULL_STEPS = 200; // Motor steps per revolution (1.8° step angle)
361 // OUTPUT_FULL_STEPS: Steps per revolution at output shaft (after gearbox)
362 // Calculation: MOTOR_FULL_STEPS * GEAR_RATIO = 200 * 5.18 = 1036 steps/rev
363 static constexpr uint16_t OUTPUT_FULL_STEPS = static_cast<uint16_t>(MOTOR_FULL_STEPS * GEAR_RATIO); // ~1036
364 static constexpr uint32_t SUPPLY_VOLTAGE_MV = 24000; // 24V (motor-specific supply voltage)
365
366 // ===== Current Settings =====
367 // Target currents (motor-specific)
368 // Motor rated: 1.68A RMS. Target: 1.88A RMS (~112% rated)
369 // Rationale: Slightly above rated for better StealthChop calibration and microstep performance
370 // - IRUN ≥ 8 is minimum for StealthChop automatic tuning
371 // - IRUN 16-31 recommended for best microstep performance
372 // Hold current: ~50% of run current for energy efficiency
373 static constexpr uint16_t TARGET_RUN_CURRENT_MA = 1880; // 1.88A RMS (~112% of 1.68A rated)
374 static constexpr uint16_t TARGET_HOLD_CURRENT_MA = 940; // 0.94A RMS (~50% of run current)
375
376 // ===== Microstepping Configuration =====
377 // MRES=0: 256 microsteps per full step (highest resolution)
378 // Calculation: Effective steps/rev = MOTOR_FULL_STEPS * 256 = 200 * 256 = 51,200 steps/rev
379 // With gearbox: Effective steps/rev = OUTPUT_FULL_STEPS * 256 = 1036 * 256 = 265,216 steps/rev
381 static constexpr bool INTERPOLATION = true; // Interpolation always enabled for smoothness
382
383 // ===== Chopper Configuration (SpreadCycle for NEMA 17) =====
384 // TOFF: Off time (1-15). Typical: 3-5 for NEMA 17. TOFF=5 provides good balance
385 // HEND: Hysteresis end (0-7). Typical: 3-5. HEND=3 provides smooth current decay
386 // HSTRT: Hysteresis start (0-7). Typical: 1-5. HSTRT=4 provides good current ripple control
387 // TBL: Blank time (0-3). 0=16clk, 1=24clk, 2=36clk, 3=54clk. TBL=2 (36 clocks) typical
388 static constexpr uint8_t TOFF = 5;
389 static constexpr uint8_t HEND = 3;
390 static constexpr uint8_t HSTRT = 4;
391 static constexpr uint8_t TBL = 2; // Blank time: 36 clocks
392
393 // ===== StealthChop Configuration =====
394 // StealthChop provides silent operation at low speeds using PWM instead of chopper
395 // STEALTH_FREQ: PWM frequency (0-3). 0=~23kHz, 1=~35kHz, 2=~47kHz, 3=~70kHz @ 12MHz clock
396 // STEALTH_OFS: PWM offset (0-255). Higher = more current at standstill. Typical: 20-40
397 static constexpr bool STEALTH_AUTOSCALE = true; // Auto-calibrate PWM amplitude
398 static constexpr bool STEALTH_AUTOGRAD = true; // Auto-calibrate PWM gradient
399 static constexpr uint8_t STEALTH_FREQ = 1; // ~35kHz (good balance of smoothness and efficiency)
400 static constexpr uint8_t STEALTH_OFS = 30; // Good starting torque
401
402 // ===== Default Ramp Profile (Tuned for NEMA 17 with gearbox) =====
403 // All values in physical units for clarity and maintainability
404 // With gearbox: OUTPUT_FULL_STEPS * 256 = 1036 * 256 = 265,216 steps/rev
405 // RAMP_VSTART: Start velocity in RPM. Must be >0 to overcome static friction.
406 // Set to 3 RPM for reliable starting (above 2 RPM minimum for testing)
407 static constexpr float RAMP_VSTART_RPM = 3.0f;
408 // RAMP_VSTOP: Stop velocity in RPM. Motor stops when velocity drops below this.
409 // Set to 5 RPM to ensure smooth stopping above minimum test speed
410 static constexpr float RAMP_VSTOP_RPM = 5.0f;
411 // RAMP_VMAX: Maximum velocity in RPM. Higher max speed for NEMA 17 motors.
412 // Typical NEMA 17 range: 60-300 RPM for testing. Set to 120 RPM for balanced performance.
413 static constexpr float RAMP_VMAX_RPM = 120.0f;
414 // RAMP_AMAX: Maximum acceleration in rev/s². Higher acceleration for lighter NEMA 17.
415 // Set to reach 120 RPM in ~1 second: 120 RPM / 60 = 2 rev/s, so ~2 rev/s²
416 static constexpr float RAMP_AMAX_REV_S2 = 2.0f;
417 // RAMP_DMAX: Maximum deceleration in rev/s². Typically same as acceleration.
418 static constexpr float RAMP_DMAX_REV_S2 = 2.0f;
419 // RAMP_A1: First acceleration phase in rev/s². Used for S-curve acceleration.
420 // Set to half of AMAX for smooth S-curve profile
421 static constexpr float RAMP_A1_REV_S2 = 1.0f;
422 // RAMP_D1: First deceleration phase in rev/s². Used for S-curve deceleration.
423 static constexpr float RAMP_D1_REV_S2 = 1.0f;
424 // RAMP_V1: Velocity threshold in RPM for acceleration/deceleration phase transition.
425 // CRITICAL: Must be > 0 to enable two-phase acceleration and use A1/D1.
426 // Set to ~30% of VMAX (36 RPM) to enable S-curve profile with smooth transition.
427 // Acceleration: VSTART(3) -> V1(36) using A1(1.0), then V1(36) -> VMAX(120) using AMAX(2.0)
428 // Deceleration: VMAX(120) -> V1(36) using DMAX(2.0), then V1(36) -> VSTOP(5) using D1(1.0)
429 static constexpr float RAMP_V1_RPM = 36.0f;
430 // RAMP_TPOWERDOWN_MS: Power down delay after standstill (ms). Motor current reduces after this time.
431 static constexpr float RAMP_TPOWERDOWN_MS = 100.0f;
432 // RAMP_TZEROWAIT_MS: Wait time at zero velocity before power down (ms). 0 = immediate.
433 static constexpr float RAMP_TZEROWAIT_MS = 0.0f;
434
435 // ===== Power Management =====
436 // Motor power down delay (IHOLDDELAY)
437 // Total delay time for smooth motor power down after standstill
438 // Typical range: 200-500ms for smooth transition without jerk
439 static constexpr float IHOLDDELAY_MS = 300.0f; // 300ms total delay for smooth power down
440
441 // StealthChop velocity threshold in RPM (TPWMTHRS)
442 // Velocity below which StealthChop is active, above which SpreadCycle is used
443 // Set to 0 to disable StealthChop (always use SpreadCycle)
444 // Set to 30 RPM - below this StealthChop (quiet), above this SpreadCycle (more torque)
445 static constexpr float STEALTH_VELOCITY_THRESHOLD_RPM = 30.0f;
446};
447
465 // ===== Physical Motor Specs =====
466 static constexpr uint16_t RATED_CURRENT_MA = 1700; // 1.7A (17HS4401 motor specification)
467 static constexpr uint32_t RESISTANCE_MOHM = 1500; // 1.5 Ω = 1500 mΩ per phase (17HS4401 motor specification)
468 static constexpr float INDUCTANCE_MH = 3.2f; // 3.2 mH per phase (17HS4401 motor specification)
469 static constexpr float GEAR_RATIO = 1.0f; // Direct drive (no gearbox)
470 static constexpr uint16_t MOTOR_FULL_STEPS = 200;
471 static constexpr uint16_t OUTPUT_FULL_STEPS = MOTOR_FULL_STEPS; // Same as motor (no gearbox)
472 static constexpr uint32_t SUPPLY_VOLTAGE_MV = 24000; // 24V (motor-specific supply voltage)
473
474 // ===== Current Settings =====
475 // Target currents (motor-specific)
476 // Motor rated: 1.68A RMS. Target: 1.88A RMS (~112% rated)
477 // Same as geared version since motor is identical
478 // Rationale: Slightly above rated for better StealthChop calibration and microstep performance
479 // Hold current: ~50% of run current for energy efficiency
480 static constexpr uint16_t TARGET_RUN_CURRENT_MA = 1880; // 1.88A RMS (~112% of 1.68A rated)
481 static constexpr uint16_t TARGET_HOLD_CURRENT_MA = 940; // 0.94A RMS (~50% of run current)
482
483 // ===== Microstepping Configuration =====
484 // MRES=0: 256 microsteps per full step (highest resolution)
485 // Calculation: Effective steps/rev = MOTOR_FULL_STEPS * 256 = 200 * 256 = 51,200 steps/rev
487 static constexpr bool INTERPOLATION = true; // Interpolation always enabled for smoothness
488
489 // ===== Chopper Configuration (SpreadCycle for NEMA 17) =====
490 // TOFF: Off time (1-15). Typical: 3-5 for NEMA 17. TOFF=5 provides good balance
491 // HEND: Hysteresis end (0-7). Typical: 3-5. HEND=3 provides smooth current decay
492 // HSTRT: Hysteresis start (0-7). Typical: 1-5. HSTRT=4 provides good current ripple control
493 // TBL: Blank time (0-3). 0=16clk, 1=24clk, 2=36clk, 3=54clk. TBL=2 (36 clocks) typical
494 static constexpr uint8_t TOFF = 5;
495 static constexpr uint8_t HEND = 3;
496 static constexpr uint8_t HSTRT = 4;
497 static constexpr uint8_t TBL = 2; // Blank time: 36 clocks
498
499 // ===== StealthChop Configuration =====
500 // StealthChop provides silent operation at low speeds using PWM instead of chopper
501 // STEALTH_FREQ: PWM frequency (0-3). 0=~23kHz, 1=~35kHz, 2=~47kHz, 3=~70kHz @ 12MHz clock
502 // STEALTH_OFS: PWM offset (0-255). Higher = more current at standstill. Typical: 20-40
503 static constexpr bool STEALTH_AUTOSCALE = true; // Auto-calibrate PWM amplitude
504 static constexpr bool STEALTH_AUTOGRAD = true; // Auto-calibrate PWM gradient
505 static constexpr uint8_t STEALTH_FREQ = 1; // ~35kHz (good balance of smoothness and efficiency)
506 static constexpr uint8_t STEALTH_OFS = 30; // Good starting torque
507
508 // ===== Default Ramp Profile (Tuned for NEMA 17 direct drive) =====
509 // All values in physical units for clarity and maintainability
510 // Direct drive: MOTOR_FULL_STEPS * 256 = 200 * 256 = 51,200 steps/rev
511 // RAMP_VSTART: Start velocity in RPM. Set to 3 RPM for reliable starting (above 2 RPM minimum)
512 static constexpr float RAMP_VSTART_RPM = 3.0f;
513 // RAMP_VSTOP: Stop velocity in RPM. Set to 5 RPM to ensure smooth stopping above minimum test speed
514 static constexpr float RAMP_VSTOP_RPM = 5.0f;
515 // RAMP_VMAX: Maximum velocity in RPM. Typical NEMA 17 range: 60-300 RPM for testing.
516 // Set to 120 RPM for balanced performance and torque.
517 static constexpr float RAMP_VMAX_RPM = 120.0f;
518 // RAMP_AMAX: Maximum acceleration in rev/s². Set to reach 120 RPM in ~1 second: 2 rev/s²
519 static constexpr float RAMP_AMAX_REV_S2 = 2.0f;
520 static constexpr float RAMP_DMAX_REV_S2 = 2.0f;
521 // RAMP_A1: First acceleration phase in rev/s². Set to half of AMAX for smooth S-curve
522 static constexpr float RAMP_A1_REV_S2 = 1.0f;
523 static constexpr float RAMP_D1_REV_S2 = 1.0f;
524 // RAMP_V1: Velocity threshold in RPM for acceleration/deceleration phase transition.
525 // CRITICAL: Must be > 0 to enable two-phase acceleration and use A1/D1.
526 // Set to ~30% of VMAX (36 RPM) to enable S-curve profile with smooth transition.
527 // Acceleration: VSTART(3) -> V1(36) using A1(1.0), then V1(36) -> VMAX(120) using AMAX(2.0)
528 // Deceleration: VMAX(120) -> V1(36) using DMAX(2.0), then V1(36) -> VSTOP(5) using D1(1.0)
529 static constexpr float RAMP_V1_RPM = 36.0f;
530 static constexpr float RAMP_TPOWERDOWN_MS = 100.0f;
531 static constexpr float RAMP_TZEROWAIT_MS = 0.0f;
532
533 // ===== Power Management =====
534 // Motor power down delay (IHOLDDELAY)
535 // Total delay time for smooth motor power down after standstill
536 // Typical range: 200-500ms for smooth transition without jerk
537 static constexpr float IHOLDDELAY_MS = 300.0f; // 300ms total delay for smooth power down
538
539 // StealthChop velocity threshold in RPM (TPWMTHRS)
540 // Velocity below which StealthChop is active, above which SpreadCycle is used
541 // Set to 0 to disable StealthChop (always use SpreadCycle)
542 // Set to 30 RPM - below this StealthChop (quiet), above this SpreadCycle (more torque)
543 static constexpr float STEALTH_VELOCITY_THRESHOLD_RPM = 200.0f;
544};
545
568 // ===== Physical Motor Specs =====
569 static constexpr uint16_t RATED_CURRENT_MA = 4170; // 4.17A RMS (bipolar series)
570 static constexpr float GEAR_RATIO = 1.0f; // Direct drive (no gearbox, 1:1 ratio)
571 static constexpr uint16_t MOTOR_FULL_STEPS = 200; // Motor steps per revolution (1.8° step angle)
572 // OUTPUT_FULL_STEPS: Steps per revolution at output shaft (same as motor for direct drive)
573 // Calculation: MOTOR_FULL_STEPS * GEAR_RATIO = 200 * 1.0 = 200 steps/rev
574 static constexpr uint16_t OUTPUT_FULL_STEPS = MOTOR_FULL_STEPS;
575 static constexpr uint32_t RESISTANCE_MOHM = 840; // 0.84 Ω = 840 mΩ (Bipolar series resistance)
576 static constexpr float INDUCTANCE_MH = 10.4f; // Bipolar series inductance
577 static constexpr uint32_t SUPPLY_VOLTAGE_MV = 24000; // 24V (motor-specific supply voltage)
578
579 // ===== Current Settings =====
580 // Target currents (motor-specific)
581 // Motor rated: 4.17A RMS (bipolar series). Target: 4.17A RMS (100% rated)
582 // Rationale: Use full rated current for maximum torque
583 // Hold current: ~50% of run current for energy efficiency
584 static constexpr uint16_t TARGET_RUN_CURRENT_MA = 4170; // 4.17A RMS (100% of rated)
585 static constexpr uint16_t TARGET_HOLD_CURRENT_MA = 2150; // 2.15A RMS (~50% of run current)
586
587 // ===== Microstepping Configuration =====
588 // MRES=0: 256 microsteps per full step (highest resolution)
589 // Calculation: Effective steps/rev = MOTOR_FULL_STEPS * 256 = 200 * 256 = 51,200 steps/rev
591 static constexpr bool INTERPOLATION = true; // Interpolation always enabled for smoothness
592
593 // ===== Chopper Configuration (SpreadCycle for NEMA 34) =====
594 // TOFF: Off time (1-15). Typical: 3-5 for NEMA 34. TOFF=5 provides good balance
595 // HEND: Hysteresis end (0-7). Typical: 3-5. HEND=3 provides smooth current decay
596 // HSTRT: Hysteresis start (0-7). Typical: 1-5. HSTRT=4 provides good current ripple control
597 // TBL: Blank time (0-3). 0=16clk, 1=24clk, 2=36clk, 3=54clk. TBL=2 (36 clocks) typical
598 static constexpr uint8_t TOFF = 5;
599 static constexpr uint8_t HEND = 3;
600 static constexpr uint8_t HSTRT = 4;
601 static constexpr uint8_t TBL = 2; // Blank time: 36 clocks
602
603 // ===== StealthChop Configuration =====
604 // StealthChop provides silent operation at low speeds using PWM instead of chopper
605 // STEALTH_FREQ: PWM frequency (0-3). 0=~23kHz, 1=~35kHz, 2=~47kHz, 3=~70kHz @ 12MHz clock
606 // STEALTH_OFS: PWM offset (0-255). Higher = more current at standstill. Typical: 20-40
607 // May need adjustment for higher current motors (NEMA 34)
608 static constexpr bool STEALTH_AUTOSCALE = true; // Auto-calibrate PWM amplitude
609 static constexpr bool STEALTH_AUTOGRAD = true; // Auto-calibrate PWM gradient
610 static constexpr uint8_t STEALTH_FREQ = 1; // ~35kHz (good balance of smoothness and efficiency)
611 static constexpr uint8_t STEALTH_OFS = 30; // May need adjustment for higher current motor
612
613 // ===== Default Ramp Profile (Tuned for NEMA 34) =====
614 // All values in physical units for clarity and maintainability
615 // Direct drive: MOTOR_FULL_STEPS * 256 = 200 * 256 = 51,200 steps/rev
616 // Lower acceleration due to higher rotor inertia
617 // RAMP_VSTART: Start velocity in RPM. Set to 5 RPM for reliable starting (above 2 RPM minimum)
618 static constexpr float RAMP_VSTART_RPM = 5.0f;
619 // RAMP_VSTOP: Stop velocity in RPM. Set to 5 RPM to ensure smooth stopping above minimum test speed
620 static constexpr float RAMP_VSTOP_RPM = 3.0f;
621 // RAMP_VMAX: Maximum velocity in RPM. NEMA 34 typically operates 30-100 RPM for testing.
622 // Set to 60 RPM for balanced performance with higher inertia motor.
623 static constexpr float RAMP_VMAX_RPM = 60.0f;
624 // RAMP_AMAX: Maximum acceleration in rev/s². Lower for NEMA 34 due to higher rotor inertia.
625 // Set to reach 60 RPM in ~1 second: 1 rev/s²
626 static constexpr float RAMP_AMAX_REV_S2 = 5.0f;
627 static constexpr float RAMP_DMAX_REV_S2 = 5.0f;
628 // RAMP_A1: First acceleration phase in rev/s². Set to half of AMAX for smooth S-curve
629 static constexpr float RAMP_A1_REV_S2 = 2.5f;
630 static constexpr float RAMP_D1_REV_S2 = 2.5f;
631 // RAMP_V1: Velocity threshold in RPM for acceleration/deceleration phase transition.
632 // CRITICAL: Must be > 0 to enable two-phase acceleration and use A1/D1.
633 // Set to ~30% of VMAX (18 RPM) to enable S-curve profile with smooth transition.
634 // Acceleration: VSTART(3) -> V1(18) using A1(0.5), then V1(18) -> VMAX(60) using AMAX(1.0)
635 // Deceleration: VMAX(60) -> V1(18) using DMAX(1.0), then V1(18) -> VSTOP(5) using D1(0.5)
636 static constexpr float RAMP_V1_RPM = 18.0f;
637 static constexpr float RAMP_TPOWERDOWN_MS = 100.0f;
638 static constexpr float RAMP_TZEROWAIT_MS = 0.0f;
639
640 // ===== Power Management =====
641 // Motor power down delay (IHOLDDELAY)
642 // Total delay time for smooth motor power down after standstill
643 // Higher values for high-torque motors to prevent mechanical shock
644 // Typical range: 300-500ms for NEMA 34 motors
645 static constexpr float IHOLDDELAY_MS = 400.0f; // 400ms total delay for smooth power down
646
647 // StealthChop velocity threshold in RPM (TPWMTHRS)
648 // Velocity below which StealthChop is active, above which SpreadCycle is used
649 // Set to 0 to disable StealthChop (always use SpreadCycle)
650 // Set to 20 RPM - below this StealthChop (quiet), above this SpreadCycle (more torque for larger motor)
651 static constexpr float STEALTH_VELOCITY_THRESHOLD_RPM = 500.0f;
652};
653
664 // ===== Motion Profiles =====
665 struct Motion {
666 // **Bounds / homing search speed (RPM)**:
667 // - Used by both bounds finding and sensorless homing (search phase).
668 // - Must be >= `StallGuard::MIN_VELOCITY_RPM` so StallGuard is actually active (TCOOLTHRS).
669 // - Higher speeds are typically more reliable for StallGuard, but increase impact energy.
670 static constexpr float BOUNDS_SEARCH_SPEED_RPM = 60.0f;
671
672 // **Bounds / homing acceleration (rev/s²)**:
673 // - This is *rev/s²*, not RPM/s. Keep it modest for repeatable SG behavior.
674 static constexpr float BOUNDS_SEARCH_ACCEL_REV_S2 = 5.0f;
675
676 // **Timeout for bounds/homing search (ms)**:
677 static constexpr uint32_t HOMING_TIMEOUT_MS = 30000;
678 };
679
680 // ===== Sensorless Homing / StallGuard Configuration =====
681 struct StallGuard {
682 // **SGT_HOMING** (StallGuard2 threshold, -64..+63):
683 // - Lower (more negative) = more sensitive (stall triggers easier).
684 // - Higher (more positive) = less sensitive.
685 // Tune with `stallguard_tuning` at the velocity below; then validate across the window.
686 static constexpr int8_t SGT_HOMING = 10;
687
688 // **SGT tuning context**:
689 // SGT is velocity dependent. Keep these values here so all apps/tools use the same assumptions.
691 static constexpr float TUNING_MIN_VELOCITY_RPM = 30.0f;
692 static constexpr float TUNING_MAX_VELOCITY_RPM = 60.0f;
693
694 // **FILTER_ENABLED (SFILT)**:
695 // Enables StallGuard filtering (reduces noise/false triggers, adds latency).
696 static constexpr bool FILTER_ENABLED = false;
697
698 // **CoolStep (optional)**:
699 // For sensorless homing / bounds finding we usually keep CoolStep disabled (SEMIN/SEMAX=0)
700 // to avoid current modulation distorting SG readings.
701 static constexpr uint8_t SEMIN = 0; // 0 = CoolStep disabled
702 static constexpr uint8_t SEMAX = 0;
703
704 // **MIN_VELOCITY_RPM (TCOOLTHRS)**:
705 // StallGuard2 is only valid above this velocity (SpreadCycle only).
706 static constexpr float MIN_VELOCITY_RPM = 15.0f;
707
708 // **STALL_DETECTION_CURRENT_FACTOR**:
709 // Reduces motor current during stall-detect moves. Lower current can improve sensitivity
710 // and reduce mechanical stress at the endstop.
711 static constexpr float STALL_DETECTION_CURRENT_FACTOR = 0.3f; // Use 30% of rated current
712 };
713};
714
722 // ===== Motion Profiles =====
723 struct Motion {
724 // **Bounds / homing search speed (RPM)**:
725 // For this NEMA34 fatigue rig, 60 RPM is above typical low-speed resonance and is a good
726 // baseline for StallGuard bounds finding.
727 static constexpr float BOUNDS_SEARCH_SPEED_RPM = 45.0f;
728
729 // **Bounds / homing acceleration (rev/s²)**:
730 static constexpr float BOUNDS_SEARCH_ACCEL_REV_S2 = 20.0f;
731
732 // **Timeout for bounds/homing search (ms)**:
733 static constexpr uint32_t HOMING_TIMEOUT_MS = 30000;
734 };
735
736 // ===== Sensorless Homing / StallGuard Configuration =====
737 struct StallGuard {
738 // **SGT_HOMING** (StallGuard2 threshold, -64..+63):
739 // Tuned via AutoTuneStallGuard at the velocity below with current reduction.
740 static constexpr int8_t SGT_HOMING = -9;
741
742 // **SGT tuning context** (velocity dependent):
744 static constexpr float TUNING_MIN_VELOCITY_RPM = 30.0f;
745 static constexpr float TUNING_MAX_VELOCITY_RPM = 80.0f;
746
747 // **FILTER_ENABLED (SFILT)**:
748 // For this rig we enable filtering to reduce false stalls during accel/decel.
749 static constexpr bool FILTER_ENABLED = true;
750 static constexpr uint8_t SEMIN = 0; // 0 = CoolStep disabled
751 static constexpr uint8_t SEMAX = 0;
752
753 // **MIN_VELOCITY_RPM (TCOOLTHRS)**:
754 static constexpr float MIN_VELOCITY_RPM = 20.0f;
755
756 // **STALL_DETECTION_CURRENT_FACTOR**:
757 // Reduce current during stall-detect moves to improve sensitivity and reduce impact energy.
758 static constexpr float STALL_DETECTION_CURRENT_FACTOR = 0.3f; // Adjust per rig
759 };
760};
761
762// ============================================================================
763// BOARD CONFIGURATION NAMESPACES
764// ============================================================================
765// Board-specific hardware parameters (sense resistor, supply voltage, MOSFETs).
766// These values are used for automatic current calculation and power stage configuration.
767// Board configurations stay the same regardless of which motor is connected.
768
787 // ===== Hardware Configuration =====
788 static constexpr uint32_t SENSE_RESISTOR_MOHM = 50;
789 static constexpr uint32_t CLOCK_FREQUENCY_HZ = 0;
790
791 // ===== Power Stage MOSFET Characteristics (BSC072N08NS5) =====
792 static constexpr float MOSFET_MILLER_CHARGE_NC = 6.0f;
793 static constexpr uint32_t BBM_TIME_NS = 100;
794
795 // ===== Short Protection Defaults =====
796 // (can be overridden per motor if needed)
797 static constexpr uint16_t S2VS_VOLTAGE_MV = 625;
798 static constexpr uint16_t S2G_VOLTAGE_MV = 625;
799};
800
822 // ===== Hardware Configuration =====
823 static constexpr uint32_t SENSE_RESISTOR_MOHM = 110;
824 static constexpr uint32_t CLOCK_FREQUENCY_HZ = 0;
825
826 // ===== Power Stage MOSFET Characteristics (typical BOB MOSFETs) =====
827 static constexpr float MOSFET_MILLER_CHARGE_NC = 30.0f;
828 static constexpr uint32_t BBM_TIME_NS = 200;
829
830 // ===== Short Protection Defaults =====
831 // (can be overridden per motor if needed)
832 static constexpr uint16_t S2VS_VOLTAGE_MV = 625;
833 static constexpr uint16_t S2G_VOLTAGE_MV = 625;
834};
835
836// ============================================================================
837// PLATFORM CONFIGURATION NAMESPACES
838// ============================================================================
839// Platform/application-specific parameters (reference switches, encoder, mechanical system).
840// These parameters depend on the application/platform and define how the motor is used
841// in the physical system (endstops, position feedback, gearing, etc.).
842
860 // ===== Reference Switch Configuration =====
862 // Assuming Normally Open (NO) switches connecting to GND (Standard 3D printer style)
863 // Pin states: HIGH when open (pullup), LOW when triggered (closed).
864 // TMC51x0 Polarity: ACTIVE_LOW = trigger on GND, ACTIVE_HIGH = trigger on VCC.
869 static constexpr bool LEFT_STOP_ENABLE = true;
870 static constexpr bool RIGHT_STOP_ENABLE = true;
877 };
878
879 // ===== Encoder Configuration (AS5047U example) =====
880 struct Encoder {
881 // AS5047U Specs:
882 // ABI Resolution: Default 4096 ppr (pulses per rev) = 16384 counts per rev (edges)
883 // SPI Resolution: 14-bit = 16384 positions
884 static constexpr uint16_t PULSES_PER_REV = 4096;
885 static constexpr uint16_t COUNTS_PER_REV = 16384;
894 static constexpr bool INVERT_DIRECTION = false;
895
896 // Encoder deviation detection
897 // Maximum allowed deviation between motor position and encoder position in full steps
898 // Typical range: 10-50 steps for normal operation, 1-10 steps for tight control
899 static constexpr int32_t ALLOWED_DEVIATION_STEPS = 25;
900 };
901
902 // ===== Mechanical System Configuration =====
903 struct Mechanical {
904 // Note: Gear ratio is typically motor-specific, but can be platform-specific if motor
905 // is used with different gearboxes on different platforms. For now, gear ratio is
906 // specified in MotorConfig, but can be overridden here if needed.
909 static constexpr float LEAD_SCREW_PITCH_MM = 0.0f;
910 static constexpr uint16_t BELT_PULLEY_TEETH = 0;
911 static constexpr float BELT_PITCH_MM = 0.0f;
912
913 // Motor direction for this platform:
914 // Use this to match the physical mounting / wiring so that "positive" motion in software
915 // corresponds to the preferred mechanical direction on this rig.
917 };
918};
919
937 // ===== Reference Switch Configuration =====
939 // Assuming Normally Open (NO) switches connecting to GND (Standard 3D printer style)
940 // Pin states: HIGH when open (pullup), LOW when triggered (closed).
941 // TMC51x0 Polarity: ACTIVE_LOW = trigger on GND, ACTIVE_HIGH = trigger on VCC.
946 static constexpr bool LEFT_STOP_ENABLE = true;
947 static constexpr bool RIGHT_STOP_ENABLE = true;
954 };
955
956 // ===== Encoder Configuration (AS5047U example) =====
957 struct Encoder {
958 // AS5047U Specs:
959 // ABI Resolution: Default 4096 ppr (pulses per rev) = 16384 counts per rev (edges)
960 // SPI Resolution: 14-bit = 16384 positions
961 static constexpr uint16_t PULSES_PER_REV = 4096;
962 static constexpr uint16_t COUNTS_PER_REV = 16384;
971 static constexpr bool INVERT_DIRECTION = false;
972
973 // Encoder deviation detection
974 // Maximum allowed deviation between motor position and encoder position in full steps
975 // Typical range: 10-50 steps for normal operation, 1-10 steps for tight control
976 static constexpr int32_t ALLOWED_DEVIATION_STEPS = 25;
977 };
978
979 // ===== Mechanical System Configuration =====
980 struct Mechanical {
981 // Fatigue test rig uses direct drive (no gearbox)
984 static constexpr float LEAD_SCREW_PITCH_MM = 0.0f;
985 static constexpr uint16_t BELT_PULLEY_TEETH = 0;
986 static constexpr float BELT_PITCH_MM = 0.0f;
987
988 // Motor direction for this platform:
989 // Flip to INVERSE if the motor is mounted/wired such that the desired "positive" direction is reversed.
991 };
992};
993
994// Forward declaration for TestRigConfig (defined after helper functions)
995template<TestRigType test_rig>
997
998// ============================================================================
999// CONFIGURATION HELPER FUNCTIONS
1000// ============================================================================
1001// Functions to populate DriverConfig structures from motor, board, and platform configurations.
1002// These functions apply configurations from the structs defined above.
1003
1023template<BoardType board_type>
1024inline void ApplyBoardConfig(tmc51x0::DriverConfig& cfg) noexcept {
1025 // Start with existing config and apply board-specific settings
1026 tmc51x0::ConfigBuilder builder(cfg);
1027
1028 if constexpr (board_type == BoardType::BOARD_TMC51x0_EVAL) {
1029 // TMC51x0 Evaluation Kit hardware configuration
1037 .WithShortFilter(1);
1038
1039 // Clock configuration
1041 builder.WithInternalClock();
1042 } else {
1044 }
1045 }
1046 else if constexpr (board_type == BoardType::BOARD_TMC51x0_BOB) {
1047 // TMC51x0 Break-Out Board hardware configuration
1055 .WithShortFilter(1);
1056
1057 // Clock configuration
1059 builder.WithInternalClock();
1060 } else {
1062 }
1063 }
1064
1065 cfg = builder.Build();
1066}
1067
1079 // Use ConfigBuilder for clean, readable configuration
1080 // Start with existing config to preserve any pre-configured values
1081 tmc51x0::ConfigBuilder builder(cfg);
1082
1083 // ===== MOTOR CONFIGURATION =====
1092
1093 // ===== CHOPPER CONFIGURATION =====
1101
1102 // ===== STEALTHCHOP CONFIGURATION =====
1103 .WithStealthChop(true) // Enabled via global_config.en_stealthchop_mode
1105 .WithStealthChopPwmFreq(MotorConfig_17HS4401S::STEALTH_FREQ)
1109
1110 // ===== GLOBAL CONFIGURATION =====
1111 .WithRecalibration(false)
1114
1115 // ===== MOTION CONFIGURATION =====
1124 .WithRampPowerDownDelayMs(MotorConfig_17HS4401S::RAMP_TPOWERDOWN_MS)
1126
1127 // ===== MECHANICAL SYSTEM (Motor-specific gear ratio) =====
1128 // Note: System type and other mechanical parameters are set via ApplyPlatformConfig()
1130
1131 // ===== STALLGUARD CONFIGURATION =====
1132 // Set default StallGuard config from test config
1136
1137 // ===== DIRECTION =====
1139
1140 cfg = builder.Build();
1141}
1142
1154 // Use ConfigBuilder for clean, readable configuration
1155 // Start with existing config to preserve any pre-configured values
1156 tmc51x0::ConfigBuilder builder(cfg);
1157
1158 // ===== MOTOR CONFIGURATION =====
1167
1168 // ===== CHOPPER CONFIGURATION =====
1176
1177 // ===== STEALTHCHOP CONFIGURATION =====
1178 .WithStealthChop(true) // Enabled via global_config.en_stealthchop_mode
1180 .WithStealthChopPwmFreq(MotorConfig_17HS4401S_Direct::STEALTH_FREQ)
1184
1185 // ===== GLOBAL CONFIGURATION =====
1186 .WithRecalibration(false)
1189
1190 // ===== MOTION CONFIGURATION =====
1199 .WithRampPowerDownDelayMs(MotorConfig_17HS4401S_Direct::RAMP_TPOWERDOWN_MS)
1201
1202 // ===== MECHANICAL SYSTEM (Motor-specific gear ratio) =====
1203 // Note: System type and other mechanical parameters are set via ApplyPlatformConfig()
1204 .WithDirectDrive() // Direct drive (gear_ratio = 1.0)
1205
1206 // ===== STALLGUARD CONFIGURATION =====
1207 // Set default StallGuard config from test config
1211
1212 // ===== DIRECTION =====
1214
1215 cfg = builder.Build();
1216}
1217
1229 // Use ConfigBuilder for clean, readable configuration
1230 // Start with existing config to preserve any pre-configured values
1231 tmc51x0::ConfigBuilder builder(cfg);
1232
1233 // ===== MOTOR CONFIGURATION =====
1242
1243 // ===== CHOPPER CONFIGURATION =====
1251
1252 // ===== STEALTHCHOP CONFIGURATION =====
1253 .WithStealthChop(true) // Enabled via global_config.en_stealthchop_mode
1259
1260 // ===== GLOBAL CONFIGURATION =====
1261 .WithRecalibration(false)
1264
1265 // ===== MOTION CONFIGURATION =====
1276
1277 // ===== MECHANICAL SYSTEM (Motor-specific gear ratio) =====
1278 // Note: System type and other mechanical parameters are set via ApplyPlatformConfig()
1279 .WithDirectDrive() // Direct drive (gear_ratio = 1.0)
1280
1281 // ===== STALLGUARD CONFIGURATION =====
1282 // Set default StallGuard config from test config
1283 // This provides a sensible starting point; can be overridden at runtime (e.g., during bounds finding)
1287
1288 // ===== DIRECTION =====
1290
1291 cfg = builder.Build();
1292}
1293
1311template<PlatformType platform_type>
1312inline void ApplyPlatformConfig(tmc51x0::DriverConfig& cfg) noexcept {
1313 // Start with existing config and apply platform-specific mechanical system settings
1314 tmc51x0::ConfigBuilder builder(cfg);
1315
1316 if constexpr (platform_type == PlatformType::PLATFORM_CORE_DRIVER_TEST_RIG) {
1317 // Core Driver Test Rig mechanical system configuration
1318 // Gear ratio is already set from motor config, just configure system type
1320 builder.WithGearbox(cfg.mechanical.gear_ratio); // Preserve gear ratio from motor config
1322 builder.WithDirectDrive();
1328 }
1329
1330 // Direction is platform-dependent (mounting/wiring). Apply it here so it can override motor defaults.
1332 }
1333 else if constexpr (platform_type == PlatformType::PLATFORM_FATIGUE_TEST_RIG) {
1334 // Fatigue Test Rig mechanical system configuration
1335 // Gear ratio is already set from motor config, just configure system type
1337 builder.WithGearbox(cfg.mechanical.gear_ratio); // Preserve gear ratio from motor config
1339 builder.WithDirectDrive();
1345 }
1346
1347 // Direction is platform-dependent (mounting/wiring). Apply it here so it can override motor defaults.
1349 }
1350 // Add more platform types here:
1351 // else if constexpr (platform_type == PlatformType::PLATFORM_3D_PRINTER) {
1352 // // ... configure from PlatformConfig_3DPrinter struct
1353 // }
1354
1355 cfg = builder.Build();
1356}
1357
1367template<PlatformType platform_type>
1370
1371 if constexpr (platform_type == PlatformType::PLATFORM_CORE_DRIVER_TEST_RIG) {
1379 }
1380 else if constexpr (platform_type == PlatformType::PLATFORM_FATIGUE_TEST_RIG) {
1388 }
1389 // Add more platform types here:
1390 // else if constexpr (platform_type == PlatformType::PLATFORM_3D_PRINTER) {
1391 // // ... configure from PlatformConfig_3DPrinter struct
1392 // }
1393
1394 return ref_cfg;
1395}
1396
1406template<PlatformType platform_type>
1408 tmc51x0::EncoderConfig enc_cfg{};
1409
1410 if constexpr (platform_type == PlatformType::PLATFORM_CORE_DRIVER_TEST_RIG) {
1416 }
1417 else if constexpr (platform_type == PlatformType::PLATFORM_FATIGUE_TEST_RIG) {
1423 }
1424 // Add more platform types here:
1425 // else if constexpr (platform_type == PlatformType::PLATFORM_3D_PRINTER) {
1426 // // ... configure from PlatformConfig_3DPrinter struct
1427 // }
1428
1429 // Note: resolution is set separately via SetResolution() method
1430 return enc_cfg;
1431}
1432
1439template<PlatformType platform_type>
1440constexpr uint16_t GetEncoderPulsesPerRev() noexcept {
1441 if constexpr (platform_type == PlatformType::PLATFORM_CORE_DRIVER_TEST_RIG) {
1443 }
1444 else if constexpr (platform_type == PlatformType::PLATFORM_FATIGUE_TEST_RIG) {
1446 }
1447 // Add more platform types here
1448 return 0;
1449}
1450
1457template<PlatformType platform_type>
1458inline bool GetEncoderInvertDirection() noexcept {
1459 if constexpr (platform_type == PlatformType::PLATFORM_CORE_DRIVER_TEST_RIG) {
1461 }
1462 else if constexpr (platform_type == PlatformType::PLATFORM_FATIGUE_TEST_RIG) {
1464 }
1465 // Add more platform types here
1466 return false;
1467}
1468
1475template<TestRigType test_rig>
1476constexpr MotorType GetTestRigMotorType() noexcept {
1477 if constexpr (test_rig == TestRigType::TEST_RIG_CORE_DRIVER) {
1478 return MotorType::MOTOR_17HS4401S_GEARBOX; // Default to gearbox, can be overridden
1479 }
1480 else if constexpr (test_rig == TestRigType::TEST_RIG_FATIGUE) {
1482 }
1483 return MotorType::MOTOR_17HS4401S_GEARBOX; // Default fallback
1484}
1485
1492template<TestRigType test_rig>
1493constexpr BoardType GetTestRigBoardType() noexcept {
1494 if constexpr (test_rig == TestRigType::TEST_RIG_CORE_DRIVER) {
1496 }
1497 else if constexpr (test_rig == TestRigType::TEST_RIG_FATIGUE) {
1499 }
1500 return BoardType::BOARD_TMC51x0_EVAL; // Default fallback
1501}
1502
1509template<TestRigType test_rig>
1511 if constexpr (test_rig == TestRigType::TEST_RIG_CORE_DRIVER) {
1513 }
1514 else if constexpr (test_rig == TestRigType::TEST_RIG_FATIGUE) {
1516 }
1517 return PlatformType::PLATFORM_CORE_DRIVER_TEST_RIG; // Default fallback
1518}
1519
1526template<MotorType motor_type>
1528 // StallGuard configuration
1529 struct StallGuard {
1530 static constexpr int8_t SGT_HOMING = []() {
1531 if constexpr (motor_type == MotorType::MOTOR_17HS4401S_GEARBOX ||
1532 motor_type == MotorType::MOTOR_17HS4401S_DIRECT) {
1534 }
1535 else if constexpr (motor_type == MotorType::MOTOR_APPLIED_MOTION_5034) {
1537 }
1538 return int8_t(10); // Default fallback
1539 }();
1540
1541 static constexpr bool FILTER_ENABLED = []() {
1542 if constexpr (motor_type == MotorType::MOTOR_17HS4401S_GEARBOX ||
1543 motor_type == MotorType::MOTOR_17HS4401S_DIRECT) {
1545 }
1546 else if constexpr (motor_type == MotorType::MOTOR_APPLIED_MOTION_5034) {
1548 }
1549 return true; // Default fallback
1550 }();
1551
1552 static constexpr uint8_t SEMIN = []() {
1553 if constexpr (motor_type == MotorType::MOTOR_17HS4401S_GEARBOX ||
1554 motor_type == MotorType::MOTOR_17HS4401S_DIRECT) {
1556 }
1557 else if constexpr (motor_type == MotorType::MOTOR_APPLIED_MOTION_5034) {
1559 }
1560 return uint8_t(2); // Default fallback
1561 }();
1562
1563 static constexpr uint8_t SEMAX = []() {
1564 if constexpr (motor_type == MotorType::MOTOR_17HS4401S_GEARBOX ||
1565 motor_type == MotorType::MOTOR_17HS4401S_DIRECT) {
1567 }
1568 else if constexpr (motor_type == MotorType::MOTOR_APPLIED_MOTION_5034) {
1570 }
1571 return uint8_t(5); // Default fallback
1572 }();
1573
1574 // Minimum velocity (TCOOLTHRS) for StallGuard2 operation in RPM
1575 static constexpr float MIN_VELOCITY_RPM = []() {
1576 if constexpr (motor_type == MotorType::MOTOR_17HS4401S_GEARBOX ||
1577 motor_type == MotorType::MOTOR_17HS4401S_DIRECT) {
1579 }
1580 else if constexpr (motor_type == MotorType::MOTOR_APPLIED_MOTION_5034) {
1582 }
1583 return 60.0f; // Default fallback
1584 }();
1585 };
1586
1587 // Motion profile configuration
1588 struct Motion {
1589 // HOMING_SEARCH_SPEED_RPM removed - use BOUNDS_SEARCH_SPEED_RPM for all search operations
1590 // (consolidated since both are search speeds for finding limits)
1591 // HOMING_SWITCH_SPEED_RPM removed - not used in current implementation
1592
1593 static constexpr float BOUNDS_SEARCH_SPEED_RPM = []() {
1594 if constexpr (motor_type == MotorType::MOTOR_17HS4401S_GEARBOX ||
1595 motor_type == MotorType::MOTOR_17HS4401S_DIRECT) {
1597 }
1598 else if constexpr (motor_type == MotorType::MOTOR_APPLIED_MOTION_5034) {
1600 }
1601 return 30.0f; // Default fallback
1602 }();
1603
1604 static constexpr float BOUNDS_SEARCH_ACCEL_REV_S2 = []() {
1605 if constexpr (motor_type == MotorType::MOTOR_17HS4401S_GEARBOX ||
1606 motor_type == MotorType::MOTOR_17HS4401S_DIRECT) {
1608 }
1609 else if constexpr (motor_type == MotorType::MOTOR_APPLIED_MOTION_5034) {
1611 }
1612 return 5; // Default fallback
1613 }();
1614
1615 static constexpr uint32_t HOMING_TIMEOUT_MS = []() {
1616 if constexpr (motor_type == MotorType::MOTOR_17HS4401S_GEARBOX ||
1617 motor_type == MotorType::MOTOR_17HS4401S_DIRECT) {
1619 }
1620 else if constexpr (motor_type == MotorType::MOTOR_APPLIED_MOTION_5034) {
1622 }
1623 return uint32_t(30000); // Default fallback
1624 }();
1625 };
1626};
1627
1641template<TestRigType test_rig>
1643
1644// Static storage for reference switch and encoder configs (used by DriverConfig pointers)
1645// These are stored per test rig type to ensure they persist for the lifetime of DriverConfig
1646namespace {
1647}
1648
1660template<TestRigType test_rig>
1661inline void ConfigureDriverFromTestRig(tmc51x0::DriverConfig& cfg, bool use_direct_drive = false) noexcept {
1662 TestRigConfig<test_rig>::ConfigureDriver(cfg, use_direct_drive);
1663}
1664
1673template<TestRigType test_rig>
1675 return GetReferenceSwitchConfig<GetTestRigPlatformType<test_rig>()>();
1676}
1677
1686template<TestRigType test_rig>
1688 return GetEncoderConfig<GetTestRigPlatformType<test_rig>()>();
1689}
1690
1697template<TestRigType test_rig>
1698constexpr uint16_t GetTestRigEncoderPulsesPerRev() noexcept {
1699 return GetEncoderPulsesPerRev<GetTestRigPlatformType<test_rig>()>();
1700}
1701
1708template<TestRigType test_rig>
1709inline bool GetTestRigEncoderInvertDirection() noexcept {
1710 return GetEncoderInvertDirection<GetTestRigPlatformType<test_rig>()>();
1711}
1712
1725template<TestRigType test_rig>
1726constexpr uint16_t GetTestRigMotorOutputFullSteps(bool use_direct_drive = false) noexcept {
1727 return TestRigConfig<test_rig>::GetMotorOutputFullSteps(use_direct_drive);
1728}
1729
1730// ============================================================================
1731// TEST RIG CONFIGURATION TEMPLATE
1732// ============================================================================
1733// Unified template for accessing all configurations (Motor, Board, Platform, Test) for a test rig.
1734// This provides compile-time type-safe access to all configuration values.
1735// NOTE: This is defined after helper functions so they are in scope.
1736
1747template<TestRigType test_rig>
1748struct TestRigConfig;
1749
1755template<>
1757 using Motor = MotorConfig_17HS4401S; // Default to gearbox
1761
1762 // Type info
1763 static constexpr MotorType motor_type = MotorType::MOTOR_17HS4401S_GEARBOX;
1764 static constexpr BoardType board_type = BoardType::BOARD_TMC51x0_EVAL;
1766
1773 static void ConfigureDriver(tmc51x0::DriverConfig& cfg, bool use_direct_drive = false) noexcept {
1774 if (use_direct_drive) {
1776 } else {
1778 }
1779
1780 ApplyBoardConfig<board_type>(cfg);
1781 ApplyPlatformConfig<platform_type>(cfg);
1782
1783 // Configure reference switches and encoder
1784 cfg.reference_switch_config = tmc51x0_test_config::GetReferenceSwitchConfig<platform_type>();
1785 cfg.encoder_config = tmc51x0_test_config::GetEncoderConfig<platform_type>();
1786 cfg.encoder_config.pulses_per_rev = tmc51x0_test_config::GetEncoderPulsesPerRev<platform_type>();
1787 cfg.encoder_config.invert_direction = tmc51x0_test_config::GetEncoderInvertDirection<platform_type>();
1788 }
1789
1796 static constexpr uint16_t GetMotorOutputFullSteps(bool use_direct_drive = false) noexcept {
1797 if (use_direct_drive) {
1799 } else {
1801 }
1802 }
1803
1809 static constexpr tmc51x0::EncoderConfig GetEncoderConfig() noexcept {
1810 return tmc51x0_test_config::GetEncoderConfig<platform_type>();
1811 }
1812
1819 return tmc51x0_test_config::GetReferenceSwitchConfig<platform_type>();
1820 }
1821};
1822
1828template<>
1834
1835 // Type info
1837 static constexpr BoardType board_type = BoardType::BOARD_TMC51x0_EVAL;
1839
1846 static void ConfigureDriver(tmc51x0::DriverConfig& cfg, bool use_direct_drive = false) noexcept {
1847 (void)use_direct_drive; // Unused parameter
1849
1850 ApplyBoardConfig<board_type>(cfg);
1851 ApplyPlatformConfig<platform_type>(cfg);
1852
1853 // Configure reference switches and encoder
1854 cfg.reference_switch_config = tmc51x0_test_config::GetReferenceSwitchConfig<platform_type>();
1855 cfg.encoder_config = tmc51x0_test_config::GetEncoderConfig<platform_type>();
1856 cfg.encoder_config.pulses_per_rev = tmc51x0_test_config::GetEncoderPulsesPerRev<platform_type>();
1857 cfg.encoder_config.invert_direction = tmc51x0_test_config::GetEncoderInvertDirection<platform_type>();
1858 }
1859
1866 static constexpr uint16_t GetMotorOutputFullSteps(bool use_direct_drive = false) noexcept {
1867 (void)use_direct_drive; // Unused parameter
1869 }
1870
1876 static constexpr tmc51x0::EncoderConfig GetEncoderConfig() noexcept {
1877 return tmc51x0_test_config::GetEncoderConfig<platform_type>();
1878 }
1879
1886 return tmc51x0_test_config::GetReferenceSwitchConfig<platform_type>();
1887 }
1888};
1889
1890// ============================================================================
1891// COMPILE-TIME CONFIGURATION VALIDATORS
1892// ============================================================================
1893// Validators to ensure all required configuration values exist at compile time.
1894// These use C++20 requires expressions to check for required members.
1895
1902namespace ConfigValidators {
1903 // Validate MotorConfig_17HS4401S
1904 static_assert(requires {
1929 }, "MotorConfig_17HS4401S is missing required members");
1930
1931 // Validate MotorConfig_17HS4401S_Direct
1932 static_assert(requires {
1957 }, "MotorConfig_17HS4401S_Direct is missing required members");
1958
1959 // Validate MotorConfig_AppliedMotion_5034_369
1960 static_assert(requires {
1985 }, "MotorConfig_AppliedMotion_5034_369 is missing required members");
1986
1987 // Validate BoardConfig_TMC51x0_EVAL
1988 static_assert(requires {
1995 }, "BoardConfig_TMC51x0_EVAL is missing required members");
1996
1997 // Validate BoardConfig_TMC51x0_BOB
1998 static_assert(requires {
2005 }, "BoardConfig_TMC51x0_BOB is missing required members");
2006
2007 // Validate PlatformConfig_CoreDriverTestRig
2008 static_assert(requires {
2029 }, "PlatformConfig_CoreDriverTestRig is missing required members");
2030
2031 // Validate PlatformConfig_FatigueTestRig
2032 static_assert(requires {
2053 }, "PlatformConfig_FatigueTestRig is missing required members");
2054
2055 // Validate TestConfig_17HS4401S
2056 static_assert(requires {
2064 }, "TestConfig_17HS4401S is missing required members");
2065
2066 // Validate TestConfig_AppliedMotion_5034
2067 static_assert(requires {
2075 }, "TestConfig_AppliedMotion_5034 is missing required members");
2076}
2077
2078} // namespace tmc51x0_test_config
Fluent configuration builder for DriverConfig.
Definition tmc51x0_config_builder.hpp:87
ConfigBuilder & WithStallGuardThreshold(int8_t threshold)
Set StallGuard2 threshold (SGT)
Definition tmc51x0_config_builder.hpp:516
ConfigBuilder & WithLeadScrew(float pitch_mm)
Configure lead screw system.
Definition tmc51x0_config_builder.hpp:812
ConfigBuilder & WithShortFilter(uint8_t filter)
Set short detection filter bandwidth.
Definition tmc51x0_config_builder.hpp:310
ConfigBuilder & WithHysteresisEnd(uint8_t hend)
Set hysteresis end value (SpreadCycle mode)
Definition tmc51x0_config_builder.hpp:378
ConfigBuilder & WithStealthChopPwmOfs(uint8_t ofs)
Set StealthChop PWM offset.
Definition tmc51x0_config_builder.hpp:471
ConfigBuilder & WithS2gVoltageMv(uint16_t voltage_mv)
Set short to GND detector voltage threshold.
Definition tmc51x0_config_builder.hpp:299
ConfigBuilder & WithWindingInductanceMh(float inductance_mh)
Set winding inductance value.
Definition tmc51x0_config_builder.hpp:203
ConfigBuilder & WithHoldCurrentMa(uint16_t hold_current_ma)
Set hold current value.
Definition tmc51x0_config_builder.hpp:145
ConfigBuilder & WithStealthChop(bool enable)
Enable/disable StealthChop.
Definition tmc51x0_config_builder.hpp:435
DriverConfig Build() const
Build the final configuration.
Definition tmc51x0_config_builder.hpp:863
ConfigBuilder & WithMicrostepResolution(MicrostepResolution mres)
Set microstep resolution.
Definition tmc51x0_config_builder.hpp:411
ConfigBuilder & WithMotorMa(uint16_t steps_per_rev, uint16_t rated_current_ma)
Configure motor specifications.
Definition tmc51x0_config_builder.hpp:122
ConfigBuilder & WithS2vsVoltageMv(uint16_t voltage_mv)
Set short to VS detector voltage threshold.
Definition tmc51x0_config_builder.hpp:288
ConfigBuilder & WithMotorPowerDownDelayMs(float delay_ms)
Set motor power down delay time.
Definition tmc51x0_config_builder.hpp:218
ConfigBuilder & WithInternalClock()
Use internal clock (12MHz)
Definition tmc51x0_config_builder.hpp:759
ConfigBuilder & WithStealthChopAutoscale(bool enable)
Enable/disable StealthChop PWM autoscale.
Definition tmc51x0_config_builder.hpp:482
ConfigBuilder & WithExternalClockHz(uint32_t frequency_hz)
Use external clock.
Definition tmc51x0_config_builder.hpp:770
ConfigBuilder & WithDirectDrive()
Configure direct drive system.
Definition tmc51x0_config_builder.hpp:782
ConfigBuilder & WithRecalibration(bool enable)
Enable/disable recalibration.
Definition tmc51x0_config_builder.hpp:600
ConfigBuilder & WithStallGuardMinVelocity(float velocity, Unit unit=Unit::RPM)
Set StallGuard2 minimum velocity threshold.
Definition tmc51x0_config_builder.hpp:549
ConfigBuilder & WithChopperToff(uint8_t toff)
Set chopper off-time (TOFF)
Definition tmc51x0_config_builder.hpp:345
ConfigBuilder & WithGearbox(float gear_ratio)
Configure gearbox system.
Definition tmc51x0_config_builder.hpp:797
ConfigBuilder & WithInterpolation(bool enable)
Enable/disable interpolation.
Definition tmc51x0_config_builder.hpp:422
ConfigBuilder & WithOverTempProtection(OverTempProtection protection)
Set over-temperature protection level.
Definition tmc51x0_config_builder.hpp:277
ConfigBuilder & WithMosfetMillerChargeNc(float charge_nc)
Set MOSFET Miller charge.
Definition tmc51x0_config_builder.hpp:244
ConfigBuilder & WithStealthChopStepFilter(bool enable)
Enable/disable StealthChop step filter.
Definition tmc51x0_config_builder.hpp:622
ConfigBuilder & WithHysteresisStart(uint8_t hstrt)
Set hysteresis start value (SpreadCycle mode)
Definition tmc51x0_config_builder.hpp:367
ConfigBuilder & WithDirection(MotorDirection direction)
Set motor direction.
Definition tmc51x0_config_builder.hpp:845
ConfigBuilder & WithStealthChopAutograd(bool enable)
Enable/disable StealthChop PWM autograd.
Definition tmc51x0_config_builder.hpp:493
ConfigBuilder & WithRunCurrentMa(uint16_t run_current_ma)
Set run current value.
Definition tmc51x0_config_builder.hpp:134
ConfigBuilder & WithSenseResistorMohm(uint32_t resistance_mohm)
Set sense resistor value.
Definition tmc51x0_config_builder.hpp:177
ConfigBuilder & WithShortStandstillTimeout(bool enable)
Enable/disable short standstill timeout.
Definition tmc51x0_config_builder.hpp:611
ConfigBuilder & WithWindingResistanceMohm(uint32_t resistance_mohm)
Set winding resistance value.
Definition tmc51x0_config_builder.hpp:190
ConfigBuilder & WithBeltDrive(uint16_t pulley_teeth, float belt_pitch_mm)
Configure belt drive system.
Definition tmc51x0_config_builder.hpp:828
ConfigBuilder & WithStallGuardFilter(bool enable)
Enable/disable StallGuard2 filter.
Definition tmc51x0_config_builder.hpp:530
ConfigBuilder & WithChopperMode(ChopperMode mode)
Set chopper mode.
Definition tmc51x0_config_builder.hpp:334
ConfigBuilder & WithStealthChopThreshold(const VelocityValue &velocity)
Set StealthChop threshold velocity.
Definition tmc51x0_config_builder.hpp:448
ConfigBuilder & WithStartSpeed(const VelocityValue &velocity)
Set start velocity.
Definition tmc51x0_config_builder.hpp:678
ConfigBuilder & WithSupplyVoltageMv(uint32_t voltage_mv)
Set supply voltage value.
Definition tmc51x0_config_builder.hpp:160
ConfigBuilder & WithZeroWaitTimeMs(float wait_ms)
Set zero velocity wait time.
Definition tmc51x0_config_builder.hpp:747
ConfigBuilder & WithChopperBlankTime(ChopperBlankTime blank_time)
Set chopper blank time.
Definition tmc51x0_config_builder.hpp:356
ConfigBuilder & WithBbmTimeNs(uint32_t time_ns)
Set Break Before Make time.
Definition tmc51x0_config_builder.hpp:255
ConfigBuilder & WithSenseFilter(SenseFilterTime filter_time)
Set sense amplifier filter time.
Definition tmc51x0_config_builder.hpp:266
ESP32-specific communication interfaces for TMC51x0 using SPI and UART (TMC5130 & TMC51x0)
Definition esp32_tmc51x0_test_config.hpp:136
constexpr gpio_num_t CLK
Clock input pin (CLK, pin 12)
Definition esp32_tmc51x0_test_config.hpp:152
void ConfigureDriverFromTestRig(tmc51x0::DriverConfig &cfg, bool use_direct_drive=false) noexcept
Configure driver from test rig selection.
Definition esp32_tmc51x0_test_config.hpp:1661
constexpr uint16_t GetTestRigMotorOutputFullSteps(bool use_direct_drive=false) noexcept
Get motor output full steps per revolution for a test rig.
Definition esp32_tmc51x0_test_config.hpp:1726
void ConfigureDriverFromMotor_17HS4401S_Gearbox(tmc51x0::DriverConfig &cfg) noexcept
Helper function to populate DriverConfig from 17HS4401S gearbox motor configuration.
Definition esp32_tmc51x0_test_config.hpp:1078
constexpr BoardType GetTestRigBoardType() noexcept
Get board type for a given test rig.
Definition esp32_tmc51x0_test_config.hpp:1493
tmc51x0::EncoderConfig GetEncoderConfig() noexcept
Helper function to configure encoder from platform config.
Definition esp32_tmc51x0_test_config.hpp:1407
constexpr uint32_t SPI_CLOCK_SPEED_HZ
SPI clock speed.
Definition esp32_tmc51x0_test_config.hpp:167
tmc51x0::EncoderConfig GetTestRigEncoderConfig() noexcept
Get encoder configuration for a test rig.
Definition esp32_tmc51x0_test_config.hpp:1687
void ConfigureDriverFromMotor_AppliedMotion_5034(tmc51x0::DriverConfig &cfg) noexcept
Helper function to populate DriverConfig from Applied Motion 5034 motor configuration.
Definition esp32_tmc51x0_test_config.hpp:1228
tmc51x0::ReferenceSwitchConfig GetTestRigReferenceSwitchConfig() noexcept
Get reference switch configuration for a test rig.
Definition esp32_tmc51x0_test_config.hpp:1674
constexpr gpio_num_t SPI_MOSI
SPI MOSI (master out, slave in)
Definition esp32_tmc51x0_test_config.hpp:146
constexpr gpio_num_t DIR
Direction pin (optional)
Definition esp32_tmc51x0_test_config.hpp:163
constexpr gpio_num_t SPI_MODE_PIN
SPI_MODE pin (pin 22) - GPIO0 if available as control pin.
Definition esp32_tmc51x0_test_config.hpp:155
constexpr PlatformType GetTestRigPlatformType() noexcept
Get platform type for a given test rig.
Definition esp32_tmc51x0_test_config.hpp:1510
void ConfigureDriverFromMotor_17HS4401S_Direct(tmc51x0::DriverConfig &cfg) noexcept
Helper function to populate DriverConfig from 17HS4401S direct drive motor configuration.
Definition esp32_tmc51x0_test_config.hpp:1153
constexpr gpio_num_t SPI_CS
SPI chip select pin.
Definition esp32_tmc51x0_test_config.hpp:148
BoardType
Board type enumeration.
Definition esp32_tmc51x0_test_config.hpp:279
@ BOARD_TMC51x0_BOB
TMC51x0 Break-Out Board (0.11Ω sense, 24V, typical MOSFETs)
@ BOARD_TMC51x0_EVAL
TMC51x0 Evaluation Kit (0.05Ω sense, 24V, BSC072N08NS5 MOSFETs)
constexpr spi_host_device_t SPI_HOST
SPI host device.
Definition esp32_tmc51x0_test_config.hpp:168
constexpr uint16_t GetEncoderPulsesPerRev() noexcept
Helper function to get encoder pulses per revolution from platform config.
Definition esp32_tmc51x0_test_config.hpp:1440
constexpr gpio_num_t STEP
Step pin (optional)
Definition esp32_tmc51x0_test_config.hpp:164
bool GetEncoderInvertDirection() noexcept
Helper function to get encoder invert direction flag from platform config.
Definition esp32_tmc51x0_test_config.hpp:1458
typename TestRigConfig< test_rig >::Test GetTestConfigForTestRig
Get test configuration accessor for a given test rig.
Definition esp32_tmc51x0_test_config.hpp:1642
constexpr gpio_num_t DIAG1
Diagnostic output 1 (DIAG1_SWP, pin 27)
Definition esp32_tmc51x0_test_config.hpp:160
void ApplyPlatformConfig(tmc51x0::DriverConfig &cfg) noexcept
Helper function to apply platform configuration to DriverConfig.
Definition esp32_tmc51x0_test_config.hpp:1312
tmc51x0::ReferenceSwitchConfig GetReferenceSwitchConfig() noexcept
Helper function to configure reference switches from platform config.
Definition esp32_tmc51x0_test_config.hpp:1368
MotorType
Motor type enumeration for compile-time motor selection.
Definition esp32_tmc51x0_test_config.hpp:266
@ MOTOR_17HS4401S_DIRECT
17HS4401S direct drive (no gearbox)
@ MOTOR_17HS4401S_GEARBOX
17HS4401S with 5.18:1 planetary gearbox
@ MOTOR_APPLIED_MOTION_5034
Applied Motion 5034-369 NEMA 34 (high torque)
constexpr MotorType GetTestRigMotorType() noexcept
Get motor type for a given test rig.
Definition esp32_tmc51x0_test_config.hpp:1476
constexpr gpio_num_t SPI_SCK
SPI clock pin.
Definition esp32_tmc51x0_test_config.hpp:145
constexpr uint16_t GetTestRigEncoderPulsesPerRev() noexcept
Get encoder pulses per revolution for a test rig.
Definition esp32_tmc51x0_test_config.hpp:1698
constexpr gpio_num_t DIAG0
Diagnostic output 0 (DIAG0_SWN, pin 26)
Definition esp32_tmc51x0_test_config.hpp:159
void ApplyBoardConfig(tmc51x0::DriverConfig &cfg) noexcept
Helper function to apply board configuration to DriverConfig.
Definition esp32_tmc51x0_test_config.hpp:1024
constexpr gpio_num_t SPI_MISO
SPI MISO (master in, slave out)
Definition esp32_tmc51x0_test_config.hpp:147
TestRigType
Test rig type enumeration.
Definition esp32_tmc51x0_test_config.hpp:325
@ TEST_RIG_CORE_DRIVER
Core driver test rig (17HS4401S motor, TMC51x0 EVAL board, reference switches, encoder)
@ TEST_RIG_FATIGUE
Fatigue test rig (Applied Motion 5034-369 motor, TMC51x0 EVAL board, reference switches,...
constexpr gpio_num_t SD_MODE_PIN
SD_MODE pin (pin 21) - GPIO1 if available as control pin.
Definition esp32_tmc51x0_test_config.hpp:156
bool GetTestRigEncoderInvertDirection() noexcept
Get encoder invert direction flag for a test rig.
Definition esp32_tmc51x0_test_config.hpp:1709
Esp32SpiPinConfig GetDefaultPinConfig() noexcept
Complete pin configuration for all tests.
Definition esp32_tmc51x0_test_config.hpp:177
constexpr gpio_num_t DRV_EN
Driver enable pin (DRV_ENN)
Definition esp32_tmc51x0_test_config.hpp:151
PlatformType
Platform type enumeration.
Definition esp32_tmc51x0_test_config.hpp:294
@ PLATFORM_CORE_DRIVER_TEST_RIG
Core driver test rig (gearbox motor, reference switches, encoder)
@ PLATFORM_FATIGUE_TEST_RIG
Fatigue test rig (Applied Motion motor, reference switches, encoder)
MicrostepResolution
Microstep resolution enumeration.
Definition tmc51x0_types.hpp:707
@ MRES_256
256 microsteps per full step (highest resolution)
@ Temp150C
150°C threshold (lowest protection, highest temperature)
ChopperBlankTime
Comparator blank time enumeration.
Definition tmc51x0_types.hpp:692
EncoderNSensitivity
Encoder N channel sensitivity enumeration.
Definition tmc51x0_types.hpp:2383
EncoderClearMode
Encoder clear mode enumeration.
Definition tmc51x0_types.hpp:2417
MechanicalSystemType
Mechanical system type enumeration.
Definition tmc51x0_types.hpp:259
@ Gearbox
Gearbox reduction.
@ LeadScrew
Lead screw drive.
@ BeltDrive
Belt drive with pulleys.
@ DirectDrive
Direct drive (motor shaft directly connected)
ReferenceStopMode
Stop mode enumeration.
Definition tmc51x0_types.hpp:2288
ReferenceLatchMode
Position latching mode enumeration.
Definition tmc51x0_types.hpp:2255
@ RevPerSec
Revolutions per Second (recommended default for velocity)
@ RPM
Revolutions per Minute (Velocity only, typically)
MotorDirection
Motor direction enumeration.
Definition tmc51x0_types.hpp:95
@ INVERSE
Inverse motor direction.
@ NORMAL
Normal motor direction.
EncoderPrescalerMode
Encoder prescaler mode enumeration.
Definition tmc51x0_types.hpp:2448
ReferenceSwitchActiveLevel
Reference switch active level enumeration.
Definition tmc51x0_types.hpp:2225
@ T100ns
~100ns (reset default)
@ SPREAD_CYCLE
SpreadCycle mode (recommended) - superior microstepping quality.
Complete ESP32 SPI bus and TMC51x0 pin configuration structure.
Definition esp32_tmc51x0_bus.hpp:56
int spi_mosi
SPI MOSI pin (Master Out, Slave In)
Definition esp32_tmc51x0_bus.hpp:58
Driver initialization configuration structure.
Definition tmc51x0_types.hpp:2870
ReferenceSwitchConfig reference_switch_config
Reference switch configuration (defaults: stop disabled, latching disabled)
Definition tmc51x0_types.hpp:2894
EncoderConfig encoder_config
Encoder configuration (includes pulses per rev, invert direction, deviation)
Definition tmc51x0_types.hpp:2895
Encoder configuration structure.
Definition tmc51x0_types.hpp:2479
uint16_t pulses_per_rev
Encoder pulses per revolution.
Definition tmc51x0_types.hpp:2543
bool invert_direction
Invert encoder direction.
Definition tmc51x0_types.hpp:2555
ReferenceSwitchActiveLevel n_channel_active
Definition tmc51x0_types.hpp:2482
Reference switch configuration structure.
Definition tmc51x0_types.hpp:2327
ReferenceSwitchActiveLevel left_switch_active
Definition tmc51x0_types.hpp:2331
Board hardware configuration for TMC51x0 Break-Out Board (BOB)
Definition esp32_tmc51x0_test_config.hpp:821
static constexpr uint32_t BBM_TIME_NS
Break-before-make time in nanoseconds (~200ns for typical MOSFETs)
Definition esp32_tmc51x0_test_config.hpp:828
static constexpr float MOSFET_MILLER_CHARGE_NC
MOSFET Miller charge in nC (~30nC for typical BOB MOSFETs)
Definition esp32_tmc51x0_test_config.hpp:827
static constexpr uint16_t S2VS_VOLTAGE_MV
Short to VS voltage threshold in mV (0 = auto = 625mV)
Definition esp32_tmc51x0_test_config.hpp:832
static constexpr uint32_t SENSE_RESISTOR_MOHM
Sense resistor value in milliohms (0.11Ω - typical for BOB)
Definition esp32_tmc51x0_test_config.hpp:823
static constexpr uint32_t CLOCK_FREQUENCY_HZ
TMC51x0 clock frequency in Hz (0 = use internal 12 MHz oscillator, CLK pin tied to GND)
Definition esp32_tmc51x0_test_config.hpp:824
static constexpr uint16_t S2G_VOLTAGE_MV
Short to GND voltage threshold in mV (0 = auto = 625mV)
Definition esp32_tmc51x0_test_config.hpp:833
Board hardware configuration for TMC51x0 Evaluation Kit.
Definition esp32_tmc51x0_test_config.hpp:786
static constexpr float MOSFET_MILLER_CHARGE_NC
MOSFET Miller charge in nC (<10nC for BSC072N08NS5)
Definition esp32_tmc51x0_test_config.hpp:792
static constexpr uint32_t CLOCK_FREQUENCY_HZ
TMC51x0 clock frequency in Hz (0 = use internal 12 MHz oscillator, CLK pin tied to GND)
Definition esp32_tmc51x0_test_config.hpp:789
static constexpr uint16_t S2VS_VOLTAGE_MV
Short to VS voltage threshold in mV (0 = auto = 625mV)
Definition esp32_tmc51x0_test_config.hpp:797
static constexpr uint16_t S2G_VOLTAGE_MV
Short to GND voltage threshold in mV (0 = auto = 625mV)
Definition esp32_tmc51x0_test_config.hpp:798
static constexpr uint32_t BBM_TIME_NS
Break-before-make time in nanoseconds (~100ns for fast MOSFETs)
Definition esp32_tmc51x0_test_config.hpp:793
static constexpr uint32_t SENSE_RESISTOR_MOHM
Sense resistor value in milliohms (0.05Ω)
Definition esp32_tmc51x0_test_config.hpp:788
Motor Configuration for 17HS4401S NEMA 17 Stepper Motor (DIRECT DRIVE, NO GEARBOX)
Definition esp32_tmc51x0_test_config.hpp:464
static constexpr tmc51x0::MicrostepResolution MRES
Definition esp32_tmc51x0_test_config.hpp:486
static constexpr float STEALTH_VELOCITY_THRESHOLD_RPM
Definition esp32_tmc51x0_test_config.hpp:543
static constexpr float RAMP_AMAX_REV_S2
Definition esp32_tmc51x0_test_config.hpp:519
static constexpr uint8_t TOFF
Definition esp32_tmc51x0_test_config.hpp:494
static constexpr uint8_t STEALTH_OFS
Definition esp32_tmc51x0_test_config.hpp:506
static constexpr uint32_t SUPPLY_VOLTAGE_MV
Definition esp32_tmc51x0_test_config.hpp:472
static constexpr float RAMP_TZEROWAIT_MS
Definition esp32_tmc51x0_test_config.hpp:531
static constexpr uint16_t MOTOR_FULL_STEPS
Definition esp32_tmc51x0_test_config.hpp:470
static constexpr float RAMP_TPOWERDOWN_MS
Definition esp32_tmc51x0_test_config.hpp:530
static constexpr bool INTERPOLATION
Definition esp32_tmc51x0_test_config.hpp:487
static constexpr float RAMP_D1_REV_S2
Definition esp32_tmc51x0_test_config.hpp:523
static constexpr uint16_t TARGET_RUN_CURRENT_MA
Definition esp32_tmc51x0_test_config.hpp:480
static constexpr float RAMP_VMAX_RPM
Definition esp32_tmc51x0_test_config.hpp:517
static constexpr uint8_t HEND
Definition esp32_tmc51x0_test_config.hpp:495
static constexpr uint8_t HSTRT
Definition esp32_tmc51x0_test_config.hpp:496
static constexpr uint16_t OUTPUT_FULL_STEPS
Definition esp32_tmc51x0_test_config.hpp:471
static constexpr bool STEALTH_AUTOSCALE
Definition esp32_tmc51x0_test_config.hpp:503
static constexpr uint16_t TARGET_HOLD_CURRENT_MA
Definition esp32_tmc51x0_test_config.hpp:481
static constexpr float RAMP_V1_RPM
Definition esp32_tmc51x0_test_config.hpp:529
static constexpr uint8_t STEALTH_FREQ
Definition esp32_tmc51x0_test_config.hpp:505
static constexpr float INDUCTANCE_MH
Definition esp32_tmc51x0_test_config.hpp:468
static constexpr float RAMP_DMAX_REV_S2
Definition esp32_tmc51x0_test_config.hpp:520
static constexpr uint32_t RESISTANCE_MOHM
Definition esp32_tmc51x0_test_config.hpp:467
static constexpr float RAMP_VSTART_RPM
Definition esp32_tmc51x0_test_config.hpp:512
static constexpr float GEAR_RATIO
Definition esp32_tmc51x0_test_config.hpp:469
static constexpr float IHOLDDELAY_MS
Definition esp32_tmc51x0_test_config.hpp:537
static constexpr uint8_t TBL
Definition esp32_tmc51x0_test_config.hpp:497
static constexpr uint16_t RATED_CURRENT_MA
Definition esp32_tmc51x0_test_config.hpp:466
static constexpr float RAMP_VSTOP_RPM
Definition esp32_tmc51x0_test_config.hpp:514
static constexpr bool STEALTH_AUTOGRAD
Definition esp32_tmc51x0_test_config.hpp:504
static constexpr float RAMP_A1_REV_S2
Definition esp32_tmc51x0_test_config.hpp:522
Motor Configuration for 17HS4401S-PG518 NEMA 17 Stepper Motor (WITH GEARBOX)
Definition esp32_tmc51x0_test_config.hpp:354
static constexpr float INDUCTANCE_MH
Definition esp32_tmc51x0_test_config.hpp:358
static constexpr uint8_t HSTRT
Definition esp32_tmc51x0_test_config.hpp:390
static constexpr float RAMP_DMAX_REV_S2
Definition esp32_tmc51x0_test_config.hpp:418
static constexpr float RAMP_VSTART_RPM
Definition esp32_tmc51x0_test_config.hpp:407
static constexpr float RAMP_TZEROWAIT_MS
Definition esp32_tmc51x0_test_config.hpp:433
static constexpr float GEAR_RATIO
Definition esp32_tmc51x0_test_config.hpp:359
static constexpr float RAMP_AMAX_REV_S2
Definition esp32_tmc51x0_test_config.hpp:416
static constexpr uint8_t STEALTH_FREQ
Definition esp32_tmc51x0_test_config.hpp:399
static constexpr uint16_t TARGET_RUN_CURRENT_MA
Definition esp32_tmc51x0_test_config.hpp:373
static constexpr float RAMP_VSTOP_RPM
Definition esp32_tmc51x0_test_config.hpp:410
static constexpr float RAMP_VMAX_RPM
Definition esp32_tmc51x0_test_config.hpp:413
static constexpr bool INTERPOLATION
Definition esp32_tmc51x0_test_config.hpp:381
static constexpr uint16_t TARGET_HOLD_CURRENT_MA
Definition esp32_tmc51x0_test_config.hpp:374
static constexpr tmc51x0::MicrostepResolution MRES
Definition esp32_tmc51x0_test_config.hpp:380
static constexpr uint32_t SUPPLY_VOLTAGE_MV
Definition esp32_tmc51x0_test_config.hpp:364
static constexpr float RAMP_V1_RPM
Definition esp32_tmc51x0_test_config.hpp:429
static constexpr bool STEALTH_AUTOSCALE
Definition esp32_tmc51x0_test_config.hpp:397
static constexpr uint16_t OUTPUT_FULL_STEPS
Definition esp32_tmc51x0_test_config.hpp:363
static constexpr uint16_t RATED_CURRENT_MA
Definition esp32_tmc51x0_test_config.hpp:356
static constexpr uint8_t STEALTH_OFS
Definition esp32_tmc51x0_test_config.hpp:400
static constexpr uint8_t TOFF
Definition esp32_tmc51x0_test_config.hpp:388
static constexpr uint32_t RESISTANCE_MOHM
Definition esp32_tmc51x0_test_config.hpp:357
static constexpr float RAMP_D1_REV_S2
Definition esp32_tmc51x0_test_config.hpp:423
static constexpr float IHOLDDELAY_MS
Definition esp32_tmc51x0_test_config.hpp:439
static constexpr uint8_t HEND
Definition esp32_tmc51x0_test_config.hpp:389
static constexpr uint8_t TBL
Definition esp32_tmc51x0_test_config.hpp:391
static constexpr float STEALTH_VELOCITY_THRESHOLD_RPM
Definition esp32_tmc51x0_test_config.hpp:445
static constexpr float RAMP_A1_REV_S2
Definition esp32_tmc51x0_test_config.hpp:421
static constexpr float RAMP_TPOWERDOWN_MS
Definition esp32_tmc51x0_test_config.hpp:431
static constexpr uint16_t MOTOR_FULL_STEPS
Definition esp32_tmc51x0_test_config.hpp:360
static constexpr bool STEALTH_AUTOGRAD
Definition esp32_tmc51x0_test_config.hpp:398
Motor Configuration for Applied Motion 5034-369 NEMA 34 Stepper Motor.
Definition esp32_tmc51x0_test_config.hpp:567
static constexpr uint8_t STEALTH_OFS
Definition esp32_tmc51x0_test_config.hpp:611
static constexpr uint16_t MOTOR_FULL_STEPS
Definition esp32_tmc51x0_test_config.hpp:571
static constexpr bool STEALTH_AUTOSCALE
Definition esp32_tmc51x0_test_config.hpp:608
static constexpr float RAMP_AMAX_REV_S2
Definition esp32_tmc51x0_test_config.hpp:626
static constexpr float RAMP_DMAX_REV_S2
Definition esp32_tmc51x0_test_config.hpp:627
static constexpr float RAMP_D1_REV_S2
Definition esp32_tmc51x0_test_config.hpp:630
static constexpr uint8_t TBL
Definition esp32_tmc51x0_test_config.hpp:601
static constexpr float STEALTH_VELOCITY_THRESHOLD_RPM
Definition esp32_tmc51x0_test_config.hpp:651
static constexpr float RAMP_VSTART_RPM
Definition esp32_tmc51x0_test_config.hpp:618
static constexpr float IHOLDDELAY_MS
Definition esp32_tmc51x0_test_config.hpp:645
static constexpr uint16_t TARGET_HOLD_CURRENT_MA
Definition esp32_tmc51x0_test_config.hpp:585
static constexpr float GEAR_RATIO
Definition esp32_tmc51x0_test_config.hpp:570
static constexpr uint8_t TOFF
Definition esp32_tmc51x0_test_config.hpp:598
static constexpr uint8_t HSTRT
Definition esp32_tmc51x0_test_config.hpp:600
static constexpr bool INTERPOLATION
Definition esp32_tmc51x0_test_config.hpp:591
static constexpr bool STEALTH_AUTOGRAD
Definition esp32_tmc51x0_test_config.hpp:609
static constexpr tmc51x0::MicrostepResolution MRES
Definition esp32_tmc51x0_test_config.hpp:590
static constexpr float RAMP_TZEROWAIT_MS
Definition esp32_tmc51x0_test_config.hpp:638
static constexpr uint32_t SUPPLY_VOLTAGE_MV
Definition esp32_tmc51x0_test_config.hpp:577
static constexpr float RAMP_A1_REV_S2
Definition esp32_tmc51x0_test_config.hpp:629
static constexpr float RAMP_V1_RPM
Definition esp32_tmc51x0_test_config.hpp:636
static constexpr uint16_t OUTPUT_FULL_STEPS
Definition esp32_tmc51x0_test_config.hpp:574
static constexpr uint16_t TARGET_RUN_CURRENT_MA
Definition esp32_tmc51x0_test_config.hpp:584
static constexpr float RAMP_TPOWERDOWN_MS
Definition esp32_tmc51x0_test_config.hpp:637
static constexpr uint32_t RESISTANCE_MOHM
Definition esp32_tmc51x0_test_config.hpp:575
static constexpr float RAMP_VMAX_RPM
Definition esp32_tmc51x0_test_config.hpp:623
static constexpr float RAMP_VSTOP_RPM
Definition esp32_tmc51x0_test_config.hpp:620
static constexpr uint8_t STEALTH_FREQ
Definition esp32_tmc51x0_test_config.hpp:610
static constexpr uint16_t RATED_CURRENT_MA
Definition esp32_tmc51x0_test_config.hpp:569
static constexpr float INDUCTANCE_MH
Definition esp32_tmc51x0_test_config.hpp:576
static constexpr uint8_t HEND
Definition esp32_tmc51x0_test_config.hpp:599
Definition esp32_tmc51x0_test_config.hpp:880
static constexpr uint16_t PULSES_PER_REV
Encoder pulses per revolution (ABI mode)
Definition esp32_tmc51x0_test_config.hpp:884
static constexpr int32_t ALLOWED_DEVIATION_STEPS
Allowed encoder deviation in steps (0 = disabled)
Definition esp32_tmc51x0_test_config.hpp:899
static constexpr bool INVERT_DIRECTION
Invert encoder direction (false = match motor)
Definition esp32_tmc51x0_test_config.hpp:894
static constexpr tmc51x0::EncoderClearMode CLEAR_MODE
Encoder clear mode (DISABLED = no clearing)
Definition esp32_tmc51x0_test_config.hpp:890
static constexpr tmc51x0::EncoderPrescalerMode PRESCALER_MODE
Prescaler mode (BINARY typical)
Definition esp32_tmc51x0_test_config.hpp:892
static constexpr tmc51x0::ReferenceSwitchActiveLevel N_CHANNEL_ACTIVE
N channel active level.
Definition esp32_tmc51x0_test_config.hpp:886
static constexpr uint16_t COUNTS_PER_REV
Encoder counts per revolution (edges)
Definition esp32_tmc51x0_test_config.hpp:885
static constexpr tmc51x0::EncoderNSensitivity N_SENSITIVITY
N channel sensitivity (RISING_EDGE typical)
Definition esp32_tmc51x0_test_config.hpp:888
Definition esp32_tmc51x0_test_config.hpp:903
static constexpr float LEAD_SCREW_PITCH_MM
Lead screw pitch in mm (0 = not used)
Definition esp32_tmc51x0_test_config.hpp:909
static constexpr tmc51x0::MotorDirection MOTOR_DIRECTION
Definition esp32_tmc51x0_test_config.hpp:916
static constexpr tmc51x0::MechanicalSystemType SYSTEM_TYPE
Mechanical system type (Gearbox, DirectDrive, LeadScrew, BeltDrive)
Definition esp32_tmc51x0_test_config.hpp:907
static constexpr uint16_t BELT_PULLEY_TEETH
Number of teeth on motor pulley (0 = not used)
Definition esp32_tmc51x0_test_config.hpp:910
static constexpr float BELT_PITCH_MM
Belt pitch in mm (0 = not used)
Definition esp32_tmc51x0_test_config.hpp:911
static constexpr tmc51x0::ReferenceSwitchActiveLevel LEFT_ACTIVE_LEVEL
Left switch active level (ACTIVE_LOW for GND-triggered)
Definition esp32_tmc51x0_test_config.hpp:865
static constexpr tmc51x0::ReferenceLatchMode RIGHT_LATCH_MODE
Right switch latch mode (ACTIVE_EDGE for homing)
Definition esp32_tmc51x0_test_config.hpp:873
static constexpr bool LEFT_STOP_ENABLE
Enable motor stop on left switch.
Definition esp32_tmc51x0_test_config.hpp:869
static constexpr bool RIGHT_STOP_ENABLE
Enable motor stop on right switch.
Definition esp32_tmc51x0_test_config.hpp:870
static constexpr tmc51x0::ReferenceLatchMode LEFT_LATCH_MODE
Left switch latch mode (ACTIVE_EDGE for homing)
Definition esp32_tmc51x0_test_config.hpp:871
static constexpr tmc51x0::ReferenceStopMode STOP_MODE
Stop mode (SOFT_STOP for controlled deceleration)
Definition esp32_tmc51x0_test_config.hpp:875
static constexpr tmc51x0::ReferenceSwitchActiveLevel RIGHT_ACTIVE_LEVEL
Right switch active level (ACTIVE_LOW for GND-triggered)
Definition esp32_tmc51x0_test_config.hpp:867
Platform configuration for Core Driver Test Rig.
Definition esp32_tmc51x0_test_config.hpp:859
Definition esp32_tmc51x0_test_config.hpp:957
static constexpr tmc51x0::ReferenceSwitchActiveLevel N_CHANNEL_ACTIVE
N channel active level.
Definition esp32_tmc51x0_test_config.hpp:963
static constexpr uint16_t COUNTS_PER_REV
Encoder counts per revolution (edges)
Definition esp32_tmc51x0_test_config.hpp:962
static constexpr uint16_t PULSES_PER_REV
Encoder pulses per revolution (ABI mode)
Definition esp32_tmc51x0_test_config.hpp:961
static constexpr tmc51x0::EncoderPrescalerMode PRESCALER_MODE
Prescaler mode (BINARY typical)
Definition esp32_tmc51x0_test_config.hpp:969
static constexpr int32_t ALLOWED_DEVIATION_STEPS
Allowed encoder deviation in steps (0 = disabled)
Definition esp32_tmc51x0_test_config.hpp:976
static constexpr bool INVERT_DIRECTION
Invert encoder direction (false = match motor)
Definition esp32_tmc51x0_test_config.hpp:971
static constexpr tmc51x0::EncoderClearMode CLEAR_MODE
Encoder clear mode (DISABLED = no clearing)
Definition esp32_tmc51x0_test_config.hpp:967
static constexpr tmc51x0::EncoderNSensitivity N_SENSITIVITY
N channel sensitivity (RISING_EDGE typical)
Definition esp32_tmc51x0_test_config.hpp:965
Definition esp32_tmc51x0_test_config.hpp:980
static constexpr tmc51x0::MechanicalSystemType SYSTEM_TYPE
Mechanical system type (DirectDrive for Applied Motion motor)
Definition esp32_tmc51x0_test_config.hpp:982
static constexpr tmc51x0::MotorDirection MOTOR_DIRECTION
Definition esp32_tmc51x0_test_config.hpp:990
static constexpr float BELT_PITCH_MM
Belt pitch in mm (0 = not used)
Definition esp32_tmc51x0_test_config.hpp:986
static constexpr uint16_t BELT_PULLEY_TEETH
Number of teeth on motor pulley (0 = not used)
Definition esp32_tmc51x0_test_config.hpp:985
static constexpr float LEAD_SCREW_PITCH_MM
Lead screw pitch in mm (0 = not used)
Definition esp32_tmc51x0_test_config.hpp:984
static constexpr tmc51x0::ReferenceLatchMode RIGHT_LATCH_MODE
Right switch latch mode (ACTIVE_EDGE for homing)
Definition esp32_tmc51x0_test_config.hpp:950
static constexpr bool LEFT_STOP_ENABLE
Enable motor stop on left switch.
Definition esp32_tmc51x0_test_config.hpp:946
static constexpr tmc51x0::ReferenceStopMode STOP_MODE
Stop mode (SOFT_STOP for controlled deceleration)
Definition esp32_tmc51x0_test_config.hpp:952
static constexpr bool RIGHT_STOP_ENABLE
Enable motor stop on right switch.
Definition esp32_tmc51x0_test_config.hpp:947
static constexpr tmc51x0::ReferenceLatchMode LEFT_LATCH_MODE
Left switch latch mode (ACTIVE_EDGE for homing)
Definition esp32_tmc51x0_test_config.hpp:948
static constexpr tmc51x0::ReferenceSwitchActiveLevel RIGHT_ACTIVE_LEVEL
Right switch active level (ACTIVE_LOW for GND-triggered)
Definition esp32_tmc51x0_test_config.hpp:944
static constexpr tmc51x0::ReferenceSwitchActiveLevel LEFT_ACTIVE_LEVEL
Left switch active level (ACTIVE_LOW for GND-triggered)
Definition esp32_tmc51x0_test_config.hpp:942
Platform configuration for Fatigue Test Rig.
Definition esp32_tmc51x0_test_config.hpp:936
Definition esp32_tmc51x0_test_config.hpp:1588
static constexpr uint32_t HOMING_TIMEOUT_MS
Definition esp32_tmc51x0_test_config.hpp:1615
static constexpr float BOUNDS_SEARCH_ACCEL_REV_S2
Definition esp32_tmc51x0_test_config.hpp:1604
static constexpr float BOUNDS_SEARCH_SPEED_RPM
Definition esp32_tmc51x0_test_config.hpp:1593
Definition esp32_tmc51x0_test_config.hpp:1529
static constexpr int8_t SGT_HOMING
Definition esp32_tmc51x0_test_config.hpp:1530
static constexpr uint8_t SEMAX
Definition esp32_tmc51x0_test_config.hpp:1563
static constexpr uint8_t SEMIN
Definition esp32_tmc51x0_test_config.hpp:1552
static constexpr float MIN_VELOCITY_RPM
Definition esp32_tmc51x0_test_config.hpp:1575
static constexpr bool FILTER_ENABLED
Definition esp32_tmc51x0_test_config.hpp:1541
Test configuration accessor struct.
Definition esp32_tmc51x0_test_config.hpp:1527
Definition esp32_tmc51x0_test_config.hpp:665
static constexpr float BOUNDS_SEARCH_ACCEL_REV_S2
Definition esp32_tmc51x0_test_config.hpp:674
static constexpr uint32_t HOMING_TIMEOUT_MS
Definition esp32_tmc51x0_test_config.hpp:677
static constexpr float BOUNDS_SEARCH_SPEED_RPM
Definition esp32_tmc51x0_test_config.hpp:670
Definition esp32_tmc51x0_test_config.hpp:681
static constexpr uint8_t SEMIN
Definition esp32_tmc51x0_test_config.hpp:701
static constexpr float MIN_VELOCITY_RPM
Definition esp32_tmc51x0_test_config.hpp:706
static constexpr float STALL_DETECTION_CURRENT_FACTOR
Definition esp32_tmc51x0_test_config.hpp:711
static constexpr float SGT_TUNED_AT_VELOCITY_RPM
Definition esp32_tmc51x0_test_config.hpp:690
static constexpr uint8_t SEMAX
Definition esp32_tmc51x0_test_config.hpp:702
static constexpr float TUNING_MAX_VELOCITY_RPM
Definition esp32_tmc51x0_test_config.hpp:692
static constexpr bool FILTER_ENABLED
Definition esp32_tmc51x0_test_config.hpp:696
static constexpr int8_t SGT_HOMING
Definition esp32_tmc51x0_test_config.hpp:686
static constexpr float TUNING_MIN_VELOCITY_RPM
Definition esp32_tmc51x0_test_config.hpp:691
Test Rig Configuration Defaults.
Definition esp32_tmc51x0_test_config.hpp:663
Definition esp32_tmc51x0_test_config.hpp:723
static constexpr float BOUNDS_SEARCH_ACCEL_REV_S2
Definition esp32_tmc51x0_test_config.hpp:730
static constexpr uint32_t HOMING_TIMEOUT_MS
Definition esp32_tmc51x0_test_config.hpp:733
static constexpr float BOUNDS_SEARCH_SPEED_RPM
Definition esp32_tmc51x0_test_config.hpp:727
Definition esp32_tmc51x0_test_config.hpp:737
static constexpr float STALL_DETECTION_CURRENT_FACTOR
Definition esp32_tmc51x0_test_config.hpp:758
static constexpr uint8_t SEMIN
Definition esp32_tmc51x0_test_config.hpp:750
static constexpr bool FILTER_ENABLED
Definition esp32_tmc51x0_test_config.hpp:749
static constexpr float TUNING_MIN_VELOCITY_RPM
Definition esp32_tmc51x0_test_config.hpp:744
static constexpr float TUNING_MAX_VELOCITY_RPM
Definition esp32_tmc51x0_test_config.hpp:745
static constexpr float MIN_VELOCITY_RPM
Definition esp32_tmc51x0_test_config.hpp:754
static constexpr uint8_t SEMAX
Definition esp32_tmc51x0_test_config.hpp:751
static constexpr int8_t SGT_HOMING
Definition esp32_tmc51x0_test_config.hpp:740
static constexpr float SGT_TUNED_AT_VELOCITY_RPM
Definition esp32_tmc51x0_test_config.hpp:743
Test Configuration for Applied Motion 5034-369 Motor.
Definition esp32_tmc51x0_test_config.hpp:721
static constexpr tmc51x0::EncoderConfig GetEncoderConfig() noexcept
Get encoder configuration.
Definition esp32_tmc51x0_test_config.hpp:1809
static constexpr uint16_t GetMotorOutputFullSteps(bool use_direct_drive=false) noexcept
Get motor output full steps per revolution.
Definition esp32_tmc51x0_test_config.hpp:1796
static constexpr tmc51x0::ReferenceSwitchConfig GetReferenceSwitchConfig() noexcept
Get reference switch configuration.
Definition esp32_tmc51x0_test_config.hpp:1818
static void ConfigureDriver(tmc51x0::DriverConfig &cfg, bool use_direct_drive=false) noexcept
Configure driver from this test rig's configuration.
Definition esp32_tmc51x0_test_config.hpp:1773
static constexpr tmc51x0::ReferenceSwitchConfig GetReferenceSwitchConfig() noexcept
Get reference switch configuration.
Definition esp32_tmc51x0_test_config.hpp:1885
static void ConfigureDriver(tmc51x0::DriverConfig &cfg, bool use_direct_drive=false) noexcept
Configure driver from this test rig's configuration.
Definition esp32_tmc51x0_test_config.hpp:1846
static constexpr uint16_t GetMotorOutputFullSteps(bool use_direct_drive=false) noexcept
Get motor output full steps per revolution.
Definition esp32_tmc51x0_test_config.hpp:1866
static constexpr tmc51x0::EncoderConfig GetEncoderConfig() noexcept
Get encoder configuration.
Definition esp32_tmc51x0_test_config.hpp:1876
Base template for test rig configuration (undefined - forces explicit specialization)
Definition esp32_tmc51x0_test_config.hpp:996
Communication interfaces for TMC51x0 stepper motor driver using SPI and UART.
Fluent configuration builder for TMC51x0 driver.