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

Dennis Poon dennis at avidsoft.com.hk
Thu Jul 4 11:16:16 CEST 2013


Michael Schnell wrote:
> 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.
>
After days of google search, I am afraid the bcm2835, the Soc of 
Raspberry Pi (the hardware I have to use) does not provide this hardware 
support :-(
It states that it does not even support interrupt. Polling is the only 
way for events :-(


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

I have no experience in the above tasks you mentioned :-(  It's going to 
take many days of trial and error. haiiii......

Thanks for your advice.

Dennis



More information about the fpc-pascal mailing list