使用 'GNET' 协议与 USB 设备进行串行通信

serial communication with USB device using 'GNET' protocol

我有一个 USB 设备 specification。第 22 页描述了应该用于与设备交互的 GNET protocol

连接正常,但设备没有给我任何响应,所以我想我没有向它发送正确的数据,可能是错过了握手?

来自规范

Support TTY (TELE TYPE) OPERATION - Use TTY to send commands and messages

Use ASCII value for each field and use Separator "," between two Fields.

connect_and_send.py

import serial

port = "COM3"
baud = 9600

ser = serial.Serial(port, baud, timeout=1)

if ser.isOpen():
    print(ser.name + ' is open...')

# STX, N, CR
to_send = b'\x02\x4e\x0d'
print "Sending {}".format(to_send)
ser.write(to_send)
out = ser.read()
print('Receiving...'+out)

COM3 是正确的端口:

如有任何帮助和指导,我们将不胜感激。

从未 使用\x4e,这是来自设备的否定确认
尝试

to_send = b'\x02F\x0d'

获取固件版本

最后我联系了供应商,问题是波特率设置错误。从 9600 更改为 19200 解决了问题。