How to setup speed of serial ports


To change the speed of the serial console (PPCBoot loader and Linux console) to 9600 baud:
1. Boot with serial cable connected and terminal program running at 115200 baud.
2. Press "p" to stop the boot loader before Linux starts.
3. Enter the following command:
setenv baudrate 9600
The following message appears:
## Switch baudrate to 9600 bps and press ENTER ...
4. Change the baud rate of the terminal program to 9600 and press enter.
5. Enter the following command to make the changes permanent for the all following reboots:
6. You can change to another speed or back to 115200 any time by repeating the procedure with a different value for the spee.

To change the speed of one of the serial ports to be used by a user program running with Linux:
1. You can use the program stty like this:
stty -F /dev/ttyS0 speed 9600
This will change the speed of the 1st serial port to 9600. The command will need to be issued every time the mvBLueLYNX reboots.
2 You can also use stty to check the current speed (or other parameters):
stty -F /dev/ttyS1
This will produce the following output....
speed 115200 baud;
flush = ^U;
-brkint -imaxbel

To change the speed of a serial port from within your program:
Use the termios interface:
tcsetattr (...)
See also the example in "/usr/src/mvblue/testdemos/send2ttySX" on the latest CD for full details.

Somewhat out-of-date, but still useful, is the "Serial Programming HOWTO" ( oder

Go back