LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-09-2012, 09:44 AM   #1
sirabhorn
Member
 
Registered: Jan 2012
Distribution: Debian, Slackware, CentOS
Posts: 45

Rep: Reputation: Disabled
How to configure serial port for null modem?


I would like to transfer files (pc -> a500) via null modem cable connected in serial port by using cat command

How to configure serial port for null modem?

The settings I need are below

Baud rate: 19200, bits/char: 8, parity: None, Stop bits: 1, handshaking: RTS/CTS
 
Old 01-09-2012, 10:19 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Welcome to LinuxQuestions.

No configuration is required. A null MODEM is a type of cable.
http://www.camiresearch.com/Data_Com..._standard.html

The stty command will configure the serial port from the command line.
http://tldp.org/LDP/nag2/x-087-2-ser...iguration.html
stty -F /dev/ttyS0 crtscts
stty -f /dev/ttyS0 speed 19200
 
Old 01-09-2012, 10:35 AM   #3
sirabhorn
Member
 
Registered: Jan 2012
Distribution: Debian, Slackware, CentOS
Posts: 45

Original Poster
Rep: Reputation: Disabled
Thanks for a quick reply!

After studying that link for a moment I guess that the following command captures all those settings I mentioned:

stty 19200 cs8 -parenb crtscts -cstopb -F /dev/ttyS0

(-parenb disbales parity, -cstopb sets one stop bit)
 
Old 01-09-2012, 11:08 AM   #4
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by michaelk View Post
No configuration is required. A null MODEM is a type of cable.
http://www.camiresearch.com/Data_Com..._standard.html
That can be a bit of an over-simplification; yes, a null modem is a kind of cable, but as per the reference that you quote, you can have several different flavours of null modem cables, and if you regard exactly which line gets connected where as configuration (and I don't see a reason, in this context, not to), you would usually expect to select a cable configuration, in combination with the kind of flow control that you use.
 
Old 01-11-2012, 04:46 PM   #5
sirabhorn
Member
 
Registered: Jan 2012
Distribution: Debian, Slackware, CentOS
Posts: 45

Original Poster
Rep: Reputation: Disabled
Plain command "stty" without any switches or attributes shows the current settings of serial

No matter what form of command I try, I do not manage to switch baud rate. It stays as 38400 whenever I type "stty"

(It seems I have only ttyS0 so the problem is not that I should use ttyS1 or other instead)

Any ideas? Does somebody manage to change his baudrate with stty command so that plain "stty" shows the change?
 
Old 01-11-2012, 06:15 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Use sudo or login as root.
 
Old 01-12-2012, 12:49 AM   #7
sirabhorn
Member
 
Registered: Jan 2012
Distribution: Debian, Slackware, CentOS
Posts: 45

Original Poster
Rep: Reputation: Disabled
I used debian/lxde's "root terminal" and now also tried by login as root without GUI (what you get by pressing ctrl+alt+F1)

Uhm, the problem is strange indeed.
 
Old 01-12-2012, 04:21 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
If you do not use any attributes the results will be the terminal settings and not the serial port. You need specify the serial port device.
Quote:
stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
eof = ^A; min = 1; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
Quote:
stty
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?; swtch = M-^?;
ixany iutf8

Last edited by michaelk; 01-12-2012 at 04:24 AM.
 
Old 01-13-2012, 12:50 AM   #9
sirabhorn
Member
 
Registered: Jan 2012
Distribution: Debian, Slackware, CentOS
Posts: 45

Original Poster
Rep: Reputation: Disabled
Could not get those commands working but I got a better idea: to simply use a terminal program

I actually managed to transfer few lines of typed text which was displayed on Amiga's screen...

But then... DEVICE (ttyS0) which had previously always been shown there simply disappeared from the window of CuteCom (terminal program) and seems not ever return (thus the program "cannot connect")

Perhaps I tried to change speed at that point but returning it does not return ttyS0 to CuteCom's DEVICE slot

Or perhaps I tried setserial command at the moment (though I did not try to change any settings with it)


dmesg | grep ttyS
gives following:
[ 0.914354] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 0.935092] 00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

I guess this output is still the same though I am not dead sure

Last edited by sirabhorn; 01-13-2012 at 08:00 AM. Reason: clarification
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Communication between two computers using Null Modem Serial Port Connectin bhanu001 Linux - Networking 7 09-23-2011 06:20 AM
Null modem serial connection problem adriangolding Linux - Hardware 2 12-11-2008 09:20 AM
configuring 25 pin serial null modem dnijaguar Linux - Networking 2 09-03-2004 02:46 PM
A laptop, a pc, a serial null cable modem, ppp, and perl tomascebrian Linux - Networking 0 11-25-2003 04:40 AM
serial communication - null modem cable sg3 Linux - Networking 3 07-17-2003 06:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration