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

Ewald ewald at yellowcouch.org
Mon Jul 8 13:09:19 CEST 2013

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:

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.

Hope it helps!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130708/01ca7d8e/attachment.html>

More information about the fpc-pascal mailing list