Hello i tryed to work with COM-Port via Python3 serial. I send and must receive a message
Serial settings is

Code: Select all

uart = serial.Serial()
uart.port = "/dev/ttyS2"
uart.baudrate = 115200
uart.timeout = 1
 

Sending and receiving is

Code: Select all

uart.open()
uart.write(pack1)
sleep(1)
addr1 = uart.readline()
uart.close()

I control sending and receiving through USB Virtual Com port which connected to terminal. Sending is "Ok"
My device currently send a response to my writed pack. I see it on terminal, response must be A0 01 01 00 00 13 FE FE 68 30 AA AA AA AA AA AA AA 03 03 81 0A 01 D0 16 65 10. But my uart.readlines collects this data
b'\xa0\x01\x01\x00\x00\x0bh\x1a\x01\x00\x00\x90 \xc3\x01\xc8\xfch\x10'
['0xa0', '0x1', '0x1', '0x0', '0x0', '0xb', '0x68', '0x1a', '0x1', '0x0', '0x0', '0x90', '0x20', '0xc3', '0x1', '0xc8', '0xfc', '0x68', '0x10'].
And its wrong. So on ttyS2 RxD i saw right packet but in my prog i read wrong data. Where is trouble?