Solved

Setting Baud rate in a serial port

Posted on 2007-03-29
6
544 Views
Last Modified: 2015-06-08
how to setup the baud rate in a serial port in a Linux system?
0
Comment
Question by:ehausltd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 4

Assisted Solution

by:infleadorix
infleadorix earned 125 total points
ID: 18817876
Something like, stty -F /dev/ttyS0 9600
0
 
LVL 20

Accepted Solution

by:
nedvis earned 125 total points
ID: 18820698
You acctually have to set data flaw ( baud rate )
http://www.tldp.org/HOWTO/Serial-HOWTO-4.html#ss4.5
http://www.tldp.org/HOWTO/Serial-HOWTO.html
You will need setserail tool installed to configure your serial port:
usage:   setserial serial-device -abqvVWz [cmd1 [arg]] ...
               setserial /dev/ttySx port y irq z autoconfig
What you have to define is actually   baud_base   parameter.
baud_base sets the base baud rate, which  is  the  clock  frequency  divided  by 16.  Normally this value is 115200, which is also the fastest baud rate which the UART can support.
--------------------------------------------------------------------------
Type command :
setserial -g /dev/ttyS*
 to get a list of serial devices, and their port and irq assignments.
You can use this list to help you decide which devices are available to use with setserial either because they are unused (they will be listed as "No such device") or because they are configured to a device that is not really there (the UART will be listed as "unknown").

See also :   man setserial
0
 
LVL 20

Expert Comment

by:nedvis
ID: 18820920
If you want to retreive current baud rate for you e.g. serial port know in Windows as COM1 type this command:
setserial -a /dev/ttyS0
It will give you something like this on my computer:
# setserial -a /dev/ttyS0
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4
        Baud_base: 115200, close_delay: 50, divisor: 0
        closing_wait: 3000
        Flags: spd_normal skip_test

And if you want to change baud rate type this :

setserial   /dev/ttyS0   Baud_base   38400

NOTE: that uppercase "B" in baud
or type the baud rate you want your port set to.

( valid baud rate values are : 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600 , 19200
38400, 57600, 76800, 115200 )
0
 
LVL 3

Expert Comment

by:brycen
ID: 18987031
When you're just starting, running "minicom" is helpful.  That has an easy console interface, and can help you determine if you're connected to the right port at the right baud rate.  Then start messing with setserial.
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question