PyTmcStepper 0.9.0__tar.gz → 0.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/PKG-INFO +36 -40
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/README.md +31 -34
- pytmcstepper-0.9.2/pyproject.toml +45 -0
- pytmcstepper-0.9.2/setup.cfg +4 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/PyTmcStepper.egg-info/PKG-INFO +36 -40
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/PyTmcStepper.egg-info/SOURCES.txt +10 -3
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/_tmc_exceptions.py +5 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/_tmc_logger.py +30 -35
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/_tmc_math.py +9 -9
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/_tmc_stallguard.py +49 -45
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/_tmc_stepperdriver.py +70 -66
- pytmcstepper-0.9.2/src/tmc_driver/_tmc_validation.py +29 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/com/_tmc_com.py +43 -65
- pytmcstepper-0.9.2/src/tmc_driver/com/_tmc_com_spi.py +83 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/com/_tmc_com_spi_base.py +34 -51
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/com/_tmc_com_spi_ftdi.py +7 -25
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/com/_tmc_com_spi_micropython.py +24 -19
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/com/_tmc_com_uart.py +18 -21
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/com/_tmc_com_uart_base.py +104 -81
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/com/_tmc_com_uart_micropython.py +16 -19
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/enable_control/_tmc_ec.py +4 -7
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/enable_control/_tmc_ec_pin.py +3 -9
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/enable_control/_tmc_ec_toff.py +1 -4
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/motion_control/_tmc_mc.py +53 -59
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/motion_control/_tmc_mc_step_dir.py +98 -71
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py +15 -19
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/motion_control/_tmc_mc_step_reg.py +7 -13
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/motion_control/_tmc_mc_vactual.py +58 -47
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/reg/_tmc2209_reg.py +23 -19
- pytmcstepper-0.9.2/src/tmc_driver/reg/_tmc220x_reg.py +287 -0
- pytmcstepper-0.9.2/src/tmc_driver/reg/_tmc224x_reg.py +464 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/reg/_tmc_reg.py +14 -20
- pytmcstepper-0.9.2/src/tmc_driver/tmc_2208.py +10 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/tmc_2209.py +114 -93
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/tmc_220x.py +136 -198
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/tmc_2240.py +688 -705
- pytmcstepper-0.9.2/src/tmc_driver/tmc_gpio/__init__.py +101 -0
- pytmcstepper-0.9.2/src/tmc_driver/tmc_gpio/_tmc_gpio_board_base.py +106 -0
- pytmcstepper-0.9.2/src/tmc_driver/tmc_gpio/_tmc_gpio_board_ftdi.py +164 -0
- pytmcstepper-0.9.2/src/tmc_driver/tmc_gpio/_tmc_gpio_board_gpiozero.py +109 -0
- pytmcstepper-0.9.2/src/tmc_driver/tmc_gpio/_tmc_gpio_board_micropython.py +108 -0
- pytmcstepper-0.9.2/src/tmc_driver/tmc_gpio/_tmc_gpio_board_periphery.py +80 -0
- pytmcstepper-0.9.2/src/tmc_driver/tmc_gpio/_tmc_gpio_board_rpi_gpio.py +163 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/tests/test_tmc2209.py +3 -1
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/tests/test_tmc2240.py +3 -1
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/tests/test_tmc_com_spi.py +7 -6
- pytmcstepper-0.9.2/tests/test_tmc_com_uart.py +44 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/tests/test_tmc_ec_pin.py +2 -3
- pytmcstepper-0.9.2/tests/test_tmc_math.py +64 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/tests/test_tmc_modules.py +6 -4
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/tests/test_tmc_move.py +19 -10
- pytmcstepper-0.9.2/tests/test_tmc_set_current.py +140 -0
- pytmcstepper-0.9.0/pyproject.toml +0 -16
- pytmcstepper-0.9.0/setup.cfg +0 -47
- pytmcstepper-0.9.0/src/tmc_driver/_tmc_gpio_board.py +0 -681
- pytmcstepper-0.9.0/src/tmc_driver/com/_tmc_com_spi.py +0 -101
- pytmcstepper-0.9.0/src/tmc_driver/reg/_tmc220x_reg.py +0 -239
- pytmcstepper-0.9.0/src/tmc_driver/reg/_tmc224x_reg.py +0 -366
- pytmcstepper-0.9.0/src/tmc_driver/tmc_2208.py +0 -12
- pytmcstepper-0.9.0/tests/test_tmc_com_uart.py +0 -28
- pytmcstepper-0.9.0/tests/test_tmc_math.py +0 -51
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/LICENSE +0 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/PyTmcStepper.egg-info/dependency_links.txt +0 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/PyTmcStepper.egg-info/requires.txt +0 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/PyTmcStepper.egg-info/top_level.txt +0 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/__init__.py +0 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/com/__init__.py +0 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/enable_control/__init__.py +0 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/motion_control/__init__.py +0 -0
- {pytmcstepper-0.9.0 → pytmcstepper-0.9.2}/src/tmc_driver/reg/__init__.py +0 -0
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyTmcStepper
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
4
4
|
Summary: This is a Python libary to drive a stepper motor with a Trinamic stepper driver and a single board computer like a Raspberry Pi
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Author-email: Christian Köhlke <christian@koehlke.de>
|
|
6
|
+
License-Expression: GPL-3.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Chr157i4n/PyTmcStepper
|
|
8
8
|
Project-URL: Bug Tracker, https://github.com/Chr157i4n/PyTmcStepper/issues
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
11
10
|
Classifier: Operating System :: POSIX :: Linux
|
|
12
11
|
Classifier: Development Status :: 4 - Beta
|
|
13
12
|
Classifier: Intended Audience :: Developers
|
|
14
13
|
Classifier: Natural Language :: English
|
|
15
14
|
Classifier: Topic :: System :: Hardware :: Hardware Drivers
|
|
16
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.10
|
|
17
16
|
Description-Content-Type: text/markdown
|
|
18
17
|
License-File: LICENSE
|
|
19
18
|
Requires-Dist: pyserial
|
|
@@ -127,21 +126,21 @@ is split into their own classes to be able to support the diverse methods.
|
|
|
127
126
|
|
|
128
127
|
The EnableControl module controls the motor current output. It has a function `set_motor_enabled` with one boolean parameter. This function is used to enable or disable the Motor current output.
|
|
129
128
|
|
|
130
|
-
EnableControl | Class
|
|
131
|
-
-- | --
|
|
129
|
+
EnableControl | Class | Driver | Notes
|
|
130
|
+
-- | -- | -- | --
|
|
132
131
|
Pin | [TmcEnableControlPin](src/tmc_driver/enable_control/_tmc_ec_pin.py) | all | the EN Pin of the Driver needs to be connected to a GPIO of the Pi
|
|
133
|
-
TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py)
|
|
132
|
+
TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py) | all | the EN Pin needs to be connected to GND.<br />On the TMC2209 this enables current Output on Startup!<br />On the TMC2240 this works fine, because TOff is per default 0 (off).
|
|
134
133
|
|
|
135
134
|
### MotionControl
|
|
136
135
|
|
|
137
136
|
The MotionControl module controls the motion of the motor. Before a movement the motor current output needs to be enabled by the [EnableControl](#enablecontrol) module.
|
|
138
137
|
|
|
139
|
-
MotionControl | Class
|
|
140
|
-
-- | --
|
|
141
|
-
STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py)
|
|
142
|
-
STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py)
|
|
143
|
-
VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py)
|
|
144
|
-
STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py)
|
|
138
|
+
MotionControl | Class | Driver | Notes
|
|
139
|
+
-- | -- | -- | --
|
|
140
|
+
STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py) | all | the STEP and DIR pin of the driver must each be connected to a GPIO of the Pi
|
|
141
|
+
STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py) | all | only the STEP pin needs to be connected to a GPIO of the Pi.<br />The direction is controlled via the Register.
|
|
142
|
+
VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py) | TMC220x | the Direction and Speed is controlled via Register. But VActual does only allow setting a speed and therefore cannot control positioning of the Motor.
|
|
143
|
+
STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py) | all | In contrast to STEP/DIR, the step pin is controlled by PWM. This reduces the load on the CPU, but does not allow precise positioning (similar to the VACTUAL).<br />STEP must be connected to a PWM-capable pin for this purpose
|
|
145
144
|
|
|
146
145
|
Further methods of controlling the motion of a motor could be:
|
|
147
146
|
|
|
@@ -151,10 +150,10 @@ Further methods of controlling the motion of a motor could be:
|
|
|
151
150
|
|
|
152
151
|
### Com
|
|
153
152
|
|
|
154
|
-
Com | Class
|
|
155
|
-
-- | --
|
|
156
|
-
UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py)
|
|
157
|
-
SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py)
|
|
153
|
+
Com | Class | Driver | Notes
|
|
154
|
+
-- | -- | -- | --
|
|
155
|
+
UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py) | all | Communication via UART (RX, TX). See [Wiring](#uart)<br />[pyserial](https://pypi.org/project/pyserial) needs to be installed
|
|
156
|
+
SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py) | TMC2240 | Communication via SPI (MOSI, MISO, CLK, CS). See [Wiring](#spi)<br />[spidev](https://pypi.org/project/spidev) needs to be installed
|
|
158
157
|
SPI over FT232H | [TmcComSpiFtdi](src/tmc_driver/com/_tmc_com_spi_ftdi.py) | TMC2240 | Communication via SPI using a FT232H. This can be used on any OS.<br />[pyftdi](https://pypi.org/project/pyftdi) needs to be installed
|
|
159
158
|
|
|
160
159
|
## Wiring
|
|
@@ -254,21 +253,18 @@ So you don't need to connect anything to the Vio pin of the driver.
|
|
|
254
253
|
|
|
255
254
|
### Micropython
|
|
256
255
|
|
|
257
|
-
|
|
258
|
-
Then you can run a demo script by using
|
|
256
|
+
The lib is also compatible with MicroPython. For using it with Micropython the VSCode addon [MicroPico](https://marketplace.visualstudio.com/items?itemName=paulober.pico-w-go) is used. Use the Upload Project function to upload the src folder and the needed lib folder.
|
|
259
257
|
|
|
260
|
-
|
|
258
|
+
the needed libs, which are not builtin in Micropython are:
|
|
261
259
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
260
|
+
Lib | available on MIP
|
|
261
|
+
-- | --
|
|
262
|
+
abc | yes
|
|
263
|
+
enum | no
|
|
264
|
+
threading | yes
|
|
265
|
+
types | yes
|
|
268
266
|
|
|
269
|
-
|
|
270
|
-
python -m mpremote connect COM4 run .\demo\micropython\demo_script_tmc2240_03_basic_movement.py
|
|
271
|
-
```
|
|
267
|
+
You can also use MicroPico to run the demo script by opening one and then pressing Run on the bottom left corner
|
|
272
268
|
|
|
273
269
|
## Usage
|
|
274
270
|
|
|
@@ -304,15 +300,15 @@ If you encounter any problems, feel free to open an issue (ENG/GER).
|
|
|
304
300
|
Please don't send any E-Mails to me. Pls use Github, so that i don't need to answer the same question multiple times.
|
|
305
301
|
I reserve the right not to answer E-Mails.
|
|
306
302
|
|
|
307
|
-
Problem
|
|
308
|
-
--
|
|
309
|
-
FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0'
|
|
310
|
-
PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0'
|
|
311
|
-
"TMC2209: UART Communication Error"
|
|
312
|
-
"TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes"
|
|
313
|
-
"TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes"
|
|
314
|
-
"TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes"
|
|
315
|
-
"the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits
|
|
303
|
+
Problem | Solution
|
|
304
|
+
-- | --
|
|
305
|
+
FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0' | depending on your Raspberry Pi version, you need to enable the Serial Port <br /> run `sudo raspi-config` in your terminal. <br /> there go to '3 Interface Options' -> 'P3 Serial Port' <br /> Would you like a login shell to be accessible over serial? No <br /> Would you like the serial port hardware to be enabled? Yes <br /> Finish and then reboot
|
|
306
|
+
PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0' | you need to give the permission to acces the Serial Port to your current user <br /> You may need to add your user (pi) to the dialout group with `sudo usermod -a -G dialout pi` and then relog. <br /> If that does not work, make sure that your user has read/write permissions on the dev file `/dev/serial0` by calling `sudo chmod 660 /dev/serial0`.
|
|
307
|
+
"TMC2209: UART Communication Error" | You can use the 'debug_script_01_uart_connection' script to get a better reading on the received bytes and troubleshoot your problem
|
|
308
|
+
"TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes" | only 4 total bytes received indicates, that the Raspberry Pi receives its own data, but nothing from the TMC driver. This happens if RX and TX are connected properly, but the TMC driver has no power
|
|
309
|
+
"TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes" | 0 total bytes received indicates, a problem with your wiring or your Raspberry Pi. This happens if TX is not connected
|
|
310
|
+
"TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes" | this indicates, the Raspberry Pi received only zeroes. This happens if only RX is connected and TX not
|
|
311
|
+
"the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits | Make sure the UART ist properly connected to the TMC driver and the driver is powered and working. <br /> Make sure login shell (console) over serial is disabled.
|
|
316
312
|
|
|
317
313
|

|
|
318
314
|
|
|
@@ -96,21 +96,21 @@ is split into their own classes to be able to support the diverse methods.
|
|
|
96
96
|
|
|
97
97
|
The EnableControl module controls the motor current output. It has a function `set_motor_enabled` with one boolean parameter. This function is used to enable or disable the Motor current output.
|
|
98
98
|
|
|
99
|
-
EnableControl | Class
|
|
100
|
-
-- | --
|
|
99
|
+
EnableControl | Class | Driver | Notes
|
|
100
|
+
-- | -- | -- | --
|
|
101
101
|
Pin | [TmcEnableControlPin](src/tmc_driver/enable_control/_tmc_ec_pin.py) | all | the EN Pin of the Driver needs to be connected to a GPIO of the Pi
|
|
102
|
-
TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py)
|
|
102
|
+
TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py) | all | the EN Pin needs to be connected to GND.<br />On the TMC2209 this enables current Output on Startup!<br />On the TMC2240 this works fine, because TOff is per default 0 (off).
|
|
103
103
|
|
|
104
104
|
### MotionControl
|
|
105
105
|
|
|
106
106
|
The MotionControl module controls the motion of the motor. Before a movement the motor current output needs to be enabled by the [EnableControl](#enablecontrol) module.
|
|
107
107
|
|
|
108
|
-
MotionControl | Class
|
|
109
|
-
-- | --
|
|
110
|
-
STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py)
|
|
111
|
-
STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py)
|
|
112
|
-
VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py)
|
|
113
|
-
STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py)
|
|
108
|
+
MotionControl | Class | Driver | Notes
|
|
109
|
+
-- | -- | -- | --
|
|
110
|
+
STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py) | all | the STEP and DIR pin of the driver must each be connected to a GPIO of the Pi
|
|
111
|
+
STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py) | all | only the STEP pin needs to be connected to a GPIO of the Pi.<br />The direction is controlled via the Register.
|
|
112
|
+
VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py) | TMC220x | the Direction and Speed is controlled via Register. But VActual does only allow setting a speed and therefore cannot control positioning of the Motor.
|
|
113
|
+
STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py) | all | In contrast to STEP/DIR, the step pin is controlled by PWM. This reduces the load on the CPU, but does not allow precise positioning (similar to the VACTUAL).<br />STEP must be connected to a PWM-capable pin for this purpose
|
|
114
114
|
|
|
115
115
|
Further methods of controlling the motion of a motor could be:
|
|
116
116
|
|
|
@@ -120,10 +120,10 @@ Further methods of controlling the motion of a motor could be:
|
|
|
120
120
|
|
|
121
121
|
### Com
|
|
122
122
|
|
|
123
|
-
Com | Class
|
|
124
|
-
-- | --
|
|
125
|
-
UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py)
|
|
126
|
-
SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py)
|
|
123
|
+
Com | Class | Driver | Notes
|
|
124
|
+
-- | -- | -- | --
|
|
125
|
+
UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py) | all | Communication via UART (RX, TX). See [Wiring](#uart)<br />[pyserial](https://pypi.org/project/pyserial) needs to be installed
|
|
126
|
+
SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py) | TMC2240 | Communication via SPI (MOSI, MISO, CLK, CS). See [Wiring](#spi)<br />[spidev](https://pypi.org/project/spidev) needs to be installed
|
|
127
127
|
SPI over FT232H | [TmcComSpiFtdi](src/tmc_driver/com/_tmc_com_spi_ftdi.py) | TMC2240 | Communication via SPI using a FT232H. This can be used on any OS.<br />[pyftdi](https://pypi.org/project/pyftdi) needs to be installed
|
|
128
128
|
|
|
129
129
|
## Wiring
|
|
@@ -223,21 +223,18 @@ So you don't need to connect anything to the Vio pin of the driver.
|
|
|
223
223
|
|
|
224
224
|
### Micropython
|
|
225
225
|
|
|
226
|
-
|
|
227
|
-
Then you can run a demo script by using
|
|
226
|
+
The lib is also compatible with MicroPython. For using it with Micropython the VSCode addon [MicroPico](https://marketplace.visualstudio.com/items?itemName=paulober.pico-w-go) is used. Use the Upload Project function to upload the src folder and the needed lib folder.
|
|
228
227
|
|
|
229
|
-
|
|
228
|
+
the needed libs, which are not builtin in Micropython are:
|
|
230
229
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
230
|
+
Lib | available on MIP
|
|
231
|
+
-- | --
|
|
232
|
+
abc | yes
|
|
233
|
+
enum | no
|
|
234
|
+
threading | yes
|
|
235
|
+
types | yes
|
|
237
236
|
|
|
238
|
-
|
|
239
|
-
python -m mpremote connect COM4 run .\demo\micropython\demo_script_tmc2240_03_basic_movement.py
|
|
240
|
-
```
|
|
237
|
+
You can also use MicroPico to run the demo script by opening one and then pressing Run on the bottom left corner
|
|
241
238
|
|
|
242
239
|
## Usage
|
|
243
240
|
|
|
@@ -273,15 +270,15 @@ If you encounter any problems, feel free to open an issue (ENG/GER).
|
|
|
273
270
|
Please don't send any E-Mails to me. Pls use Github, so that i don't need to answer the same question multiple times.
|
|
274
271
|
I reserve the right not to answer E-Mails.
|
|
275
272
|
|
|
276
|
-
Problem
|
|
277
|
-
--
|
|
278
|
-
FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0'
|
|
279
|
-
PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0'
|
|
280
|
-
"TMC2209: UART Communication Error"
|
|
281
|
-
"TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes"
|
|
282
|
-
"TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes"
|
|
283
|
-
"TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes"
|
|
284
|
-
"the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits
|
|
273
|
+
Problem | Solution
|
|
274
|
+
-- | --
|
|
275
|
+
FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0' | depending on your Raspberry Pi version, you need to enable the Serial Port <br /> run `sudo raspi-config` in your terminal. <br /> there go to '3 Interface Options' -> 'P3 Serial Port' <br /> Would you like a login shell to be accessible over serial? No <br /> Would you like the serial port hardware to be enabled? Yes <br /> Finish and then reboot
|
|
276
|
+
PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0' | you need to give the permission to acces the Serial Port to your current user <br /> You may need to add your user (pi) to the dialout group with `sudo usermod -a -G dialout pi` and then relog. <br /> If that does not work, make sure that your user has read/write permissions on the dev file `/dev/serial0` by calling `sudo chmod 660 /dev/serial0`.
|
|
277
|
+
"TMC2209: UART Communication Error" | You can use the 'debug_script_01_uart_connection' script to get a better reading on the received bytes and troubleshoot your problem
|
|
278
|
+
"TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes" | only 4 total bytes received indicates, that the Raspberry Pi receives its own data, but nothing from the TMC driver. This happens if RX and TX are connected properly, but the TMC driver has no power
|
|
279
|
+
"TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes" | 0 total bytes received indicates, a problem with your wiring or your Raspberry Pi. This happens if TX is not connected
|
|
280
|
+
"TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes" | this indicates, the Raspberry Pi received only zeroes. This happens if only RX is connected and TX not
|
|
281
|
+
"the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits | Make sure the UART ist properly connected to the TMC driver and the driver is powered and working. <br /> Make sure login shell (console) over serial is disabled.
|
|
285
282
|
|
|
286
283
|

|
|
287
284
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=42", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "PyTmcStepper"
|
|
7
|
+
version = "0.9.2"
|
|
8
|
+
authors = [{ name = "Christian Köhlke", email = "christian@koehlke.de" }]
|
|
9
|
+
description = "This is a Python libary to drive a stepper motor with a Trinamic stepper driver and a single board computer like a Raspberry Pi"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = "GPL-3.0"
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Operating System :: POSIX :: Linux",
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Natural Language :: English",
|
|
19
|
+
"Topic :: System :: Hardware :: Hardware Drivers",
|
|
20
|
+
]
|
|
21
|
+
dependencies = ["pyserial"]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://github.com/Chr157i4n/PyTmcStepper"
|
|
25
|
+
"Bug Tracker" = "https://github.com/Chr157i4n/PyTmcStepper/issues"
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
RASPBERRY_PI = ["RPi.GPIO"]
|
|
29
|
+
RASPBERRY_PI5 = ["gpiozero"]
|
|
30
|
+
NVIDIA_JETSON = ["Jetson.GPIO"]
|
|
31
|
+
LUCKFOX_PICO = ["python-periphery"]
|
|
32
|
+
ORANGE_PI = ["OPi.GPIO"]
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.packages.find]
|
|
35
|
+
where = ["src"]
|
|
36
|
+
|
|
37
|
+
[tool.pylint."messages control"]
|
|
38
|
+
disable = "C0103,W0511,W0012,R0801"
|
|
39
|
+
|
|
40
|
+
[tool.pylint.main]
|
|
41
|
+
ignored-modules = "machine"
|
|
42
|
+
unsafe-load-any-extension = true
|
|
43
|
+
|
|
44
|
+
[tool.pylint.format]
|
|
45
|
+
max-line-length = 160
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyTmcStepper
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
4
4
|
Summary: This is a Python libary to drive a stepper motor with a Trinamic stepper driver and a single board computer like a Raspberry Pi
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Author-email: Christian Köhlke <christian@koehlke.de>
|
|
6
|
+
License-Expression: GPL-3.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Chr157i4n/PyTmcStepper
|
|
8
8
|
Project-URL: Bug Tracker, https://github.com/Chr157i4n/PyTmcStepper/issues
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
11
10
|
Classifier: Operating System :: POSIX :: Linux
|
|
12
11
|
Classifier: Development Status :: 4 - Beta
|
|
13
12
|
Classifier: Intended Audience :: Developers
|
|
14
13
|
Classifier: Natural Language :: English
|
|
15
14
|
Classifier: Topic :: System :: Hardware :: Hardware Drivers
|
|
16
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.10
|
|
17
16
|
Description-Content-Type: text/markdown
|
|
18
17
|
License-File: LICENSE
|
|
19
18
|
Requires-Dist: pyserial
|
|
@@ -127,21 +126,21 @@ is split into their own classes to be able to support the diverse methods.
|
|
|
127
126
|
|
|
128
127
|
The EnableControl module controls the motor current output. It has a function `set_motor_enabled` with one boolean parameter. This function is used to enable or disable the Motor current output.
|
|
129
128
|
|
|
130
|
-
EnableControl | Class
|
|
131
|
-
-- | --
|
|
129
|
+
EnableControl | Class | Driver | Notes
|
|
130
|
+
-- | -- | -- | --
|
|
132
131
|
Pin | [TmcEnableControlPin](src/tmc_driver/enable_control/_tmc_ec_pin.py) | all | the EN Pin of the Driver needs to be connected to a GPIO of the Pi
|
|
133
|
-
TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py)
|
|
132
|
+
TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py) | all | the EN Pin needs to be connected to GND.<br />On the TMC2209 this enables current Output on Startup!<br />On the TMC2240 this works fine, because TOff is per default 0 (off).
|
|
134
133
|
|
|
135
134
|
### MotionControl
|
|
136
135
|
|
|
137
136
|
The MotionControl module controls the motion of the motor. Before a movement the motor current output needs to be enabled by the [EnableControl](#enablecontrol) module.
|
|
138
137
|
|
|
139
|
-
MotionControl | Class
|
|
140
|
-
-- | --
|
|
141
|
-
STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py)
|
|
142
|
-
STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py)
|
|
143
|
-
VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py)
|
|
144
|
-
STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py)
|
|
138
|
+
MotionControl | Class | Driver | Notes
|
|
139
|
+
-- | -- | -- | --
|
|
140
|
+
STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py) | all | the STEP and DIR pin of the driver must each be connected to a GPIO of the Pi
|
|
141
|
+
STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py) | all | only the STEP pin needs to be connected to a GPIO of the Pi.<br />The direction is controlled via the Register.
|
|
142
|
+
VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py) | TMC220x | the Direction and Speed is controlled via Register. But VActual does only allow setting a speed and therefore cannot control positioning of the Motor.
|
|
143
|
+
STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py) | all | In contrast to STEP/DIR, the step pin is controlled by PWM. This reduces the load on the CPU, but does not allow precise positioning (similar to the VACTUAL).<br />STEP must be connected to a PWM-capable pin for this purpose
|
|
145
144
|
|
|
146
145
|
Further methods of controlling the motion of a motor could be:
|
|
147
146
|
|
|
@@ -151,10 +150,10 @@ Further methods of controlling the motion of a motor could be:
|
|
|
151
150
|
|
|
152
151
|
### Com
|
|
153
152
|
|
|
154
|
-
Com | Class
|
|
155
|
-
-- | --
|
|
156
|
-
UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py)
|
|
157
|
-
SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py)
|
|
153
|
+
Com | Class | Driver | Notes
|
|
154
|
+
-- | -- | -- | --
|
|
155
|
+
UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py) | all | Communication via UART (RX, TX). See [Wiring](#uart)<br />[pyserial](https://pypi.org/project/pyserial) needs to be installed
|
|
156
|
+
SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py) | TMC2240 | Communication via SPI (MOSI, MISO, CLK, CS). See [Wiring](#spi)<br />[spidev](https://pypi.org/project/spidev) needs to be installed
|
|
158
157
|
SPI over FT232H | [TmcComSpiFtdi](src/tmc_driver/com/_tmc_com_spi_ftdi.py) | TMC2240 | Communication via SPI using a FT232H. This can be used on any OS.<br />[pyftdi](https://pypi.org/project/pyftdi) needs to be installed
|
|
159
158
|
|
|
160
159
|
## Wiring
|
|
@@ -254,21 +253,18 @@ So you don't need to connect anything to the Vio pin of the driver.
|
|
|
254
253
|
|
|
255
254
|
### Micropython
|
|
256
255
|
|
|
257
|
-
|
|
258
|
-
Then you can run a demo script by using
|
|
256
|
+
The lib is also compatible with MicroPython. For using it with Micropython the VSCode addon [MicroPico](https://marketplace.visualstudio.com/items?itemName=paulober.pico-w-go) is used. Use the Upload Project function to upload the src folder and the needed lib folder.
|
|
259
257
|
|
|
260
|
-
|
|
258
|
+
the needed libs, which are not builtin in Micropython are:
|
|
261
259
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
260
|
+
Lib | available on MIP
|
|
261
|
+
-- | --
|
|
262
|
+
abc | yes
|
|
263
|
+
enum | no
|
|
264
|
+
threading | yes
|
|
265
|
+
types | yes
|
|
268
266
|
|
|
269
|
-
|
|
270
|
-
python -m mpremote connect COM4 run .\demo\micropython\demo_script_tmc2240_03_basic_movement.py
|
|
271
|
-
```
|
|
267
|
+
You can also use MicroPico to run the demo script by opening one and then pressing Run on the bottom left corner
|
|
272
268
|
|
|
273
269
|
## Usage
|
|
274
270
|
|
|
@@ -304,15 +300,15 @@ If you encounter any problems, feel free to open an issue (ENG/GER).
|
|
|
304
300
|
Please don't send any E-Mails to me. Pls use Github, so that i don't need to answer the same question multiple times.
|
|
305
301
|
I reserve the right not to answer E-Mails.
|
|
306
302
|
|
|
307
|
-
Problem
|
|
308
|
-
--
|
|
309
|
-
FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0'
|
|
310
|
-
PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0'
|
|
311
|
-
"TMC2209: UART Communication Error"
|
|
312
|
-
"TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes"
|
|
313
|
-
"TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes"
|
|
314
|
-
"TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes"
|
|
315
|
-
"the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits
|
|
303
|
+
Problem | Solution
|
|
304
|
+
-- | --
|
|
305
|
+
FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0' | depending on your Raspberry Pi version, you need to enable the Serial Port <br /> run `sudo raspi-config` in your terminal. <br /> there go to '3 Interface Options' -> 'P3 Serial Port' <br /> Would you like a login shell to be accessible over serial? No <br /> Would you like the serial port hardware to be enabled? Yes <br /> Finish and then reboot
|
|
306
|
+
PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0' | you need to give the permission to acces the Serial Port to your current user <br /> You may need to add your user (pi) to the dialout group with `sudo usermod -a -G dialout pi` and then relog. <br /> If that does not work, make sure that your user has read/write permissions on the dev file `/dev/serial0` by calling `sudo chmod 660 /dev/serial0`.
|
|
307
|
+
"TMC2209: UART Communication Error" | You can use the 'debug_script_01_uart_connection' script to get a better reading on the received bytes and troubleshoot your problem
|
|
308
|
+
"TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes" | only 4 total bytes received indicates, that the Raspberry Pi receives its own data, but nothing from the TMC driver. This happens if RX and TX are connected properly, but the TMC driver has no power
|
|
309
|
+
"TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes" | 0 total bytes received indicates, a problem with your wiring or your Raspberry Pi. This happens if TX is not connected
|
|
310
|
+
"TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes" | this indicates, the Raspberry Pi received only zeroes. This happens if only RX is connected and TX not
|
|
311
|
+
"the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits | Make sure the UART ist properly connected to the TMC driver and the driver is powered and working. <br /> Make sure login shell (console) over serial is disabled.
|
|
316
312
|
|
|
317
313
|

|
|
318
314
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
README.md
|
|
3
3
|
pyproject.toml
|
|
4
|
-
setup.cfg
|
|
5
4
|
src/PyTmcStepper.egg-info/PKG-INFO
|
|
6
5
|
src/PyTmcStepper.egg-info/SOURCES.txt
|
|
7
6
|
src/PyTmcStepper.egg-info/dependency_links.txt
|
|
@@ -9,11 +8,11 @@ src/PyTmcStepper.egg-info/requires.txt
|
|
|
9
8
|
src/PyTmcStepper.egg-info/top_level.txt
|
|
10
9
|
src/tmc_driver/__init__.py
|
|
11
10
|
src/tmc_driver/_tmc_exceptions.py
|
|
12
|
-
src/tmc_driver/_tmc_gpio_board.py
|
|
13
11
|
src/tmc_driver/_tmc_logger.py
|
|
14
12
|
src/tmc_driver/_tmc_math.py
|
|
15
13
|
src/tmc_driver/_tmc_stallguard.py
|
|
16
14
|
src/tmc_driver/_tmc_stepperdriver.py
|
|
15
|
+
src/tmc_driver/_tmc_validation.py
|
|
17
16
|
src/tmc_driver/tmc_2208.py
|
|
18
17
|
src/tmc_driver/tmc_2209.py
|
|
19
18
|
src/tmc_driver/tmc_220x.py
|
|
@@ -42,6 +41,13 @@ src/tmc_driver/reg/_tmc2209_reg.py
|
|
|
42
41
|
src/tmc_driver/reg/_tmc220x_reg.py
|
|
43
42
|
src/tmc_driver/reg/_tmc224x_reg.py
|
|
44
43
|
src/tmc_driver/reg/_tmc_reg.py
|
|
44
|
+
src/tmc_driver/tmc_gpio/__init__.py
|
|
45
|
+
src/tmc_driver/tmc_gpio/_tmc_gpio_board_base.py
|
|
46
|
+
src/tmc_driver/tmc_gpio/_tmc_gpio_board_ftdi.py
|
|
47
|
+
src/tmc_driver/tmc_gpio/_tmc_gpio_board_gpiozero.py
|
|
48
|
+
src/tmc_driver/tmc_gpio/_tmc_gpio_board_micropython.py
|
|
49
|
+
src/tmc_driver/tmc_gpio/_tmc_gpio_board_periphery.py
|
|
50
|
+
src/tmc_driver/tmc_gpio/_tmc_gpio_board_rpi_gpio.py
|
|
45
51
|
tests/test_tmc2209.py
|
|
46
52
|
tests/test_tmc2240.py
|
|
47
53
|
tests/test_tmc_com_spi.py
|
|
@@ -49,4 +55,5 @@ tests/test_tmc_com_uart.py
|
|
|
49
55
|
tests/test_tmc_ec_pin.py
|
|
50
56
|
tests/test_tmc_math.py
|
|
51
57
|
tests/test_tmc_modules.py
|
|
52
|
-
tests/test_tmc_move.py
|
|
58
|
+
tests/test_tmc_move.py
|
|
59
|
+
tests/test_tmc_set_current.py
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
"""Exceptions module"""
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
class TmcException(Exception):
|
|
4
5
|
"""Base class for all TMC exceptions"""
|
|
5
6
|
|
|
7
|
+
|
|
6
8
|
class TmcDriverException(TmcException):
|
|
7
9
|
"""Base class for all TMC driver exceptions"""
|
|
8
10
|
|
|
11
|
+
|
|
9
12
|
class TmcComException(TmcException):
|
|
10
13
|
"""Base class for all TMC communication exceptions"""
|
|
11
14
|
|
|
15
|
+
|
|
12
16
|
class TmcMotionControlException(TmcException):
|
|
13
17
|
"""Base class for all TMC motion control exceptions"""
|
|
14
18
|
|
|
19
|
+
|
|
15
20
|
class TmcEnableControlException(TmcException):
|
|
16
21
|
"""Base class for all TMC enable control exceptions"""
|