Take the 2-minute tour ×

I'm trying to communicate over the serial interface RS-485 on a Linux machine with kernel 2.6.39. I'm using this breakout board together with the pySerial module. When I write something via the interface often my data gets corrupted. On the product page of the breakout board someone mentioned:


I discovered that the RTS line shortly gets high when I write bytes, but gets low immediately after writing. How do I keep that line high (for a bit longer)?

share|improve this question
Usually the Linux serial port driver has to be configured into RS-485 mode using the TIOCSRS485 ioctl. This ioctl takes a data structure that specifies how the RTS handshake signal is repurposed and should control the transmitter. There's a parameter to specify the hold-up time that you're asing for. Read lxr.free-electrons.com/source/Documentation/serial/… You probably should do a get ioctl to read the structure, increase that hold-up time, and do a set ioctl. –  sawdust Jun 10 at 0:59

2 Answers 2

After a lot of trial and error I think I found the problem. My presumption is that the RS-485 driver off the kernel is setting the RTS line to high for a short moment when I use serial.write(). serial.write() writes characters to /dev/ttyS1. From this moment the Linux driver for RS-485 controlls the serial bus in order to write the characters. During this operation it sets the RST line during the actual write moment for a short period to high.

I can't controll this write operation on a higher level, I think I've to hack into the driver or connect the RTS line to a different GPIO which I can control.

share|improve this answer

You can set RTS manually with:


and then clear it after a 25ms delay with:

share|improve this answer
No I tried it and it doesn't work. Read my answer for the reason. –  OrangeTux Oct 23 '13 at 9:38
You might have to disable flow control and do it manually with setRTS –  jramirez Oct 23 '13 at 17:15

Your Answer


