aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/tmc2130.py
Commit message (Collapse)AuthorAgeFilesLines
* tmc: Add support for a get_status() methodKevin O'Connor2021-08-301-0/+1
| | | | | | Export mcu_phase_offset and drv_status information. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop_phase: Convert to using tmc mcu_phase_offsetKevin O'Connor2021-08-081-2/+1
| | | | | | | Now that the TMC drivers track the phase offset, use that to implement endstop phase. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Move stepper phase reading code to TMCCommandHelper classKevin O'Connor2021-08-061-3/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Consistently use lower case for all TMC field namesKevin O'Connor2021-08-061-34/+34
| | | | | | | | | | | | The Trinamic specs aren't consistent with upper vs lower case, which can be confusing. Improve clarity by using lower case names consistently in the code. Register names will continue to use all upper case naming in the code. Update the SET_TMC_FIELD command to automatically convert field names to lower case. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Report CS_ACTUAL in DUMP_TMC even if zeroKevin O'Connor2021-03-161-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Move clear_gstat check for tmc2130 to within TMCErrorCheck classKevin O'Connor2021-03-151-2/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Fix broken error report due to missing self.nameKevin O'Connor2021-03-111-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Verify SPI register writesKevin O'Connor2021-03-101-2/+17
| | | | | | | | The tmc2130 (and tmc5160) will respond back with the value written during the next SPI command. Use this feature to verify that the value written matches the value sent. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Add support for periodic checking of driver statusKevin O'Connor2021-02-271-1/+2
| | | | | | | | Check the status of all Trinamic stepper motor drivers once a second. If the driver reports an error then invoke a shutdown. Also log any serious warnings. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc5160: Merge field formatters into tmc2130.pyKevin O'Connor2021-02-271-0/+1
| | | | | | | | The tmc5160 field formatters were mostly duplicates of the tmc2130 - add the "reset" field to tmc2130.py so both drivers have similar reporting. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Move SET_TMC_CURRENT command to TMCCommandHelper()Kevin O'Connor2021-02-271-24/+2
| | | | | | | Refactor the tmc driver implementations so that there is a single implementation of the SET_TMC_CURRENT command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Add set_current()/get_current() helper functions to TMCCurrentHelperKevin O'Connor2021-02-271-16/+20
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Add spi daisy chain supportMarco D'Alessio2021-02-261-14/+59
| | | | | | | | This patch adds the ability to daisy-chain multiple tmc2130 and tmc5160 drivers. Signed-off-by: Marco D'Alessio <marco@wrecklab.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc5160: diag0 support (#3159)Trevor Jones2020-08-091-2/+1
| | | | | Allow for diag0 only hardware to use sensorless homing. Signed-off-by: Trevor Jones <trevorjones141@gmail.com>
* extras: Use "from . import module" for relative importsKevin O'Connor2020-06-151-1/+1
| | | | | | Use alternate import syntax to improve Python3 compatibility. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Use new GCodeCommand wrappersKevin O'Connor2020-05-051-18/+17
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: use local variable instead of global Registers in MCU_TMC_SPIPetri Honkala2019-12-031-1/+1
| | | | Signed-off-by: Petri Honkala <cruwaller@gmail.com>
* tmc2130: Do not error if run current below hold current (#2190)Florian Heilmann2019-11-211-3/+5
| | | Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
* tmc: Configure "intpol" field from TMCMicrostepHelperKevin O'Connor2019-06-281-1/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Add support for virtual enable pinsKevin O'Connor2019-06-281-2/+2
| | | | | | | Add support for enabling the stepper via the communication channel. This improves support for boards with a shared enable line. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Hold a mutex during MCU_TMC_SPI get/set_register()Kevin O'Connor2019-06-281-5/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: It's not valid to schedule messages with print_time=0Kevin O'Connor2019-06-251-3/+5
| | | | | | | | A print_time of zero may translate to a negative clock on a secondary micro-controller, which would cause an internal error. Change the code to pass a real print_time or None if it is not needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Simplify internal DUMP_TMC interfaceKevin O'Connor2019-06-251-4/+1
| | | | | | | | Only the tmc2208 driver needs special read register translation logic. Rework the code so a default implementation is available for all the other drivers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Move common TMC stepper driver code to new file tmc.pyKevin O'Connor2019-06-101-243/+7
| | | | | | Move common code from tmc2130.py to tmc.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Rework remaining config helpers to use mcu_tmc interfaceKevin O'Connor2019-06-101-28/+42
| | | | | | | | Introduce TMCMicrostepHelper and TMCStealthchopHelper helper code that uses the mcu_tmc interface. Update the callers to use these new helpers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Move TMC virtual endstop code into a new TMCEndstopHelper classKevin O'Connor2019-06-101-40/+55
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Move current setting code to its own helper classKevin O'Connor2019-06-101-84/+83
| | | | | | | Concentrate the current setting code into its own TMCCurrentHelper class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Transmit register initialization during connect callbackKevin O'Connor2019-06-101-3/+9
| | | | | | | | Perform the register initialization directly from TMCCommandHelper and perform it during the "connect" phase. This unifies the register setup for the TMC2130, TMC2208, TMC2660, and TMC5160. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Factor out g-code command handlers to their own classKevin O'Connor2019-06-101-47/+70
| | | | | | | Create a TMCCommandHelper class that implements INIT_TMC, SET_TMC_FIELD, and DUMP_TMC. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Move low-level get/set_register functions to new MCU_TMC_SPI classKevin O'Connor2019-06-101-28/+42
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* test: Add test cases for tmc driversKevin O'Connor2019-06-101-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Check field name validity. (#1697)Artem Belevich2019-06-021-1/+3
| | | | | This avoids crashing Klipper if user entered invalid field name. Signed-off-by: Artem Belevich <artemb@gmail.com>
* tmc2130: Add support for two's complement signed fields to FieldHelperKevin O'Connor2019-05-291-18/+19
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: add SET_TMC_CURRENT and SET_TMC_FIELD commands (#1419)amblidex2019-03-221-6/+74
| | | Signed-off-by: Frank Kang <amblidex@outlook.com>
* tmc2130: Rename driver_BLANK_TIME_SELECT to driver_TBLKevin O'Connor2019-03-081-1/+1
| | | | | | | Use the field names from the trinamic specification. This makes the field similar to all the other driver_XXX config options. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Change respond_info() to log by defaultKevin O'Connor2019-03-041-6/+2
| | | | | | | It makes sense to log most respond_info() content, so do that by default. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Wrap code to 80 columnsKevin O'Connor2019-03-011-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Add support for INIT_TMC commandKevin O'Connor2019-03-011-4/+15
| | | | | Signed-off-by: Frank Kang <amblidex@outlook.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Report write-only registers in DUMP_TMCKevin O'Connor2019-02-271-0/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Use FieldHelper() to set/get driver fieldsKevin O'Connor2019-02-211-40/+102
| | | | | | | Use the field helper to simplify the bit manipulation in the driver. This also enables the extended DUMP_TMC output. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* manual_stepper: Add an "extras" module for manually controlling a stepperKevin O'Connor2019-02-121-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Share config reading helpers with tmc2208.py codeKevin O'Connor2019-02-031-37/+51
| | | | | | | | Add helper function for reading current, microsteps, and stealthchop settings from the config file. Use these helpers in both the tmc2130 and tmc2208 modules. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: move local set_field/get_field helpers to FieldHelper classKevin O'Connor2019-02-031-7/+29
| | | | | | | Move these helper functions to the FieldHelper class so that they can be used by other Trinamic drivers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Use field definitions during driver initKevin O'Connor2019-02-031-2/+7
| | | | | | Reduce the amount of bit manipulations by using the FieldHelper class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Add register field formattersDmitry Frolov2019-02-031-6/+17
| | | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Dmitry Frolov <dmitry.frolov@gmail.com>
* tmc2130: Convert field helper into a classKevin O'Connor2019-02-031-18/+20
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2208: Decode register fields in DUMP_TMC (#1156)lorf2019-02-021-1/+35
| | | | | | | | | | | Report values of TMC2208 register fields in DUMP_TMC command to help in tuning and diagnostics. This also adds functions to refer to register fields by name for TMC drivers and register mappings for TMC2208. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Dmitry Frolov <dmitry.frolov@gmail.com>
* tmc2130: Use bus.py helper code for spiKevin O'Connor2018-11-211-29/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* endstop_phase: Add support for detecting phase via TMC stepper driversKevin O'Connor2018-10-161-0/+4
| | | | | | | | The Trinamic stepper motor drivers are capable of reporting the stepper phase - add support for using that capability to the enddstop_phases module. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Rename add_config_object() to register_config_callback()Kevin O'Connor2018-09-031-1/+1
| | | | | | | | | Change the name of the config registration method and pass an explicit reference to the callback to the new method. This makes the relationship between mcu registration and build_config() more clear in the calling code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>