linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guido Classen <clagix@gmail.com>
To: linux-serial@vger.kernel.org
Subject: Re: RS485 implementation questions (primarly in atmel_serial.c)
Date: Tue, 29 Jan 2013 22:56:48 +0100	[thread overview]
Message-ID: <CAJa4H3cCwpsJr8urNPH0XWO9YruDpxs3a5sgRBS_hEteN5SEEw@mail.gmail.com> (raw)
In-Reply-To: <kdu8ur$kav$1@ger.gmane.org>

> Our Linux tty/serial drivers do support "plain" a RS-485 mode without
> pre/post RTS hold times (the plain RS-485 mode is supported by the
> UART itself).  The pre/post RTS hold times feature can be used from
> Linux applications, but to take advantage of those sort of features we
> don't use Linux tty/serial device drivers.  For many industrial I/O
> applications we've found it much simpler to avoid the termios/tty
> stuff and connect to the serial hardware via Ethernet and TCP/IP
> instead.
>
> Over the years we've found that the Unix "tty" API is rather
> ill-suited for doing things other than talking to terminals.  In other
> news, we've found that a screwdriver is ill-suited for doing things
> other than driving screws. :)

You are absolutely right, the "TTY" API is ill-suited for fieldbus style
half-duplex communication. But in my opinion this form of communication is
still very common and even today not every device has an ethernet connector.
So what are the consequences?

1. Don't use Linux at all for this purpose. For PCs and Server it may
be indeed the better solution to use TCP/IP instead. But for embedded
Linux the situation is different. One important application here is to
implement exactly these Ethernet/TCP/IP to "some lowlevel stuff"
boxes!

2. Sole Userspace software using Posix TTY API. This will work (more
or less) if the speed (baudrate) is relatively low and the time
between sending and receiving is long enough. You also can not benefit
from serial hardware which have special support for fieldbus style
communication like the Atmel AT91 USARTS.

3. Use some board specific drivers or modifications to the drivers and
Linux TTY stack (E.G. additional ioctls). I think this way is mostly
used in practically embedded Linux. Drawbacks are, that userspace
software must include support for each specific board it is intend to
run on.

4. The TIOCSRS485 ioctl may open new doors, but as I see there are
only few drivers implementing it.


Maybe someone else on this list will share his thoughts about this issues


>
> For example, our serial interfaces are used quite a bit in traffic and
> parking applications, but in those cases the long-haul connections are
> TCP/IP over fiber, and the serial ports are only used to communicate
> locally within a roadside cabinet.  To the user application, each of
> the serial devices (camera controller, inductive loop sensor, ramp
> light controller, card reader, gate arm, etc.) is just another network
> device addressed via an <ipaddr,ipport> tuple.
>
> Programmers seem to get themselves into much less trouble with the TCP
> socket API than they do with the tty API

That's crazy, It seems we are working almost with the same things. I am
a software developer and so I also prefer TCP. It's much simpler to
use and has a clean, portable API. In new installations, TCP is quite
common. We also have fiber optics and copper rings for long-haul
connections. But there also very old copper wires which are to long to
be used with SHDSL. Sensors and actors are mostly connected serial. At least
in Germany for road traffic equipments protocols are often specified by
national standards. There also old installations which should be extended or
modified. So at the end we don't get rid of serial and we must be able to
support it in parallel to the TCP/IP infrastructure!

Regards,
  Guido Classen

  reply	other threads:[~2013-01-29 21:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23 22:56 RS485 implementation questions (primarly in atmel_serial.c) Guido Classen
2013-01-24  0:10 ` Grant Edwards
2013-01-25  9:13 ` Guido Classen
2013-01-25 15:39   ` Grant Edwards
2013-01-29 21:56     ` Guido Classen [this message]
2013-01-29 22:29       ` Grant Edwards
2013-01-30 15:24         ` Guido Classen
2013-01-30 17:57           ` Grant Edwards
2013-01-30 14:35 ` Jean-Pierre Tosoni
2013-01-31 14:42   ` Grant Edwards
     [not found] <CAJa4H3cYT6QOaacWEy2yZjb0hM3m4p+0L2_fXBYv8tWajYkmGw@mail.gmail.com>
2013-01-30 10:30 ` Claudio Scordino
     [not found]   ` <510A3740.6060809@evidence.eu.com>
     [not found]     ` <CAJa4H3dG4V6viRbVQBgHQKtJr4Sz26mkhj8-kT7RFaLGRFXW1g@mail.gmail.com>
     [not found]       ` <51125488.7090408@evidence.eu.com>
     [not found]         ` <CAJa4H3eNAS7B+aGnN0D3WJMPVtE=sxp5HhRMutq-TrBOmXb7dw@mail.gmail.com>
     [not found]           ` <5114B500.7050007@evidence.eu.com>
2013-02-08 12:12             ` Guido Classen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJa4H3cCwpsJr8urNPH0XWO9YruDpxs3a5sgRBS_hEteN5SEEw@mail.gmail.com \
    --to=clagix@gmail.com \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).