Skip to main content

Read/Write to Trinamic motion controller TMC5160 via the uart interface

Project description

A python package to read/write to registers to TMC motion controllers via the uart. This package includes register addresses for the TMC5160 as specified here:

https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC5160A_Datasheet_Rev1.14.pdf

Other TMC controllers could be adapted by providing the register include file with its specific register addresses.

There are some test scripts in the ./bin directory. Tested on both Windows and Raspberry PI with a USB/RS485 adapter to a custom board with a TMC5160 chip with uart pins broken out.

There are two read functions. read_int() and read_reg(). The first returns a 32 bit value and second returns a 4 byte object.

Repository can be found:

https://github.com/troxel/TMC_UART

Synopsis

from tmc_uart import TMC5160_UART
from tmc_uart import tmc5160_reg as reg

drvconf = { 'comm_dev':'/dev/ttyUSB0', 'baud':500000 }
drv = TMC5160_UART(drvconf)

mtr_id = 0

ifcnt0 =  drv.read_int(0, reg.IFCNT)
drv.write_reg(mtr_id,reg.GCONF,0x0000000C)
ifcnt1 =  drv.read_int(0, reg.IFCNT)
print("IFCNT before and after: {} {}".format(ifcnt0,ifcnt1))

gconf = drv.read_reg(mtr_id, reg.GCONF)
print("GONF = ",gconf)

xactual = drv.read_int(mtr_id,reg.XACTUAL)
print("XACTUAL = ",xactual)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tmc_uart-0.1.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tmc_uart-0.1.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file tmc_uart-0.1.2.tar.gz.

File metadata

  • Download URL: tmc_uart-0.1.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.3

File hashes

Hashes for tmc_uart-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a9c850705491756abd4efc69e029631c4cca2bbb87dc85a110deafe7e40d99b9
MD5 37c6d795e53abae376c84532a9487f3e
BLAKE2b-256 82b3e3571283390f17c81075d61ffe1e7924e09a752bde040a4c3c6099c22a7e

See more details on using hashes here.

File details

Details for the file tmc_uart-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tmc_uart-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.3

File hashes

Hashes for tmc_uart-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d0efda1d6db4e9d455f8cd06ffba9cbbca70da455eaefe1b2cd877d43a775080
MD5 2424e9e12dfaa65c8bba76609cd11093
BLAKE2b-256 3c4005469fe4a290cc74f053878f50f9593f9f0c96f81a51fb55369177ca70a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page