问题
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