[fpc-pascal] How to use UART of ARM platforms (e.g. Raspberry Pi ) through free Pascal?

Michael Schnell mschnell at lumino.de
Thu Jul 4 09:59:19 CEST 2013


On 07/03/2013 06:36 PM, Dennis Poon wrote:
>
> Can you give me some pointer on directly using UART? I need to 
> implement half-duplex using UART for rs-485 protocol.

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.

If your system does not do so, you should find or do a device driver 
yourself.

In fact what do you mean by "rs-485 protocol" ?

With RS-485 hardware you can - and supposedly need to - do "half-duplex 
with output enable", if your hardware provides this.

The hardware might or might not provide automatic output enable (if not, 
you need to set and reset RTS in software).

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

If your hardware provides both auto output enable and echo cancellation, 
your software can happily ignore the "rs-485 protocol".

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.

-Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130704/bc6ec9ba/attachment.html>


More information about the fpc-pascal mailing list