linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jean-Pierre Tosoni" <jp.tosoni@acksys.fr>
To: 'Guido Classen' <clagix@gmail.com>, linux-serial@vger.kernel.org
Subject: RE: RS485 implementation questions (primarly in atmel_serial.c)
Date: Wed, 30 Jan 2013 15:35:29 +0100	[thread overview]
Message-ID: <000401cdfef7$0d4a9020$27dfb060$@acksys.fr> (raw)
In-Reply-To: <CAJa4H3fhgEyGCO4wZjww0-rrNnRzAfpJq0cF4QoG3F+QgDqR4w@mail.gmail.com>

Hi all,
At Guido's request here are my thoughts:

> Units this parameters are given. The crisv10.c driver gets the
> delay_before_send in milliseconds and atmel_serial
> delay_rts_after_send in bit-times (means depending on baud rate).

RTS delays should be given in ms not in bit-times since they are not related
to bit rate but to amplifiers and peer software response times.

> But in the atmel_serial.c driver rthe Transmit Timeguard function of
> the AT91 USART is used to implement this.  The purpose of the Transmit
> Timeguard function is to throttle transmission in case the receiving
> device is able to receive/process incoming characters at line
> speed. This means the USART will insert a gap between EACH transmitted
> byte and not only the last of a frame.  Atmel surely had its reasons
> to implement such a function, but luckily nowadays such devices are

Sounds to me like a "quick and dirty" implementation of the RTS toggling, to
avoid the burden of setting timers etc. The interbyte gap is not needed.

> An other point I don't understand is why ATMEL_US_TXEMPTY interrupt is
> used when in RS485 mode insted of the normal ATMEL_US_TXRDY or
> ATEM_US_ENDTX interrupts. In the RS485 mode the AT91 USART will
> connect the RTS pin to the internal TXEMPTY signal to drive the RTS
> until the last bit is shifted out. But this should not have any affect
> on ow the drive will pump out the bytes to the USART's transmit hold
> register?

Well, you need to ascertain that the previous frame is all out AND the RTS
has dropped before sending a new frame. Else the receiver might think it is
the same long frame.
Using TXEMPTY interrupt avoids setting an extra timer.
However in the real life you are half-duplex and never send two frames in a
row without waiting for an answer.
Other than that I agree with your remark.

> rare.  But this function is not especially related to RS485. It is
> also applicable in RS232 mode.  So in my view it is not the

True, it applies to some half-duplex RS232 radio modems too AFAIK.

French regards,
Jean-Pierre Tosoni


  parent reply	other threads:[~2013-01-30 21:35 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
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 [this message]
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='000401cdfef7$0d4a9020$27dfb060$@acksys.fr' \
    --to=jp.tosoni@acksys.fr \
    --cc=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).