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.3.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.3-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tmc_uart-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 db88417ae356f767898b7cc06819dbd494c037cde7804e62f2cf5f3e67b9b088
MD5 f714250f95025618217b5e94ae4f2ba4
BLAKE2b-256 5284b028d30129077bd4ff455060bcbefaf584f69be0ba7944c45a3b0d447a8d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tmc_uart-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 21e9a2a57d55c8ee29fe355567453efdf9e469884df9291773041614f8f50c47
MD5 176fce2b738c41176a481451fe38868a
BLAKE2b-256 dd949ac14979348e62b1db360fb708dbe784eeae0e4d2f6c60ebc12dbb52141f

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