[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ltib] serial interface read problem
From: |
Mehrdad Salami |
Subject: |
[Ltib] serial interface read problem |
Date: |
Mon, 29 Oct 2007 12:34:16 +1100 |
User-agent: |
Thunderbird 2.0.0.6 (Windows/20070728) |
Hi Everyone,
I am trying to access a serial port in raw format. I am using the ltib
linux distribution for freescale coldfire chips. The port is defined as
UART but I set the port to work in raw format by running
>stty raw -F /dev/tts/3
However I can't read from the port correctly.
I open the port in user space like
fd=open("/dev/tts/3", O_RDWR | O_NOCTTY | O_NODELAY | O_NONBLOCK);
and write into the port as
write(fd,buf_out,len);
which works correctly.
However I can't read from the port using
read(fd,buf_in,len);
The port receive all characters and I can write the characters from
lower level functions in kernel space on console. However the read
function return -1 which is obviously no success. I tried to delay read
but still can't read characters.
I am not sure if the open flags are not correct, or read and write
procedures are not correct.
Another question : Is there any way to open the port in raw format
without running the stty command.
Thanks
Mehrdad
- [Ltib] serial interface read problem,
Mehrdad Salami <=