Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #30365

Re: Linux embedded and direction control of RS485 transceiver

From Don Y <blockedofcourse@foo.invalid>
Newsgroups comp.arch.embedded
Subject Re: Linux embedded and direction control of RS485 transceiver
Date 2021-03-24 14:30 -0700
Organization A noiseless patient Spider
Message-ID <s3gb2p$2ba$1@dont-email.me> (permalink)
References <s3ds9e$k43$1@dont-email.me> <nhil5ghnm0pad0g363h7ofopulnu9aaam7@4ax.com> <s3fe6a$khm$1@dont-email.me> <94km5g9h8l37mqgtm6ukbjq685ncr1oor6@4ax.com>

Show all headers | View raw


On 3/24/2021 8:49 AM, upsidedown@downunder.com wrote:
> On Wed, 24 Mar 2021 06:17:46 -0700, Don Y

>> As you likely have the line connected to the Rx input (to *receive*
>> replies), you can use the Rx IRQ to tell you when the character has
>> cleared the Tx shift register (and made it out onto the wire).
> 
> Yes, I have sometimes used this, but it requires that the Rx path is
> always active. Some RS-485 chips disable the Rx side when
> transmitting, so you do not hear your own transmission, thus no echo
> canceling is required in the software.

I always use separate Tx and Rx devices -- so I *can* hear my own
transmissions.  Otherwise, I have to rely on timeouts to discover when
I didn't get an expected reply -- and then, all I can do is complain
(I can't provide any additional information to the user to help him
sort to what the problem may be -- big difference between "slave not
responding" and "comm line has faulted"!)

I've designed devices where a relay allows me to galvanically disconnect
from the line (as a *functional* slave) while the master applies a
super-voltage to blow the "fuses" of any devices that were hung and
interfering with comms.  (i.e., if you can't hear what you -- as a
slave -- are saying, you know you should disconnect from the line
cuz bad things are going to happen RSN!)

>> However, anomalies/faults on the line can prevent the Rx interrupt
>>from coinciding with the end of the Tx (e.g., if a voltage is effectively
>> impressed on the line).  The loopback will allow your code to detect that
>> transmissions are not happening as expected.  But, it will confuse the
>> timing of the disabling of the transceiver.
> 
> If he line is shorted or connected to Vcc, loosing timing is the
> smallest problem :-)  Even if the problem is at the remote end of the
> cable, the problem must be pretty severe, if you can't detect your own
> transmission on the PCB before entering the line.

The point is that you will never get the information necessary to
tell *you* to disable your driver!  (unless you add another timeout
mechanism on top of that)

>> A better solution is to route the Tx *pin* on the device to a spare
>> Rx pin (another UART) and use that for timing information as it
>> is entirely local to the board -- not impacted by faults on the
>> wire.
> 
> What is the point of doing loopbacK on TTL, if the RS-485 is bad ?

You're not doing the loopback on the TTL.  You're using the
extra Rx input for *timing* (because you KNOW the Tx character
must have cleared the transmit shift register before the
receiver can claim to have received it).

If you don't have a spare UART, you can also use a timer input;
trigger the timer on a start bit (even if it has to retrigger
on subsequent data bits) and then let the timer timeout in a
character time.

All of these are more efficient than having the OS schedule a
system timer event for you to do the deed.  You don't want to
promote such a low-level "driver activity" to anything more
significant than it needs to be!

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Linux embedded and direction control of RS485 transceiver pozz <pozzugno@gmail.com> - 2021-03-24 00:06 +0100
  Re: Linux embedded and direction control of RS485 transceiver upsidedown@downunder.com - 2021-03-24 07:28 +0200
    Re: Linux embedded and direction control of RS485 transceiver Don Y <blockedofcourse@foo.invalid> - 2021-03-24 06:17 -0700
      Re: Linux embedded and direction control of RS485 transceiver upsidedown@downunder.com - 2021-03-24 17:49 +0200
        Re: Linux embedded and direction control of RS485 transceiver Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-03-24 18:32 +0200
          Re: Linux embedded and direction control of RS485 transceiver upsidedown@downunder.com - 2021-03-24 19:22 +0200
            Re: Linux embedded and direction control of RS485 transceiver David Brown <david.brown@hesbynett.no> - 2021-03-24 19:44 +0100
              Re: Linux embedded and direction control of RS485 transceiver upsidedown@downunder.com - 2021-03-25 07:34 +0200
              Re: Linux embedded and direction control of RS485 transceiver upsidedown@downunder.com - 2021-03-25 07:47 +0200
            Re: Linux embedded and direction control of RS485 transceiver Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-03-24 21:13 +0200
              Re: Linux embedded and direction control of RS485 transceiver upsidedown@downunder.com - 2021-03-25 07:39 +0200
              Re: Linux embedded and direction control of RS485 transceiver David Brown <david.brown@hesbynett.no> - 2021-03-25 10:48 +0100
                Re: Linux embedded and direction control of RS485 transceiver Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-03-25 16:33 +0200
                Re: Linux embedded and direction control of RS485 transceiver Grant Edwards <invalid@invalid.invalid> - 2021-03-25 14:49 +0000
                Re: Linux embedded and direction control of RS485 transceiver upsidedown@downunder.com - 2021-03-25 18:43 +0200
                Re: Linux embedded and direction control of RS485 transceiver David Brown <david.brown@hesbynett.no> - 2021-03-26 09:47 +0100
        Re: Linux embedded and direction control of RS485 transceiver Don Y <blockedofcourse@foo.invalid> - 2021-03-24 14:30 -0700
  Re: Linux embedded and direction control of RS485 transceiver dalai lamah <antonio12358@hotmail.com> - 2021-03-24 11:48 +0100
    Re: Linux embedded and direction control of RS485 transceiver pozz <pozzugno@gmail.com> - 2021-03-25 00:23 +0100
  Re: Linux embedded and direction control of RS485 transceiver "A.P.Richelieu" <aprichelieu@gmail.com> - 2021-05-09 13:24 +0200
    Re: Linux embedded and direction control of RS485 transceiver Uwe Bonnes <bon@hertz.ikp.physik.tu-darmstadt.de> - 2021-05-09 12:01 +0000
    Re: Linux embedded and direction control of RS485 transceiver pozz <pozzugno@gmail.com> - 2021-05-10 09:46 +0200

csiph-web