Enabling auto RS485 half-duplex control
Hi,
some Exar UARTs like the XR16C2850 support a feature called auto RS485 half-duplex control. In this mode the RTS line has a special role when using the UART for RS485 communication.
I did not find a way to enable this mode through the standard serial driver. The UART is is detected correctly but there seems to be no way to enable this mode out of the box.
So what's the best way to implement this?
A new ioctl? Any idea?
Matthias
Quoted 6 lines · Matthias Fuchs
Hi,
some Exar UARTs like the XR16C2850 support a feature called auto RS485 half-duplex control. In this mode the RTS line has a special role when using the UART for RS485 communication.
So I haven't maintained the serial driver for a long time, but when I did, I refused to try to implement hardware half-duplex control because there was absolutely no standards in this space. Which RS-232 lines are involved wasn't standardized, and there was often very strange timing restrictions as well. Some devices required there to be a minimum delay of XX milliseconds between when RTS is raised and when DTR is raised. Other devices have a maximum time between when one side raises RTS and the others side raises DTR.
So the challenge is designing an interface for half-duplex which is sufficiently general that it will actually work for all/most of the half-dozen people in the world who still care about half-ruplex RS-232 communications. :-)
- Ted
Hi Ted,
you missunderstood me. This special UART does all the required stuff in hardware. You only have to enable this mode once by writing some magic to a UART register. From that time on the UART will automatically assert the RTS# line when transmitting.
I am not talking about a software implementation. Your arguments deal with a software implementation where you have to do it all by hand, which will not work safely as you mentioned.
Matthias
Quoted 27 lines · Matthias Fuchs
Quoted 6 lines
Hi,
some Exar UARTs like the XR16C2850 support a feature called auto RS485 half-duplex control. In this mode the RTS line has a special role when using the UART for RS485 communication.
So I haven't maintained the serial driver for a long time, but when I did, I refused to try to implement hardware half-duplex control because there was absolutely no standards in this space. Which RS-232 lines are involved wasn't standardized, and there was often very strange timing restrictions as well. Some devices required there to be a minimum delay of XX milliseconds between when RTS is raised and when DTR is raised. Other devices have a maximum time between when one side raises RTS and the others side raises DTR.
So the challenge is designing an interface for half-duplex which is sufficiently general that it will actually work for all/most of the half-dozen people in the world who still care about half-ruplex RS-232 communications. :-)
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Matthias,
Quoted 7 lines
I did not find a way to enable this mode through the standard serial driver. The UART is is detected correctly but there seems to be no way to enable this mode out of the box.
So what's the best way to implement this?
A new ioctl? Any idea?
See commmit c26c56c0f40e200e61d1390629c806f6adaffbcc. I think any solution to activate RS485 should be based on this.
Regards,
Wolfram
Signature · 2 lines
Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de Pengutronix - Linux Solutions for Science and Industry
Quoted 8 lines · Theodore Tso
Quoted 6 lines · Matthias Fuchs
Hi,
some Exar UARTs like the XR16C2850 support a feature called auto RS485 half-duplex control. In this mode the RTS line has a special role when using the UART for RS485 communication.
Quoted 4 lines
So I haven't maintained the serial driver for a long time, but when I did, I refused to try to implement hardware half-duplex control because there was absolutely no standards in this space. Which RS-232 lines are involved wasn't standardized,
Yes there are. The standard is that RTS is asserted when one whishes to transmit (and de-asserted when one has finished transmitting). Optionally, one waits for CTS to be asserted before transmitting. Isn't that the definition of RTS and CTS that's in the standard?
Quoted 5 lines
and there was often very strange timing restrictions as well. Some devices required there to be a minimum delay of XX milliseconds between when RTS is raised and when DTR is raised. Other devices have a maximum time between when one side raises RTS and the others side raises DTR.
I've been doing half-duplex stuff for 30 years, and I've never seen DTR used in half-duplex flow control.
Quoted 4 lines
So the challenge is designing an interface for half-duplex which is sufficiently general that it will actually work for all/most of the half-dozen people in the world who still care about half-ruplex RS-232 communications. :-)
Signature · 3 lines
Grant Edwards grante Yow! I'm in direct contact
at with many advanced fun
visi.com CONCEPTS.Quoted 7 lines
Hi Matthias,
Quoted 5 lines
I did not find a way to enable this mode through the standard serial driver. The UART is is detected correctly but there seems to be no way to enable this mode out of the box.
Quoted 5 lines
Quoted 2 lines
So what's the best way to implement this?
A new ioctl? Any idea?See commmit
c26c56c0f40e200e61d1390629c806f6adaffbcc. I think any solution to activate RS485 should be based on this.
Ok, I picked that up. Please see my patch coming up in a minute.
Matthias
Quoted 4 lines
Regards,
Wolfram
Quoted 5 lines · Grant Edwards
Yes there are. The standard is that RTS is asserted when one whishes to transmit (and de-asserted when one has finished transmitting). Optionally, one waits for CTS to be asserted before transmitting. Isn't that the definition of RTS and CTS that's in the standard?
There's a standard, which is not necessarily well adhered to. Heck, full-duplex RTS/CTS standard was used by thousands if not millions of modems in flagrent violation of the RS-232 standard for some 10 years or more before TIA-232-E was released and bowed to reality.
I know I received all sorts of requests for very strange implementations of half-duplex, with people sending me product specs with all manner of requirements, both in terms of which RS-232 lines were used (which may have been confusions caused by the fact that many systems ship with random and wondrous DB9->DB25 cables, or strange DTE/DCE conversion cables), but also in terms of mutually exclusive requirements in terms of minimum and maximum turnaround times.
Someday when I'm board I can try to dig the requests out of the archives, but I can definitely say that people asked for very strange things, much of which was not in the standard (and as I pointed out, until 1990 traditional full-duplex RTS/CTS hardware flow control was not recognized by the RS-232 standard either).
- Ted