-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature_add_tmc9660_reg'
- Loading branch information
Showing
12 changed files
with
12,388 additions
and
3 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
examples/evalboards/TMC9660/reg_app/headless/tmc9660_3ph_eval_min_demo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
################################################################################ | ||
# Copyright © 2024 Analog Devices Inc. All Rights Reserved. | ||
# This software is proprietary to Analog Devices, Inc. and its licensors. | ||
################################################################################ | ||
"""Minimal example on how to use PyTrinamic with TMC9660-3PH-EVAL/TMC9660-STEPPER-EVAL. | ||
The TMC9660-3PH-EVAL/TMC9660-STEPPER-EVAL is used in headless mode for this example. | ||
Note: To run this script the EVAL first needs an uploaded/burned configuration | ||
and the register app must have been started. | ||
--------+ | ||
| USB-UART Cable - Connected to the machine running this script. | ||
+--|-----------------+ | ||
| | | | ||
| | | ||
|TMC9660-3PH-EVAL or | | ||
|TMC9660-STEPPER-EVAL| | ||
+--------------------+ | ||
""" | ||
|
||
import time | ||
|
||
from pytrinamic.connections import ConnectionManager | ||
|
||
from pytrinamic.ic import TMC9660 | ||
|
||
|
||
|
||
com_port = "COM5" # Note: Change this to the com port of the USB-UART cable used. | ||
|
||
with ConnectionManager(f"--interface serial_tmcl --port {com_port}").connect() as my_interface: | ||
|
||
tmc9660 = TMC9660(my_interface) | ||
|
||
tmc9660.write(TMC9660.MCC.MOTOR_CONFIG.TYPE.choice["NONE No motor"]) | ||
tmc9660.write(TMC9660.MCC.MOTOR_CONFIG.N_POLE_PAIRS, 4) | ||
|
||
for _ in range(20): | ||
print(f"I0 = {tmc9660.read(TMC9660.MCC.ADC_I1_I0_SCALED.ADC_SCALED_I0)}") | ||
print(f"I1 = {tmc9660.read(TMC9660.MCC.ADC_I1_I0_SCALED.ADC_SCALED_I1)}") | ||
time.sleep(0.2) |
37 changes: 37 additions & 0 deletions
37
examples/evalboards/TMC9660/reg_app/with_landungsbruecke/tmc9660_3ph_eval_min_demo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
################################################################################ | ||
# Copyright © 2024 Analog Devices Inc. All Rights Reserved. | ||
# This software is proprietary to Analog Devices, Inc. and its licensors. | ||
################################################################################ | ||
"""Example on how to use TMC9660-3PH-EVKIT. | ||
Note: To run this script the TMC9660-3PH-EVAL first needs an uploaded/burned configuration | ||
and the register app must have been started. | ||
+-----+ +-------------------+ | ||
USB | |==| | | ||
-------| |==| | | ||
Connected to the machine | |==| | | ||
running this script. |LB |==|TMC9660-3PH-EVAL | | ||
+-----+ +-------------------+ | ||
""" | ||
|
||
import time | ||
|
||
from pytrinamic.connections import ConnectionManager | ||
|
||
from pytrinamic.ic import TMC9660 | ||
from pytrinamic.evalboards import TMC9660_3PH_eval | ||
|
||
|
||
with ConnectionManager().connect() as my_interface: | ||
|
||
tmc9660_eval = TMC9660_3PH_eval(my_interface) | ||
|
||
tmc9660_eval.write(TMC9660.MCC.MOTOR_CONFIG.TYPE.choice["BLDC Three phase BLDC motor"]) | ||
tmc9660_eval.write(TMC9660.MCC.MOTOR_CONFIG.N_POLE_PAIRS, 4) | ||
|
||
for _ in range(20): | ||
print(f"I0 = {tmc9660_eval.read(TMC9660.MCC.ADC_I1_I0_SCALED.ADC_SCALED_I0)}") | ||
print(f"I1 = {tmc9660_eval.read(TMC9660.MCC.ADC_I1_I0_SCALED.ADC_SCALED_I1)}") | ||
time.sleep(0.2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.