(ie. one board ethernet port is connected to another board ethernet port)
ethernet port ??? I thought it was suppose to be RS-485 I.C. converter and in your code you are using the serial interface ????
You example code, one is the receiver and one is the transmitter, if you are using a RS-485 I.C. converter you do nothing with the RE and DE signal.
On your first post you connect DE to GPIO13 but you don't do anything with it. Where is your handshake ???
At least set DE and RE together with GPIO13.
On the transmitter set GPIO13 to 1
On the receiver set GPIO13 to 0
it is possible to handle the RS485 via ioctl with RTS but I tried it and it doesn't work very well.
https://armbedded.taskit.de/node/322
B.T.W. RTS is available on GPIO17.
or you could try pyserial rs485 class ( I never tried it)
Code: Select all
import serial.rs485
ser=serial.rs485.RS485(port='/dev/ttyAMA0',baudrate=9600,timeout=0.1)
ser.rs485_mode = serial.rs485.RS485Settings()
ser.write('a test'.encode('utf-8'))
You must enable the GPIO17 to be RTS