2008-12-06 20:24:11 Reading from ttyS0
andy (UNITED STATES)
Message: 66463
Am receving data on serial pin rx0. when I do a cat of ttyS0 I can see the data. But when I try to open the file and read from it, read is returning -1 always. It is supposed to return 1 which is the number of bytes I am reading from ttyS0.
I am unable to figure out what the problem could be.
QuoteReplyEditDelete
2008-12-06 20:59:29 Re: Reading from ttyS0
andy (UNITED STATES)
Message: 66464
ok am able to open ttyS0 using fopen and read using fgetc. but when i use open and read system calls it does not work. Not sure why this is happening.
QuoteReplyEditDelete
2008-12-06 22:15:32 Re: Reading from ttyS0
Mike Frysinger (UNITED STATES)
Message: 66465
if you open the device in non-blocking mode, then it'll return -1 immediately if there is no data to read
review the errno value to see why read() is returning early, or run i through strace
that said, why are you reading ttyS0 ? are you sure that's what you want ? the Blackfin UART is ttyBF#, not ttyS#.
QuoteReplyEditDelete
2008-12-06 22:55:41 Re: Reading from ttyS0
andy (UNITED STATES)
Message: 66466
I dont see any ttyBFx files in /dev. There is only ttyS0 and ttyS1. Also when I do a cat on ttyS0 I can see the data coming in.
QuoteReplyEditDelete
2008-12-07 00:49:14 Re: Reading from ttyS0
Mike Frysinger (UNITED STATES)
Message: 66467
you should be using the latest release 2008R1.5
QuoteReplyEditDelete
2008-12-07 16:51:07 Re: Reading from ttyS0
andy (UNITED STATES)
Message: 66479
Am using an old verion 2006R2. Am able to read from ttyS0 by doing fgetc. but fputc seems to be failing. am unable to write to ttyS0 now. fputc and fprintf always return -1??
QuoteReplyEditDelete
2008-12-07 17:08:29 Re: Reading from ttyS0
Mike Frysinger (UNITED STATES)
Message: 66480
there have been many fixes in the serial code since 2006R2