TMC5130 Support
The driver automatically detects and supports both TMC5130 and TMC5160 chips.
Automatic Detection
The driver detects the chip version during Initialize():
- TMC5130: Version 0x11
- TMC5160: Version 0x30
The chip version is read from the IOIN register and stored internally. You can check which chip was detected using:
1
2
3
4
5
6
uint8_t version = driver.status.GetChipVersion();
if (version == ChipVersion::TMC5130) {
// TMC5130-specific logic if needed
} else if (version == ChipVersion::TMC5160) {
// TMC5160-specific logic if needed
}
Differences Handled Automatically
The driver automatically handles differences between TMC5130 and TMC5160:
- GLOBAL_SCALER: TMC5130 doesnβt have this register - driver skips it automatically
- Current Limits: TMC5130 has internal MOSFETs (1.64A max), TMC5160 uses external MOSFETs
- Version Detection: Use
driver.status.GetChipVersion()to check detected version
Usage
No special configuration needed - the driver handles differences automatically:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Initialize driver (automatically detects chip version)
tmc51x0::DriverConfig cfg;
// ... configure cfg ...
auto init_result = driver.Initialize(cfg);
if (!init_result) {
printf("Initialization error: %s\n", init_result.ErrorMessage());
// Handle error
}
// Check which chip was detected
uint8_t version = driver.status.GetChipVersion();
if (version == ChipVersion::TMC5130) {
printf("Detected TMC5130\n");
} else if (version == ChipVersion::TMC5160) {
printf("Detected TMC5160\n");
}
Technical Details
GLOBAL_SCALER Register
The TMC5130 doesnβt have the GLOBAL_SCALER register that exists in TMC5160. The driver automatically:
- Skips writing to GLOBAL_SCALER during
SetMotorCurrent()for TMC5130 - Uses calculated IRUN values directly (without global scaler adjustment)
- Logs a debug message when GLOBAL_SCALER is skipped
Current Limits
- TMC5130: Internal MOSFETs with 1.64A maximum current
- TMC5160: External MOSFETs (current limit depends on external components)
The driver doesnβt enforce these limits automatically - ensure your motor current settings are appropriate for your chip.
Compatibility
The driver is fully compatible with both chips. All features work the same way, with the exception of GLOBAL_SCALER which is automatically skipped for TMC5130.
Navigation β Register Access | Back to Index | Next: Troubleshooting β