Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a serial-over-socket interface #100

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

toqduj
Copy link

@toqduj toqduj commented Nov 25, 2023

I have a TMCM board connected to a machine network via an ethernet-to-serial converter. These take socket connections and pass them on to the RS232 or (in my case) RS485 serial port.

I found some old code in an abandoned branch on here, polished it up, and made it resemble the structure of the serial and socketcan connections. Given that someone else went down the same rabbit-hole a while ago, and since connecting motor controllers to a TCP/IP network like this is quite common in my experience, it might be of use to someone else.

It has been tested with the following code block:

import pytrinamic
from pytrinamic.connections import ConnectionManager
from pytrinamic.modules import TMCM6214
import time
pytrinamic.show_info()
connectionManager=ConnectionManager("--interface socket_serial_tmcl --port 192.168.0.253:4016 --host-id 3 --module-id 0")
with connectionManager.connect() as myInterface:
    module = TMCM6214(myInterface)
    motor_0 = module.motors[0]
    print(motor_0.get_position_reached())

@toqduj
Copy link
Author

toqduj commented Nov 30, 2023

p.s. this works better if the module_id is 1. If set to zero, PyTrinamic does not communicate well.

@trinamic-bp
Copy link
Contributor

trinamic-bp commented Dec 7, 2023

Hi @toqduj, thank you for your PR and the effort you put into it. We are packed with work at the moment, but can hopefully soon find some time to look into this.

@toqduj
Copy link
Author

toqduj commented Dec 10, 2023

hey @trinamic-bp, looking forward to seeing this in main. I've built a library to expose the motor control boards over the EPICS Channel-Access virtual communications interface, commonly found at large science facilities such as synchrotrons and neutron sources (see: https://github.com/BAMresearch/Trinamic_TMCM6214_TMCL_IOC ).
I hope the takeover by Maxim / Analog Devices does not mean that the support and development of these boards will disappear soon, they're amazing boards.

@trinamic-bp
Copy link
Contributor

With Maxim and Analog Devices we are definitely more careful about copyright and IP rights. As the basis of your work was already code from Trinamic, you are probably fine if we add the Trinamic/Analog Devices copyright notice at the tope of the "pytrinamic/connections/socket_tmcl_interface.py" file?

@toqduj
Copy link
Author

toqduj commented Dec 22, 2023

yes, that's fine by me. I didn't spend too much time on it, but it has been working well for the past few weeks of testing on two of our systems. Here's hoping for native ethernet interfaces on your future boards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants