linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* The RS485 driver problem...
@ 2005-01-31  8:51 David Jander
  0 siblings, 0 replies; 3+ messages in thread
From: David Jander @ 2005-01-31  8:51 UTC (permalink / raw)
  To: 'linuxppc-embedded@ozlabs.org'


Hi,

If you want to connect a RS485 transceiver to a normal UART, you always have 
the problem of dealing with enabling/disabling transmitter and recveiver. I 
have seen hardware that misuses RS-232 hardware handshaking lines (RTS/CTS) 
for this purpose. What I have not been able to find is a linux driver or 
software solution to this problem.

Has anybody used the CPM uarts (or even a standard 16C550 uart) for this 
purpose? How?

Greetings,

-- 
David Jander
Protonic Holland.

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

* AW: The RS485 driver problem...
@ 2005-02-02  8:27 Martin Krause
  2005-02-02 13:15 ` Mark Chambers
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Krause @ 2005-02-02  8:27 UTC (permalink / raw)
  To: David Jander, linuxppc-embedded

Hi David,

linuxppc-embedded-bounces@ozlabs.org wrote on :
> If you want to connect a RS485 transceiver to a normal UART, you
> always have the problem of dealing with enabling/disabling
> transmitter and recveiver. I have seen hardware that misuses RS-232
> hardware handshaking lines (RTS/CTS) for this purpose. What I have
> not been able to find is a linux driver or software solution to this
> problem.=20
>=20
> Has anybody used the CPM uarts (or even a standard 16C550 uart) for
> this purpose? How?

Yes, we used normal UARTs several times to form a RS485 interface. It=20
is a bit tricky, because you must disable the transmitter just in time
after the last bit of a message has been left the transmit shift
register. Otherwise the answer from the addressed bus node could be
(partly) overwritten. It depends on your bus protocol how much time
you could afford to disable the transmitter. Since linux is not a
real time OS, and the transmitter is controlled by software (we use
an GPIO for this), there is no guarantee that this works under all
circumstances fast enough.
For us it is working well with a baudrate of 38.400 und a maximum
time of < 400 us to disable the transmitter after sending a message.=20
We used a 16752 UART. The driver could be found in the 'linuxarm'=20
kernel tree on the Denx CVS server (look at www.denx.de). If you=20
couldn't use CVS I could send you the driver sources directly.

Regards,
Martin

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

* Re: The RS485 driver problem...
  2005-02-02  8:27 AW: The RS485 driver problem Martin Krause
@ 2005-02-02 13:15 ` Mark Chambers
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Chambers @ 2005-02-02 13:15 UTC (permalink / raw)
  To: linuxppc-embedded


linuxppc-embedded-bounces@ozlabs.org wrote on :
> If you want to connect a RS485 transceiver to a normal UART, you
> always have the problem of dealing with enabling/disabling
> transmitter and recveiver. I have seen hardware that misuses RS-232
> hardware handshaking lines (RTS/CTS) for this purpose. What I have
> not been able to find is a linux driver or software solution to this
> problem. 
> 
> Has anybody used the CPM uarts (or even a standard 16C550 uart) for
> this purpose? How?

I took a look at some old non-linux code for the MPC860, and it appears
that the RTSM bit in GSMR_H provides switched-RTS in UART mode.
It will negate RTS after the last character in a BD.  (SCCs only, not SMC)

Another trick you can use, depending on your hardware config, is to loop
your transmit data back to receive.  When you receive the last character
you sent you know it's safe to turn off RTS, and since you're getting an
interrupt it's deterministic.

Mark Chambers

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

end of thread, other threads:[~2005-02-02 13:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-02  8:27 AW: The RS485 driver problem Martin Krause
2005-02-02 13:15 ` Mark Chambers
  -- strict thread matches above, loose matches on Subject: below --
2005-01-31  8:51 David Jander

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