public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* Enabling auto RS485 half-duplex control
@ 2008-12-17 21:24 Matthias Fuchs
  2008-12-18  3:32 ` Theodore Tso
  2008-12-18  9:35 ` Wolfram Sang
  0 siblings, 2 replies; 7+ messages in thread
From: Matthias Fuchs @ 2008-12-17 21:24 UTC (permalink / raw)
  To: linux-serial

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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Enabling auto RS485 half-duplex control
  2008-12-17 21:24 Enabling auto RS485 half-duplex control Matthias Fuchs
@ 2008-12-18  3:32 ` Theodore Tso
  2008-12-18  5:59   ` Matthias Fuchs
  2008-12-18 15:51   ` Grant Edwards
  2008-12-18  9:35 ` Wolfram Sang
  1 sibling, 2 replies; 7+ messages in thread
From: Theodore Tso @ 2008-12-18  3:32 UTC (permalink / raw)
  To: Matthias Fuchs; +Cc: linux-serial

On Wed, Dec 17, 2008 at 10:24:13PM +0100, Matthias Fuchs wrote:
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Enabling auto RS485 half-duplex control
  2008-12-18  3:32 ` Theodore Tso
@ 2008-12-18  5:59   ` Matthias Fuchs
  2008-12-18 15:51   ` Grant Edwards
  1 sibling, 0 replies; 7+ messages in thread
From: Matthias Fuchs @ 2008-12-18  5:59 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-serial

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


> On Wed, Dec 17, 2008 at 10:24:13PM +0100, Matthias Fuchs wrote:
> > 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Enabling auto RS485 half-duplex control
  2008-12-17 21:24 Enabling auto RS485 half-duplex control Matthias Fuchs
  2008-12-18  3:32 ` Theodore Tso
@ 2008-12-18  9:35 ` Wolfram Sang
  2008-12-18 23:42   ` Matthias Fuchs
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2008-12-18  9:35 UTC (permalink / raw)
  To: Matthias Fuchs; +Cc: linux-serial

[-- Attachment #1: Type: text/plain, Size: 547 bytes --]

Hi Matthias,

> 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

-- 
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Enabling auto RS485 half-duplex control
  2008-12-18  3:32 ` Theodore Tso
  2008-12-18  5:59   ` Matthias Fuchs
@ 2008-12-18 15:51   ` Grant Edwards
  2008-12-19  4:10     ` Theodore Tso
  1 sibling, 1 reply; 7+ messages in thread
From: Grant Edwards @ 2008-12-18 15:51 UTC (permalink / raw)
  To: linux-serial

On 2008-12-18, Theodore Tso <tytso@mit.edu> wrote:
> On Wed, Dec 17, 2008 at 10:24:13PM +0100, Matthias Fuchs wrote:
>> 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,

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?

> 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.

> 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.  :-)

-- 
Grant Edwards                   grante             Yow! I'm in direct contact
                                  at               with many advanced fun
                               visi.com            CONCEPTS.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Enabling auto RS485 half-duplex control
  2008-12-18  9:35 ` Wolfram Sang
@ 2008-12-18 23:42   ` Matthias Fuchs
  0 siblings, 0 replies; 7+ messages in thread
From: Matthias Fuchs @ 2008-12-18 23:42 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-serial

> Hi Matthias,
>
> > 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.

Ok, I picked that up. Please see my patch coming up in a minute.

Matthias

>
> Regards,
>
>    Wolfram

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Enabling auto RS485 half-duplex control
  2008-12-18 15:51   ` Grant Edwards
@ 2008-12-19  4:10     ` Theodore Tso
  0 siblings, 0 replies; 7+ messages in thread
From: Theodore Tso @ 2008-12-19  4:10 UTC (permalink / raw)
  To: Grant Edwards; +Cc: linux-serial

On Thu, Dec 18, 2008 at 03:51:36PM +0000, Grant Edwards wrote:
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-12-19  4:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-17 21:24 Enabling auto RS485 half-duplex control Matthias Fuchs
2008-12-18  3:32 ` Theodore Tso
2008-12-18  5:59   ` Matthias Fuchs
2008-12-18 15:51   ` Grant Edwards
2008-12-19  4:10     ` Theodore Tso
2008-12-18  9:35 ` Wolfram Sang
2008-12-18 23:42   ` Matthias Fuchs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox