LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tcl scripting-serial communication (https://www.linuxquestions.org/questions/linux-newbie-8/tcl-scripting-serial-communication-4175426651/)

tinaelizabeth84 09-11-2012 03:29 AM

tcl scripting-serial communication
 
Hi,

I am new to TCL scripting.
I need to open a serial connection,write a command and read its output.
with my program I can send all command I want to to the errial communication but the output of the command is not proper.At times it gives the correct output.At times it gives partial output or at time it will be mixed up (like a buffer overflow).
My program looks like

set DUT_Console "/dev/ttyS0" ;# Com port no for DUT1
set DUT_Baud "9600"

set fh [open $DUT_Console RDWR]
fconfigure $fh -mode $DUT_Baud,n,8,1
fconfigure $fh -blocking 1 -buffering none -timeout 1000
#fconfigure $fh -mode 9600,n,8,1 -blocking 1 -translation auto -buffering none -timeout 1000 -handshake xonxoff
puts -nonewline $fh "info\r"
puts "DUT echo: [read $fh]"
flush $fh
close $fh

command "info" is just an example.

Can anyone help me out?

I see that info is given to my serial communication properly.Problem is with the output.


All times are GMT -5. The time now is 08:12 AM.