linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Lite5200 from RS232 to RS485
@ 2004-06-11 13:35 saurosalomoni
  2004-06-14 17:53 ` Steve Kaiser
  0 siblings, 1 reply; 6+ messages in thread
From: saurosalomoni @ 2004-06-11 13:35 UTC (permalink / raw)
  To: linuxppc-embedded; +Cc: iida


Hello.

I need to switch between RS232 and RS485 in my Lite5200,
 but I realized it's a little bit more dificult than I
thought at first...
Well,  as far as I'm concerned, I can do that just by
controling the RTS pin of my ttyS0 device to activate
the 485 module (is it 100% right?).

I began trying to control it with TIOCMGET/TIOCMSET
ioctl(),  but the driver does not support hardware
handshake.. (tahnx,  Denk)
So now I think I'll have to write a small driver that
uses GPIO to handle the proper PSC register.

MPC5200 Users Manual states that you can set/clear the
RTS pin with bit 7 of the OutputPort 0 (op0, offset 0x3C).

My questions:
- Is this information I gathered correct?..
- Which PSC register I need to use to control ttyS0?
- If it's easyer to do it by extending an existing
driver, wich file should I look for?
- Is there any other way to accomplish that?

Thanks in advance.


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* RE: Lite5200 from RS232 to RS485
@ 2004-06-14 11:54 saurosalomoni
  2004-06-14 14:47 ` Graham Williams
  0 siblings, 1 reply; 6+ messages in thread
From: saurosalomoni @ 2004-06-14 11:54 UTC (permalink / raw)
  To: linuxppc-embedded; +Cc: gwilliams


> I did the same thing with an 860T.  All we needed was
the RTS pin
> (inverted).  We used the standard driver and
everything worked fine.  I did
> do a little ioctl stuff but no driver changes.


The point is that the driver I'm using does not support
ioctl. What I would like to know is how to set RTS
without using ioctl.
I know there is a way, but I couldn't find it yet...


>Here is the hello file I
> started with.   Good luck
>
> -----Original Message-----
> From: owner-linuxppc-embedded@lists.linuxppc.org
> [mailto:owner-linuxppc-embedded@lists.linuxppc.org] On
Behalf Of
> saurosalomoni
> Sent: Friday, June 11, 2004 6:35 AM
> To: linuxppc-embedded@lists.linuxppc.org
> Cc: iida@ztec.com.br
> Subject: Lite5200 from RS232 to RS485
>
>
> Hello.
>
> I need to switch between RS232 and RS485 in my Lite5200,
>  but I realized it's a little bit more dificult than I
> thought at first...
> Well,  as far as I'm concerned, I can do that just by
> controling the RTS pin of my ttyS0 device to activate
> the 485 module (is it 100% right?).
>
> I began trying to control it with TIOCMGET/TIOCMSET
> ioctl(),  but the driver does not support hardware
> handshake.. (tahnx,  Denk)
> So now I think I'll have to write a small driver that
> uses GPIO to handle the proper PSC register.
>
> MPC5200 Users Manual states that you can set/clear the
> RTS pin with bit 7 of the OutputPort 0 (op0, offset 0x3C).
>
> My questions:
> - Is this information I gathered correct?..
> - Which PSC register I need to use to control ttyS0?
> - If it's easyer to do it by extending an existing
> driver, wich file should I look for?
> - Is there any other way to accomplish that?
>
> Thanks in advance.
>


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* RE: Lite5200 from RS232 to RS485
  2004-06-14 11:54 Lite5200 from RS232 to RS485 saurosalomoni
@ 2004-06-14 14:47 ` Graham Williams
  2004-06-14 15:37   ` Wolfgang Denk
  0 siblings, 1 reply; 6+ messages in thread
From: Graham Williams @ 2004-06-14 14:47 UTC (permalink / raw)
  To: 'saurosalomoni', 'linuxppc-embedded'


I used tcgetattr and tcsetattr to set the termios settting like baud.  I
also had to recompile the kernel using make menuconfig and in MPC8xx CPM
Options-> I selected Use SCCx UART then Use SSC1 UART then selected PC15 for
RTS on SCC1 UART.  Make sure the second UART device (ttyS1) is in the /dev
directory and this should enable the RTS to work.  You can only use RTS with
the SCCs and NOT the SMCs.  Maybe the console ttyS0 is an SMC not an SCC at
least that is the way my eval board was setup. I hope this helps.

-----Original Message-----
From: saurosalomoni [mailto:saurosalomoni@bol.com.br]
Sent: Monday, June 14, 2004 4:54 AM
To: linuxppc-embedded
Cc: gwilliams
Subject: RE: Lite5200 from RS232 to RS485



> I did the same thing with an 860T.  All we needed was
the RTS pin

> (inverted).  We used the standard driver and
everything worked fine.  I did
> do a little ioctl stuff but no driver changes.


The point is that the driver I'm using does not support
ioctl. What I would like to know is how to set RTS
without using ioctl.
I know there is a way, but I couldn't find it yet...


>Here is the hello file I
> started with.   Good luck
>
> -----Original Message-----
> From: owner-linuxppc-embedded@lists.linuxppc.org
> [mailto:owner-linuxppc-embedded@lists.linuxppc.org] On
Behalf Of
> saurosalomoni
> Sent: Friday, June 11, 2004 6:35 AM
> To: linuxppc-embedded@lists.linuxppc.org
> Cc: iida@ztec.com.br

