PySerial can read but not write

筅森魡賤 提交于 2020-01-06 04:36:20

问题


I'm trying to use PySerial to connect to an FTDI FT232R chip. I have verified communication with my RealTerm and, using RealTerm, can both send and receive data. However, my implementation in Python can only receive data.

I am trying to write using this line:

for i in range(0,100):
    print "Loop "+str(i)
    print "Sending byte"
    ser.flush()
    print ser.write("B".encode('ascii'))
    time.sleep(1)

回答1:


Comunication depends on the configuration of the chip, the connecting cable and the parameters of PySerial.

This looks like a problem of the connections of the cable or the communications protocol (handshaking).

This last one is the simplest to check. It can be Xon/Xoff, hardware, or none, but it has to be the same at both sides.

If the handshaking is by hardware it depends on other lines of the cable besides trx and rcv.



来源:https://stackoverflow.com/questions/15476536/pyserial-can-read-but-not-write

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!