Quick Start
This guide will get you up and running with the TMC9660 driver in just a few steps.
Prerequisites
- Driver installed
- Hardware wired
- Communication interface implemented (see Platform Integration)
Minimal Example
Hereβs a complete working example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "inc/tmc9660.hpp"
// 1. Implement your communication interface (see platform_integration.md)
class MySPI : public tmc9660::SpiCommInterface {
// ... implement spiTransfer() method
};
int main() {
// 2. Create communication interface
MySPI spi;
// 3. Create driver instance
tmc9660::TMC9660 driver(spi);
// 4. CRITICAL: Initialize bootloader for Parameter Mode
tmc9660::BootloaderConfig cfg{};
cfg.boot.boot_mode = tmc9660::bootcfg::BootMode::Parameter;
cfg.boot.start_motor_control = true;
auto result = driver.bootloaderInit(&cfg);
if (result != tmc9660::TMC9660::BootloaderInitResult::Success) {
// Handle initialization failure
return -1;
}
// 5. Configure motor type
driver.motorConfig.setType(tmc9660::tmcl::MotorType::BLDC_MOTOR, 7); // 7 pole pairs
// 6. Start motor control
driver.focControl.setTargetVelocity(1000); // 1000 RPM
return 0;
}
Step-by-Step Explanation
Step 1: Implement Communication Interface
You must implement either SpiCommInterface or UartCommInterface for your platform. See Platform Integration for detailed examples.
Step 2: Create Driver Instance
1
tmc9660::TMC9660 driver(spi);
The driver takes a reference to your communication interface.
Step 3: Initialize Bootloader
This step is CRITICAL! The TMC9660 must be configured for Parameter Mode before any motor control will work.
1
2
3
4
5
tmc9660::BootloaderConfig cfg{};
cfg.boot.boot_mode = tmc9660::bootcfg::BootMode::Parameter;
cfg.boot.start_motor_control = true;
auto result = driver.bootloaderInit(&cfg);
See Bootloader Initialization for complete details.
Step 4: Configure Motor
1
driver.motorConfig.setType(tmc9660::tmcl::MotorType::BLDC_MOTOR, 7);
Set the motor type and pole pairs. Supported types:
BLDC_MOTOR- Brushless DC motorSTEPPER_MOTOR- Stepper motorDC_MOTOR- Brushed DC motor
Step 5: Control Motor
1
driver.focControl.setTargetVelocity(1000); // Set target velocity
Next Steps
- Hardware Setup - Complete wiring guide
- Platform Integration - Implement communication interface
- Bootloader Initialization - Critical bootloader setup
- Examples - More detailed examples