Serial port reading
Hi,
I have to write and read from a serial port. Iam able to write to the port /dev/ttyS1 but not able to read from the same port. What configuration should I set to enable reading from the port? Thanks, Dhanesh. |
How have you tried reading from the serial port? What have you done to verify that serial data is being sent to the port? What do you know about the incoming serial data (baud, parity, data format, etc)? When you say 'not able to read from the same port', what exactly are you doing to try to read the data? Have you made a loopback connection on the port? Are you using some serial communications software such as minicom, or are you writing your own code? If the latter, posting some sample code (use [code] tags to preserve formatting, please) would be helpful.
More information is required. --- rod. |
Hi,
I used to minicom and it worked fine. Iam using the same baud rate. I tried to do a echo $val > /dev/ttyS1. I was able to recive the same back on read. Thanks, Dhanesh. |
From perl perspective, something like this:
my $tty_cmd = "stty 9600 cs8 ignpar -echo -echok -icrnl -ixon -ixoff ixany -icanon -opost -onlcr time 12 min 0 <"; open( TTY,"+<",$serial_line ) || die( "open serial line error: $serial_line $?") Adopt the stty command in linux/unix to suit. |
All times are GMT -5. The time now is 01:13 PM. |