OneShotTriggersDtr485

http://groups.google.com/group/comp.os.linux.development.system/browse_frm/thread/d2f563a07cad5f28/762f2fe665b9cf6d?lnk=gst&q=RS485&rnum=7#762f2fe665b9cf6d

One shot rs232 falling edge triggers 485
Trigger RS485 Olav.....I went thru the very same thought process you are going thru. I also use a rs485 network in the half duplex mode (on 2 wires) communicating with some 8051 based controllers....after much work the solution i used was a VERY SIMPLE hardware solution....turns out there are times when a few parts replace alot of software and result in a much more reliable system....since i had built a simple rs232 to rs485 converter (worked the same as yours...DTR enabled the rs485 tranmit) i just added a single one shot that was triggered off the falling edge of the rs232 signal and whose output enabled the rs485 transmit....set the one shot for the byte time and your DONE!!!! now i fought this solution for a few weeks as i am a software guy at heart but when i saw how simple it was in the hardware domain and versus how complex it was in the software domain i switched. This approach allowed me to use standard drivers and also the standard linux time slice scheduler rather then the SCHED_FIFO mod to be able to get the execution resoltion i needed to control the DTR lead from user space.

Digital pot
Use a RC combination to set the length of the one shot. There probably are IC's that can be clocked for variable one shot time lengths.

asdf
More so than you have realized yet. I'm not familiar with the Linux implementation, but most serial drivers consider the buffer flushed, and done as soon as the last byte to be transmitted as been sent to the uart. The problem is, it takes about 1mS (9600 baud) for the uart to finish transmitting the character. If your using a buffered uart, the problem gets much worse!

If you manage to get a fast DTR shut off routine working, you WILL cut off the last few bits of your last character. Been there, done that.

The easiest solution is to not control the 485 transmitter in software. Use a one shot circuit in the RS-232 to 485 converter to do the dirty work for you.

B&B has just such an animal, and it works great! We use about 20-30 485TBLED units per year. DB25 for RS-232 side, Screw terminals for the 485 side.

Links
RS485