> Subject: Lite5200 from RS232 to RS485
>
>
> Hello.
>
> I need to switch between RS232 and RS485 in my Lite5200,
>  but I realized it's a little bit more dificult than I
> thought at first...
> Well,  as far as I'm concerned, I can do that just by
> controling the RTS pin of my ttyS0 device to activate
> the 485 module (is it 100% right?).
>
> I began trying to control it with TIOCMGET/TIOCMSET
> ioctl(),  but the driver does not support hardware
> handshake.. (tahnx,  Denk)
> So now I think I'll have to write a small driver that
> uses GPIO to handle the proper PSC register.
>
> MPC5200 Users Manual states that you can set/clear the
> RTS pin with bit 7 of the OutputPort 0 (op0, offset 0x3C).

>
> My questions:
> - Is this information I gathered correct?..
> - Which PSC register I need to use to control ttyS0?
> - If it's easyer to do it by extending an existing
> driver, wich file should I look for?

> - Is there any other way to accomplish that?
>
> Thanks in advance.

>


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Lite5200 from RS232 to RS485
  2004-06-14 14:47 ` Graham Williams
@ 2004-06-14 15:37   ` Wolfgang Denk
  2004-06-22 14:53     ` Sauro Salomoni
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2004-06-14 15:37 UTC (permalink / raw)
  To: Graham Williams; +Cc: 'saurosalomoni', 'linuxppc-embedded'


In message <005801c4521e$86e0ea40$26c8a8c0@GMAN> you wrote:
>
> I used tcgetattr and tcsetattr to set the termios settting like baud.  I
> also had to recompile the kernel using make menuconfig and in MPC8xx CPM
> Options-> I selected Use SCCx UART then Use SSC1 UART then selected PC15 for

Ummm... but the MPC8xx CPM options _definitely_ have  zero  influence
on  the  behaviour of the MPC5200 PSC UART driver. This is completely
different hardware.

> RTS on SCC1 UART.  Make sure the second UART device (ttyS1) is in the /dev
> directory and this should enable the RTS to work.  You can only use RTS with

No, it will NOT work. I repeat: the existing driver DOES NOT  SUPPORT
hardware  handshake, so no matter what you do (short of extending the
driver) - it will not work.

> the SCCs and NOT the SMCs.  Maybe the console ttyS0 is an SMC not an SCC at
> least that is the way my eval board was setup. I hope this helps.

Sorry, but it doesn't.

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Our missions are peaceful -- not for conquest.  When we do battle, it
is only because we have no choice.
	-- Kirk, "The Squire of Gothos", stardate 2124.5

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* RE: Lite5200 from RS232 to RS485
  2004-06-11 13:35 saurosalomoni
@ 2004-06-14 17:53 ` Steve Kaiser
  0 siblings, 0 replies; 6+ messages in thread
From: Steve Kaiser @ 2004-06-14 17:53 UTC (permalink / raw)
  To: 'saurosalomoni'; +Cc: linuxppc-embedded


> I need to switch between RS232 and RS485 in my Lite5200,
>  but I realized it's a little bit more dificult than I
> thought at first...
> Well,  as far as I'm concerned, I can do that just by
> controling the RTS pin of my ttyS0 device to activate
> the 485 module (is it 100% right?).

There are ways to enable an RS485 transceiver without the extra I/O
control line.  The transceiver needs to be enabled only during
transmission (i.e from your Lite5200 to the outside world), and if your
output differential pair is pulled up (normally the case I believe),
then only during a transmission of a zero as well.

The way to accomplish this is with a one-shot and a diode.  Use the xmt
line to low-active trigger the one-shot, and (via the diode) also pull
the one-shot's threshold low, effectively holding the output high.  Set
the timing of the one-shot for 1/2 the maximum bit time you need (ex: at
115.2 baud, set it to 56us).  The one-shot output then is an inverted
and extended version of your xmt line, and perfect for enabling the
transceiver.  Also perfect for disabling the receiver at the same time.

See B&B Electronics [ http://www.bb-elec.com/ ] as one place I know of
that sells RS232 - RS485 coverters off-the-shelf using this method if
you don't want to build your own.  There are schematics on their site
from which you can glean more info to build your own.  If am not a fan
of one-shots, but in this case they are suitable.

Steve Kaiser
UCR Chem Electronics Shop


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Lite5200 from RS232 to RS485
  2004-06-14 15:37   ` Wolfgang Denk
@ 2004-06-22 14:53     ` Sauro Salomoni
  0 siblings, 0 replies; 6+ messages in thread
From: Sauro Salomoni @ 2004-06-22 14:53 UTC (permalink / raw)
  To: linuxppc-embedded


Hi.

I'm having quite a problem getting into the serial...

Searching through local files, I could see that, although using 2 or 3 chained
functions to get/set the serial status, it is (in fact) done with a readb/writeb
statement (or inb/outb). Is that correct?

So, in order to make a very small driver, that just access the serial port and
doesn't use other features (we need a very "clean" one here..), wich headers should
I include? Is <asm/io.h> just enough?
I tried to use as few headers as possible, but then I get the problem that the
readb/writeb functions are not defined...
Could anyone give me a helping hand?

Thanks.

Sauro Salomoni

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2004-06-22 14:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-14 11:54 Lite5200 from RS232 to RS485 saurosalomoni
2004-06-14 14:47 ` Graham Williams
2004-06-14 15:37   ` Wolfgang Denk
2004-06-22 14:53     ` Sauro Salomoni
  -- strict thread matches above, loose matches on Subject: below --
2004-06-11 13:35 saurosalomoni
2004-06-14 17:53 ` Steve Kaiser

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