[fpc-pascal] synapser freezes on fopen(FDevice, 0_RDWR or 0_SYNC) on raspberry Pi

Dennis Poon dennis at avidsoft.com.hk
Mon Jul 8 13:35:07 CEST 2013


Ewald,

It does not fix it :-(
The weird thing is, now even if I run the trimmed down version compiled 
with 2.6.2, it also freezes.
But running
   sudo minicom -b 9600 -o -D /dev/ttyAMA0
has no problem at all.

I tried sudo -i
then startx
to run X window as root then execute the program, still freezes on 
connect to /dev/ttyAMA0

It is so weird :-(

Dennis

Ewald wrote:
> On 08 Jul 2013, at 12:09, Dennis Poon wrote:
>>
>> However, when I extract the relevant code from that example and use 
>> the normal fpc compiler (2.6.0) instead of the pparm (2.6.2) and 
>> special fp lib inside that zip, my program freezes on synapser.pas   
>> TBlockSerial.Connect
>> at the line of fopen(FDevice, 0_RDWR or 0_SYNC).
>
> Well, I recently had a similar issue, on Mac OS X and an USB to Serial 
> converter (which had an FTDI chipset) -- maybe this issue is similar. 
> The fix was really quite easy, but it took me a while to find out.
>
> Assume your fpOpen() call returns a handle called `Handle`. Now add 
> the following lines after your open call:
>
> ===Code===
> Var Attr: TTermios;
>
> tcgetattr(Handle, @Attr);
>
> Attr.c_cflag:= Attr.c_cflag or CREAD or CLOCAL; // --> This is the 
> line that fixed the issue
> //Do fix your other attributes here aswell, like ispeed, ospeed, etc...
>
> tcsetattr(Handle, TCSADRAIN, @Attr); // Take a look at the 
> documentation of this call to see what constant (TCSADRAIN) you want 
> to use.
> ===EOC===
>
> Hope it helps!
>
> --
> Ewald
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2013.0.3345 / Virus Database: 3204/6473 - Release Date: 07/08/13
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130708/26583fe3/attachment.html>


More information about the fpc-pascal mailing list