aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/tmc2660.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-4/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Consistently use lower case for all TMC field namesKevin O'Connor2021-08-061-51/+51
| | | | | | | | | | | | 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>
* tmc2660: Fix typo in seup fieldKevin O'Connor2021-03-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Use lowercase for stallguard/coolstep fieldsKevin O'Connor2021-03-181-15/+15
| | | | | | | Use lowercase for the field names so that it matches the tmc2130/tmc5160 field names. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Report SE in DUMP_TMC even if zeroKevin O'Connor2021-03-161-2/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Change stallguard flags to better match tmc2130/tmc5160Kevin O'Connor2021-03-151-6/+5
| | | | | | | | | The tmc2660 spec has an ambiguous "SG" field that sometimes refers to the "stallGuard" flag and sometimes refers to the "SG_RESULT" field. The tmc2130 and tmc5160 have similar fields that are not ambiguous, so adopt that naming strategy. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Do not enable SFILT by defaultKevin O'Connor2021-03-101-2/+1
| | | | | | | None of the other TMC driver enable SFILT by default and it seems enabling SFILT may not be ideal for sensorless homing. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Fix tmc register readingKevin O'Connor2021-02-271-30/+35
| | | | | | | | | The tmc2660 appears to send responses as soon as the clk starts toggling. That means the 20 bit response is at the top of the 24bit sent message. Also, this implies that RDSEL must already have the correct value in the prior message. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Use common warning/error flag names and descriptionsKevin O'Connor2021-02-271-43/+30
| | | | | | | | Where the tmc2660 flags match other drivers, use lowercase so that the same monitoring code can be used for all the tmc drivers. Also, use the same field formatters where applicable. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Move SET_TMC_CURRENT command to TMCCommandHelper()Kevin O'Connor2021-02-271-15/+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>
* tmc2660: Add set_current()/get_current() helpers to TMC2660CurrentHelperKevin O'Connor2021-02-271-9/+15
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* 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>
* tmc2660: Use new GCodeCommand wrappersKevin O'Connor2020-05-051-11/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Remove virtual_enable support and replace with automatic supportKevin O'Connor2019-11-121-2/+0
| | | | | | | Automatically detect if the stepper has a dedicated enable line. If it does not, then automatically enable virtual enable support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Configure "intpol" field from TMCMicrostepHelperKevin O'Connor2019-06-281-4/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc: Add support for virtual enable pinsKevin O'Connor2019-06-281-3/+5
| | | | | | | 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>
* tmc2660: Hold a mutex during MCU_TMC2660_SPI get/set_register()Kevin O'Connor2019-06-281-5/+10
| | | | 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-7/+10
| | | | | | | | 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-5/+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>
* tmc2660: Set SDOFF=0 before accessing DRVCTRLKevin O'Connor2019-06-181-2/+1
| | | | | | | 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>
* tmc2660: Don't allow configuration of DEDGEKevin O'Connor2019-06-181-1/+0
| | | | | | Setting DEDGE would just break the code. 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-5/+5
| | | | | | 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-15/+4
| | | | | | | | 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>
* tmc2660: Move current setting code to its own helper classKevin O'Connor2019-06-101-66/+78
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2130: Transmit register initialization during connect callbackKevin O'Connor2019-06-101-3/+0
| | | | | | | | 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>
* tmc2660: Use TMCCommandHelperKevin O'Connor2019-06-101-50/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Move get/set_register functions to new MCU_TMC2660_SPI classKevin O'Connor2019-06-101-29/+48
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Define get_register() methodKevin O'Connor2019-06-101-13/+14
| | | | | | | | | | Use a get_register() method instead of get_response(). This makes the tmc2660 class more similar to other TMC drivers. It also enables DUMP_TMC to dump all the readable content. Also, use the tmc2130.get_config_microsteps() helper. 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-2/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Automate VSENSE computationFlorian Heilmann2019-03-221-21/+32
| | | | | | Adjust the HEND default, which was faulty after the the fields update, remove disallowance of setting CS Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
* tmc2660: Minor indentation fixKevin O'Connor2019-03-081-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Add INIT_TMC and SET_TMC_FIELD gcodesFlorian Heilmann2019-03-081-2/+31
| | | | Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
* tmc2660: Raise SPI speed to 4 MhzFlorian Heilmann2019-03-081-1/+1
| | | | Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
* tmc2660: Use helper functions for register access and simplify TMC2660 ↵Florian Heilmann2019-03-081-193/+174
| | | | | | | | parameters sense_resistor is now a mandatory parameter for tmc2660 blocks. Duet2 users should use a value of 0.051 Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
* tmc2660: Add vsense_resistor config parameterFlorian Heilmann2019-03-081-18/+18
| | | | Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
* tmc2660: Wrap code to 80 columnsKevin O'Connor2019-02-271-26/+56
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: error and whitespace fixesPetri Honkala2018-12-271-4/+4
| | | | | | | | - redundant parentheses removed - parameter reference fixed - raise error fixed Signed-off-by: Petri Honkala <cruwaller@gmail.com>
* tmc2660: Use bus.py helper code for spiKevin O'Connor2018-11-211-31/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Fix typo in TMC2660 extra (#830)Florian Heilmann2018-10-291-1/+1
| | | Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
* Add DUMP_TMC capabilities to the TMC2660 extraFlorian Heilmann2018-10-281-1/+19
| | | | Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
* Implement idle event support in the TMC2660 extraFlorian Heilmann2018-10-281-48/+25
| | | | Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
* tmc2660: Add endstop phase detection functionality to TMC2660 extra (#816)Florian Heilmann2018-10-241-1/+12
| | | Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
* docs: Update Features.md document with tmc2660 supportKevin O'Connor2018-10-021-0/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tmc2660: Implementation of TMC2660 extra (#621)Florian Heilmann2018-09-111-0/+269
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>