Closed myomv100 closed 5 years ago
Simply the mistake was in my code and my virtual-machines configurations because I created a serial bridge between the two VMs. The working code is on both machines :
import threading, serial
from hdlcontroller.hdlcontroller import HDLController
from yahdlc import *
ser = serial.Serial(port = "/dev/ttyS2", baudrate = 115200)
def read_serial():
return ser.read(ser.in_waiting)
hdlc_c = HDLController(read_serial, ser.write)
def readHDLC(ser,hdlc):
while 1:
hdlc.start()
recvd = hdlc.get_data()
print(recvd)
hdlc.stop()
def writeHDLC(ser,hdlc):
while 1:
hdlc.start()
strInput = input(">")
hdlc.send(strInput)
hdlc.stop()
readThread = threading.Thread(target=readHDLC,args=(ser,hdlc_c))
writeThread = threading.Thread(target=writeHDLC,args=(ser,hdlc_c))
readThread.start()
writeThread.start()
Hi @myomv100,
Glad to see that you have found a solution to your issue.
Let me know if you need help with something else.
Cheers.
Hi
I have setup a serial connection between two Linux machine and tried to communicate using this HDLC controller but sent message couldn't be received. The sender keeps trying to send the frame over and over again with no ACK signal from the receiver.
The code that I used is derived from your test with little additions. I am not sure why I could not get it to work. The code on both machines is this:
Best