tmc2660: Set SDOFF=0 before accessing DRVCTRL

Make sure to configure DRVCONF with SDOFF=0 prior to writing DRVCTRL
as that field controls access to that register.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-06-18 15:19:05 -04:00
parent 587db5c315
commit cfdb60ca23
1 changed files with 1 additions and 2 deletions

View File

@ -232,6 +232,7 @@ class TMC2660:
def __init__(self, config): def __init__(self, config):
# Setup mcu communication # Setup mcu communication
self.fields = tmc.FieldHelper(Fields, SignedFields, FieldFormatters) self.fields = tmc.FieldHelper(Fields, SignedFields, FieldFormatters)
self.fields.set_field("SDOFF", 0) # Access DRVCTRL in step/dir mode
self.mcu_tmc = MCU_TMC2660_SPI(config, Registers, self.fields) self.mcu_tmc = MCU_TMC2660_SPI(config, Registers, self.fields)
# Register commands # Register commands
cmdhelper = tmc.TMCCommandHelper(config, self.mcu_tmc) cmdhelper = tmc.TMCCommandHelper(config, self.mcu_tmc)
@ -272,8 +273,6 @@ class TMC2660:
set_config_field(config, "SLPL", 0) set_config_field(config, "SLPL", 0)
set_config_field(config, "DISS2G", 0) set_config_field(config, "DISS2G", 0)
set_config_field(config, "TS2G", 3) set_config_field(config, "TS2G", 3)
self.fields.set_field("RDSEL", 0) # needed for phase calculations
self.fields.set_field("SDOFF", 0) # only step/dir mode supported
def query_registers(self, print_time=0.): def query_registers(self, print_time=0.):
return [(reg_name, self.mcu_tmc.get_register(reg_name)) return [(reg_name, self.mcu_tmc.get_register(reg_name))