tcl script for serial communication

Status
Not open for further replies.

tinaelizabeth84

Newbie level 1
Joined
Sep 11, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,291
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.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…