* How to control RTS signal ?
@ 2003-12-19 4:50 yhxing
2003-12-19 20:37 ` Wolfgang Denk
2003-12-23 13:36 ` llandre
0 siblings, 2 replies; 5+ messages in thread
From: yhxing @ 2003-12-19 4:50 UTC (permalink / raw)
To: linuxppc-embedded@lists.linuxppc.org
Hi,
Now we are using a mpc823 embedded system, and there is some trouble.
We need to use SCC3 UART to control RS485 tranceiver. TXD3 is connected
to RS485 tranceiver's D pin, RXD3 is connected to RS485 tranceiver's R
pin, and RTS3 is connected to RS485 tranceiver's RE# and DE pin. Then
when transmitting data, we hope RTS3 signal can keep low to enble D.
When receiving data, we hope RTS3 signal can keep high to enble R.
So my question is, how can I program to control RTS3 signal in ppclinux.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to control RTS signal ?
2003-12-19 4:50 yhxing
@ 2003-12-19 20:37 ` Wolfgang Denk
2003-12-23 13:36 ` llandre
1 sibling, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2003-12-19 20:37 UTC (permalink / raw)
To: yhxing; +Cc: linuxppc-embedded@lists.linuxppc.org
In message <Sea1-DAV34kO1dJFUuS0000e1ba@hotmail.com> you wrote:
>
> Now we are using a mpc823 embedded system, and there is some trouble.
> We need to use SCC3 UART to control RS485 tranceiver. TXD3 is connected
> to RS485 tranceiver's D pin, RXD3 is connected to RS485 tranceiver's R
> pin, and RTS3 is connected to RS485 tranceiver's RE# and DE pin. Then
> when transmitting data, we hope RTS3 signal can keep low to enble D.
> When receiving data, we hope RTS3 signal can keep high to enble R.
> So my question is, how can I program to control RTS3 signal in ppclinux.
You will need a version of the UART driver that supports hardware
handshake and allows you to configure the processor pins for
handshake operations. See for example the source trees on our CVS
server.
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
Q: Why do mountain climbers rope themselves together?
A: To prevent the sensible ones from going home.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to control RTS signal ?
2003-12-19 4:50 yhxing
2003-12-19 20:37 ` Wolfgang Denk
@ 2003-12-23 13:36 ` llandre
1 sibling, 0 replies; 5+ messages in thread
From: llandre @ 2003-12-23 13:36 UTC (permalink / raw)
To: yhxing; +Cc: linuxppc-embedded@lists.linuxppc.org
>
>Hi,
>
> Now we are using a mpc823 embedded system, and there is some trouble.
>We need to use SCC3 UART to control RS485 tranceiver. TXD3 is connected
>to RS485 tranceiver's D pin, RXD3 is connected to RS485 tranceiver's R
>pin, and RTS3 is connected to RS485 tranceiver's RE# and DE pin. Then
>when transmitting data, we hope RTS3 signal can keep low to enble D.
>When receiving data, we hope RTS3 signal can keep high to enble R.
> So my question is, how can I program to control RTS3 signal in ppclinux.
Hi,
the simplest solution I found so far is to control the RTS signal in the
application, like this:
int mcs = TIOCM_RTS;
/* clear RTS */
ioctl(fd, TIOCMBIC, &mcs);
...
/* Before starting a transmission, we must set the RTS
signal */
ioctl(fd, TIOCMBIS, &mcs);
/* Now we can safely transmit the message with the usual
write system call */
write(fd, buf, strlen(buf));
/* Before switching back to receiving mode, we must
ascertain the trasmission is actually completed by reading the Line Status
Register */
do {
ioctl (fd, TIOCSERGETLSR, &lsr);
} while (!(lsr & TIOCSER_TEMT));
/* clear RTS */
ioctl(fd, TIOCMBIC, &mcs);
Otherwise you can modify the serial driver in order to manage the direction
pin internally inside it. Even if this technique is discouraged by kernel
maintainers, there are several examples available (I think the CRIS
architecture serial driver implements this solution).
Hope this helps,
llandre
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to control RTS signal ?
@ 2003-12-26 9:32 邢 渝华
2004-01-01 17:29 ` llandre
0 siblings, 1 reply; 5+ messages in thread
From: 邢 渝华 @ 2003-12-26 9:32 UTC (permalink / raw)
To: r&d; +Cc: linuxppc-embedded
>From: llandre <r&d@wawnet.biz>
>Subject: Re: How to control RTS signal ?
>Date: Tue, 23 Dec 2003 14:36:45 +0100
>
>> Now we are using a mpc823 embedded system, and there is some
>>trouble. We need to use SCC3 UART to control RS485 tranceiver. TXD3
>>is connected to RS485 tranceiver's D pin, RXD3 is connected to RS485
>>tranceiver's R pin, and RTS3 is connected to RS485 tranceiver's RE#
>>and DE pin. Then when transmitting data, we hope RTS3 signal can keep
>>low to enble D. When receiving data, we hope RTS3 signal can keep
>>high to enble R. So my question is, how can I program to control RTS3
>>signal in ppclinux.
>
>the simplest solution I found so far is to control the RTS signal in
>the application, like this:
>
> int mcs = TIOCM_RTS;
> /* clear RTS */
> ioctl(fd, TIOCMBIC, &mcs);
> ...
>
> /* Before starting a transmission, we must set the RTS
>signal */
> ioctl(fd, TIOCMBIS, &mcs);
>
>
> /* Now we can safely transmit the message with the
>usual write system call */
> write(fd, buf, strlen(buf));
>
> /* Before switching back to receiving mode, we must
>ascertain the trasmission is actually completed by reading the Line
>Status Register */
> do {
> ioctl (fd, TIOCSERGETLSR, &lsr);
> } while (!(lsr & TIOCSER_TEMT));
>
> /* clear RTS */
> ioctl(fd, TIOCMBIC, &mcs);
>
>Otherwise you can modify the serial driver in order to manage the
>direction pin internally inside it. Even if this technique is
>discouraged by kernel maintainers, there are several examples available
>(I think the CRIS architecture serial driver implements this solution).
Thank for your help, I have try these code above, but it did not work.
I have done "make menuconfig", select pc13 as RTS signal for SCC3,
and none for CTS,CD,DTR signal. Then I use the above code in the
program, I found RTS pin can not be controlled, it kept low level all
the time.
How does this happen?
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to control RTS signal ?
2003-12-26 9:32 How to control RTS signal ? 邢 渝华
@ 2004-01-01 17:29 ` llandre
0 siblings, 0 replies; 5+ messages in thread
From: llandre @ 2004-01-01 17:29 UTC (permalink / raw)
To: xyuhua_telecom; +Cc: linuxppc-embedded
>>>
>>>Hi,
>>>
>>> Now we are using a mpc823 embedded system, and there is some trouble.
>>>We need to use SCC3 UART to control RS485 tranceiver. TXD3 is connected
>>>to RS485 tranceiver's D pin, RXD3 is connected to RS485 tranceiver's R
>>>pin, and RTS3 is connected to RS485 tranceiver's RE# and DE pin. Then
>>>when transmitting data, we hope RTS3 signal can keep low to enble D.
>>>When receiving data, we hope RTS3 signal can keep high to enble R.
>>> So my question is, how can I program to control RTS3 signal in ppclinux.
>>
>>Hi,
>>
>>the simplest solution I found so far is to control the RTS signal in the
>>application, like this:
>>
>> int mcs = TIOCM_RTS;
>> /* clear RTS */
>> ioctl(fd, TIOCMBIC, &mcs);
>> ...
>>
>> /* Before starting a transmission, we must set the RTS
>>signal */
>> ioctl(fd, TIOCMBIS, &mcs);
>>
>>
>> /* Now we can safely transmit the message with the usual
>>write system call */
>> write(fd, buf, strlen(buf));
>>
>> /* Before switching back to receiving mode, we must
>>ascertain the trasmission is actually completed by reading the Line Status
>>Register */
>> do {
>> ioctl (fd, TIOCSERGETLSR, &lsr);
>> } while (!(lsr & TIOCSER_TEMT));
>>
>> /* clear RTS */
>> ioctl(fd, TIOCMBIC, &mcs);
>>
>>Otherwise you can modify the serial driver in order to manage the direction
>>pin internally inside it. Even if this technique is discouraged by kernel
>>maintainers, there are several examples available (I think the CRIS
>>architecture serial driver implements this solution).
>>
>>
>>
>>
>>
>>Hope this helps,
>>
>>llandre
>
> Thank for your help, I have try these code above, but it did not
> work. I have done "make menuconfig", select pc13 as RTS signal for
> SCC3, and none for
>CTS,CD,DTR signal. Then I use the above code in the program, I found RTS
>pin can not be controlled, it kept low level all the time.
>
> How does this happen?
>
Hi,
I don't know the mpc823, anyway I suggest you to have a look at the serial
driver source code (I think it is arch/ppc/8xx_io/uart.c). Here you can
find how the ioctls are handled and, if not supported yet, you can easily
add the support for the TIOCMBIC, TIOCMBIS, TIOCSERGETLSR and TIOCMBIC. In
case the code already supports the necessary ioctls, my advice is to debug
the driver with an hardware interface or with the printk, in order to
understand why the RST pin is stuck (maybe, if it is a multiplexed pin, it
is not configured correctly).
Hope this helps,
llandre
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-01-01 17:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-26 9:32 How to control RTS signal ? 邢 渝华
2004-01-01 17:29 ` llandre
-- strict thread matches above, loose matches on Subject: below --
2003-12-19 4:50 yhxing
2003-12-19 20:37 ` Wolfgang Denk
2003-12-23 13:36 ` llandre
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).