My target device need the letter "R" sent before sending a response. With the USB adapter connected, it works fine and I get the response as expected but with the RS485 Pi I get nothing.
I have connected the RS485 Pi via the FTDI USB adapter to a PC running TeraTerm. With this I am able to see anything typed into TeraTerm on the Pi, but the character sent by the Pi does not appear in TeraTerm. This is leading me to the conclusion that it's not transmitting, but receiving fine.
Code below:
#!/usr/bin/pythonimport timeimport serial ser = serial.Serial( port='/dev/ttyAMA0', baudrate = 19200, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=1 )ser.reset_input_buffer()ser.reset_output_buffer()time.sleep(2) def read(): while 1: ser.write("R\n") x=ser.readline() print x time.sleep(1)read()
Any suggestions? I've tried it with and without the 120ohm termination resistor with no change.
Any help offered would be much appreciated.