<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 07/03/2013 06:36 PM, Dennis Poon
wrote:<br>
</div>
<blockquote cite="mid:51D45320.2090404@avidsoft.com.hk" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<font size="+1"><br>
Can you give me some pointer on directly using UART? I need to
implement half-duplex using UART for rs-485 protocol.</font><br>
</blockquote>
<br>
In a Linux system, accessing the hardware by user code is strictly
discouraged, at least whenever interrupts are involved (as with
UARTs). A decent system should provide rs-485 support in the "TTY"
driver, when the hardware allows for such. <br>
<br>
If your system does not do so, you should find or do a device driver
yourself. <br>
<br>
In fact what do you mean by "rs-485 protocol" ? <br>
<br>
With RS-485 hardware you can - and supposedly need to - do
"half-duplex with output enable", if your hardware provides this. <br>
<br>
The hardware might or might not provide automatic output enable (if
not, you need to set and reset RTS in software).<br>
<br>
The hardware might or might not provide echo cancellation (if not
the software needs to actively ignore anything that the hardware
echoes back when sending it).<br>
<br>
If your hardware provides both auto output enable and echo
cancellation, your software can happily ignore the "rs-485
protocol". <br>
<br>
Usually both can be done in userland software even with standard TTY
drivers that (usually do) setting and resetting support RTS, or
(better) by dedicated support in the device driver.<br>
<br>
-Michael<br>
</body>
</html>