Connecting through the serial port
The simplest way to monitor a system is to use a terminal emulator connected to the serial port (available on most target development boards). Terminals can produce diagnostic messages in almost all circumstances as they can be driven at a very low level. This is useful when troubleshooting Linux kernel boot problems.
For more information on using a serial terminal with Linux, see the Text-Terminal-HOWTO.
To use a serial port in this way, you will need:
* a target board with a serial port
* a suitable serial cable
* a terminal (or terminal emulator)
Serial port terminology originates from connections between dumb terminals and mainframe computers. The terminal devices, which include terminals, printers and other peripherals at one end and the computer itself at the other end, are known as data terminal equipment (DTE). The intermediate devices, such as modems, are known as data communications equipment (DCE). Traditionally DTE have a male socket and DCE a female socket. The standard DTE to DCE cable is female to male plugs with pins wired straight through. Connecting DTE directly to DTE (for example, SoC to host) using a cable requires a female to female connector, with some pin wirings crossed over (or twisted). This type of cable replaces the DCE and is referred to as a null modem cable.
On most STMicroelectronics' target boards the serial ports are 9 pin D-Sub sockets. These have labels such as COM0, SCIF0 or UART2, depending on the internal connection. These must be related to the device name Linux uses for the port (for example, /dev/ttyAS0). For more details, see the appropriate boards page.
The terminal (or the computer acting as a terminal emulator) and the target board normally have a 9 pin male D-Sub socket. These should be connected using a null modem cable. Some target boards have a 9 pin female socket. In this case, a straight male to female cable is normally required.
To connect a stand-alone terminal, for example a VT220, it should only be necessary to plug it into the serial port and configure parameters such as the baud rate, parity and several stop bits. This configuration is usually carried out using menus displayed by software built into the terminal itself.
These dumb terminals have generally been replaced by computers running terminal emulation software. Many terminal emulators are available, with varying capabilities and features. The most commonly used emulators on Linux are minicom and Kermit. There are many alternatives, two which have been tested are seyon, which runs under the X Windowing System, and TinyTERM, which is a commercial product from Century Software.
It is also possible to use a computer running Microsoft Windows. Current releases ship with a simple terminal emulator called HyperTerminal, and there are many other free and commercial terminal emulators available, such as PuTTY and TeraTerm. It is quite possible to use any of these to access a target system running Linux.
minicom
For more information about minicom, check the minicom man page (man minicom), or the documentation which is installed (in Fedora) in /usr/share/doc/minicom-<n.nn.n>/doc/ (replace <n.nn.n> with the installed version of minicom).
To initialize minicom, log in as root, and type:
This starts up minicom in setup mode. The default configuration is designed for use with a modem, so it is necessary to make the following changes in the Serial port setup menu.
1.
Change the Serial Device to /dev/ttyS0 if you are using the first serial port on the PC (called COM1 when running Windows), /dev/ttyS1 for the second serial port (COM2), and so on.
2.
Change the Bps/Par/Bits field to 9600 8N1, (9600 baud, 8 bits, no parity, 1 stop bit). These are the default settings used by the Linux kernel; they can, if necessary, be overridden from the kernel command line by adding extra parameters to the console= option. See kernel-parameters.txt and serial-console.txt.
3.
Turn off both Hardware Flow Control and Software Flow Control.
4.
In the Modem and dialing menu, remove the Init string and Reset string completely if required.
The configuration must now be saved. If you do not want to replace the default configuration you can use the Save setup as... menu option to give the configuration a name of your choice (for example, you could use the name of the serial port: ttyS0). To start minicom with your setup, simply add the configuration name as a parameter to the minicom command, for example:
Note: If you do not want to run minicom as root it is necessary to give it group permission from root using:
Código:
host# chmod g+s /usr/bin/minicom
minicom emulates a VT102 terminal, so to get the best out of it set the TERM environment variable on your target system to vt102.
Kermit
Strictly speaking Kermit is a communication program, not a terminal emulator, because it simply relays characters between the serial port and the console it is running in. However it is convenient to use, particularly for its file transfer capabilities (for example with U-Boot), and it is available for numerous platforms from the Kermit project.
The version of Kermit supplied with Linux is C-Kermit, which runs from the command line. Typical commands to connect to a target using Kermit would be:
Código:
host% kermit
(/) C-Kermit> set line /dev/ttyS1
(/) C-Kermit> set baud 9600
/dev/ttyS1, 9600 bps
(/) C-Kermit> set carrier-watch off
(/) C-Kermit> set flow-control none
(/) C-Kermit> c
Connecting to /dev/ttyS1, speed 9600
Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
STMicroelectronics Base Distribution version 2.3
target login: