I am trying to send LinBus protocol serial commands over the ethernet port of my Raspberry pi to a linear actuator connected on the other end via ethernet.
Currently, I am using pyserial script to connect to /dev/ttyAMA0 on the pi and using socat to intercept traffic on that port and send it to the ethernet interface.
So far my test python script is:
import serialserialport = serial.Serial("/dev/ttyAMA0", 5500, timeout=0.5)data="\x03"serialport.write(data.encode())reply=serialport.readlines(1)print(reply)
I am using the following socat command:
sudo socat pty, link=/dev/ttyAMA0, raw tcp:10.1.1.30:5501
the ethernet interface has been configured to have the static ip as described in the socat command.
When I run the socat command I receive:
socat[852] E read(7, 0x143ad50, 8192): Connection refused
The Raspberry pi has been configured for UART and the /dev/ttyAMA0 port is shown when using ls /dev
Essentially, I am trying to send a special linbus frame containing serial byte commands such as "0x8000" from a Python script through the ethernet port to a linear actuator which is listening on the other end.
Am I approaching this the wrong way? If so, what do I need to do?
Thank you for your help!