On Sat, July 26, 2008 10:43 am, Jegan Bose Vincent wrote:
...
> the program is hanging for ever in the C read(FD,
> buffer, length) library call. Here is a tailored version of my
> application,
> any suggestion is greatly appreciated. Time is running out on my end, I
> need
> to make a suggestion to the bosses on the board selection.
>
> ::open("/dev/ttyS1", O_RDWR | O_NOCTTY | O_NDELAY );
>
> //I tried this too
> //::open("/dev/ttyS1", O_RDWR | O_NOCTTY | O_NONBLOCK );
>
> //I tried this too
> //::open("/dev/ttyS1", O_RDWR | O_NOCTTY | O_NONBLOCK | O_NDELAY);
>
> And I tried many combinations.
You are most likely having problems because you aren't calling the termios
functions to set up the port. The default probably has a VMIN or such
parameter that is causing read() to block. There is some sample code
here:
ftp://ftp.embeddedARM.com/tmp/term.c
which has a function you can call to set up the serial port in raw mode;
you might see if calling it after open() fixes your problem. I would also
recommend calling select() to wait for data and only calling read() when
data is available.
______ Best Regards,
|__ __/ Michael Schmidt
|| Software Engineer
||echnologic Systems (EmbeddedARM.com)
|| (480) 16610 East Laser Drive #10
|/ 837-5200 Fountain Hills, AZ 85268
http://oz.embeddedarm.com/~michael
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|