minicom works, but stty does not


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting minicom works, but stty does not
# 1  
Old 11-21-2011
minicom works, but stty does not

Hi all,

I have some trouble getting stty to talk to some serial/usb converter.
Getting minicom to work was however quite simple after I entered the following settings in addition to its standard-setup:

Code:
pu port             /dev/ttyUSB0
pu baudrate         19200
pu bits             8
pu parity           N
pu stopbits         1
pu rtscts           No

I tried to reproduce these settings for stty:

Code:
stty 19200 cs8 -raw -parenb -cstopb crtscts -echo -F /dev/ttyUSB0

But this does not seem to work. Because
Code:
echo "my_serial_command" /dev/ttyUSB0

does not produce any output to
Code:
cat < /dev/ttyUSB0

.

I would appreciate if anybody of you would be willing to look in the full settings of stty in order to tell me if there's maybe some other flag or option set wrong:

Code:
speed 19200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^H; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>;
start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 5;
-parenb -parodd cs8 -hupcl -cstopb cread clocal crtscts
ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke

Thanks in advance for your help,
Pa-trick.
# 2  
Old 11-21-2011
Code:
echo "my_serial_command" /dev/ttyUSB0

That doesn't do what you think it does.

Try
Code:
echo "my_serial_command" > /dev/ttyUSB0

It'd also be good to know what device you're talking to. A modem? A cell phone? A motor controller?

Another thing you can do is run stty on the serial port while minicom is running in order to get its exact serial settings.

Last edited by Corona688; 11-21-2011 at 01:13 PM..
# 3  
Old 11-22-2011
Thanks Corona688 for pointing me to the echo command. Indeed there was something wrong in the command. However, in addition to your hint I had to add the options -e (enable interpretation of backslash escapes) and -n (do not output the trailing newline) to the echo command and a forced carriage return \r after the command:
Code:
echo -en "my_command\r" > /dev/ttyUSB0

Using
Code:
cat < /dev/ttyUSB0 > output.dat

now outputs the messages returned from ttyUSB0 into the file output.dat.

Concerning your question which device I use: It's an RS485-to-USB converter that is connected to an optical particle counter. The serial communication needs to be done for instrument configuration and data transfer.
# 4  
Old 11-22-2011
stty is supposed to handle that for you. There's an stty option to translate lf's into cr's, onlret.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. SCO

Minicom

hello is there a copy of minicom or equivalent for unixware 7? thanks (3 Replies)
Discussion started by: deus-programmer
3 Replies

2. Shell Programming and Scripting

Help with minicom script

I'm a fairly new user to Linux based systems and am still a little uncomfortable with using the command interface. I'm trying to get my feet wet but have unfortunately hit a wall and am actually not even sure what I am trying to accomplish is at all possible. Basically, I am trying to use a... (0 Replies)
Discussion started by: nrdk00
0 Replies

3. Shell Programming and Scripting

Little script with minicom

Hi all, i must do a little script that send AT command at ttyUSB3.. for example: Start Minicom: Set serial port ttyUSB3 AT+CREG? if response != OK then do something ...other AT command (open a socket tcp/ip with at comman) Send a file .txt for example. exit minicom. I saw on the... (49 Replies)
Discussion started by: enaud
49 Replies

4. Shell Programming and Scripting

Exiting from Minicom on a shell script

This is what I've tried: #!/bin/sh send sh send showifs send exit ! killall minicom My problem is that for some reason when I do this it doesn't give me the results of the prior commands sent like showifs So I suspect my syntax is wrong. (1 Reply)
Discussion started by: uradunce
1 Replies

5. Shell Programming and Scripting

expect minicom

Hi, I am new to using minicom. I want how to write a expect script for minicom login? I wrote a code but its not acting what iam expecting. here I have my code: #!/usr/bin/expect set fd fconfigure $fd spawn -open $fd spawn minicom expect “enter:” send "\n" send "\n" ... (3 Replies)
Discussion started by: vanid
3 Replies

6. Shell Programming and Scripting

running scripts in minicom

Hi, I am new to use minicom. I want script to run on minicom with username and password as automated.(Expect). please could anyone suggest the sample code for it. Thanks in advance (2 Replies)
Discussion started by: vanid
2 Replies

7. Red Hat

Minicom with VMWare ESX Server

Hello! I have an ESX Server up and running. Now I want to connect a serial device to the COM Port. For that I need the minicom program. When I try "configure - make - make all" I get some errors. Can someone please explain to me, what the problems are: # ./configure checking for a... (3 Replies)
Discussion started by: Kickbit
3 Replies

8. Linux

how to test for serial commonication??(minicom)

I am testing for serial comm.......... I got suggestion of minicom.... but when i fire minicom... then i get the following error... minicom minicom: WARNING: configuration file not found, using defaults Device /dev/modem access failed: No such file or directory. I am using fedora 6 ,... (3 Replies)
Discussion started by: arunchaudhary19
3 Replies

9. UNIX for Dummies Questions & Answers

Minicom Scripting

Does anyone have a working minicom script they would care to post as I can't get the scripting working and the scriptdemo and unixlogin sample scripts are on my system either. Thanx, I (2 Replies)
Discussion started by: ianf
2 Replies

10. UNIX for Dummies Questions & Answers

linux - minicom

hello. i'm attempting to use minicom in linux, but i'm having some difficulties. When i type in "minicom", the application opens up. It says 'starting minicom/finding modem'(something like that). However, once it actually starts, I can't do anything. No matter what I type in, it doesn't work. ... (2 Replies)
Discussion started by: kickboxer
2 Replies
Login or Register to Ask a Question