Configuration of minicom

Source: Internet
Author: User

1. Before using minicom, you must first ensure that you have read/write permissions on the serial port. We know that a Linux Device corresponds to a file in the/dev/directory. The serial port COM1 corresponds to ttys0 and com2 corresponds to ttys1. Run the following command to view your permissions on COM1:
$ LS-L/dev/ttys0
CrW-RW ---- 1 root dialout 4, 64 2009-08-01 11: 05/dev/ttys0
As you can see, its owner is root.

2. Just like configuring a Super Terminal in Windows, you must configure the serial port before using minicom.
Run # sudo minicom-S

Select Serial Port setup. The cursor is displayed on "change which setting", type "A", and move the cursor to the corresponding position of item A: ttys0 for serial port COM1, com2 corresponds to ttys1 (select ).

Configure the baud rate, data bit, and stop bit, and enter "E". The baud rate is 115200 8n1 (Data bit 8, no parity check, stop bit 1 ), type "F" and "G" for hardware/software traffic control, and select "no" for both hardware and software traffic control. After confirming that the configuration is correct, you can press enter to return to the upper-level configuration interface and save it as the default configuration (save setup as DFL ). Finally, select the "exit from minicom" command to exit.

The specific configuration information is as follows:
Serial Port setup [enter]
+ ------------------------------------------------------------- +
| A-serial device:/dev/ttyusb0 |
| B-lockfile location:/var/lock |
| C-callin program: |
| D-callout Program-: |
| E-bps/PAR/bits: 115200 8n1 |
| F-hardware Flow Control: No |
| G-software flow control: No |
|
| Change which setting? |
+ ------------------------------------------------------------- +

Note: If the serial port is used directly instead of USB to serial port, set the serial device to/dev/ttys0.

Then restart minicom (that is, directly execute The minicom command in shell to enter the minicom console) to make the configuration take effect, and then connect it to the serial line of the Development Board, you can print the correct serial port information in minicom. In the console, press Ctrl + a z to enter the minicom menu.

Key combination: press Ctrl + a first, then release the two keys, and then press Z. There are also some common key combinations.
(1) s key: send the file to the target system;
(2) W key: automatic screen scrolling. When more than one line is displayed, the next line is automatically wrapped. This function is useful when viewing kernel startup information.
(3) c: Clear the display content on the screen;
(4) Key B: view the historical display of minicom;
(5) Key X: Exit minicom and a prompt is displayed to confirm exit.

3. Directory of the configuration file
CTRL + A --> O
+ ----- [Configuration] ------ +
| Filenames and paths |
| File transfer protocols-|
| Serial Port setup |
| Modem and dialing |
| Screen and keyboard |
| Save setup as DFL |
| Save setup as... |
| Exit |
+ -------------------------- +

Select "filenames and paths"
+ ----------------------------------------------------------------------- +
| A-download Directory:/home/crliu |
| B-upload Directory:/tmp |
| C-script directory: |
| D-script program: runscript |
| E-Kermit program: |
| F-logging options |
|
| Change which setting? |
+ ----------------------------------------------------------------------- +

(1) storage location of A-download file (Development Board ---> PC)
Files on the Development Board will be transmitted to the/home/crliu directory on the PC.
(2) B-upload reads the uploaded file from this place (PC ---> Development Board)
The PC sends a file to the Development Board. The file to be sent is in the/tmp directory (the directory on the PC ). After this configuration, you only need to enter the file name each time you send a file to the Development Board, without entering the absolute path of the directory where the file is located.

Iii. How to use USB to serial port Devices in Linux

For notebook holders who do not have serial ports, hardware development often does not have serial ports, but now there is a USB to serial port device. However, new problems have emerged. For example, there are still some configuration problems in the communication between the PC and the target machine under minicom. The following describes the specific configuration and problems of USB-to-serial ports in Linux:

Note: by default, the USB to serial port driver (pl2303) is installed in Ubuntu ).
Configuration of minicom, USB to serial port
1. # lsmod | grep usbserial
If USB serial exists, the USB-to-serial port is supported.

2. Plug in the USB to serial port and enter the command # dmesg | grep ttyusb0 on the terminal. If the connection is successful, the Ubuntu system has recognized the device.

Note: Ubuntu in the virtual machine environment cannot be automatically identified by default. You need to click "prolific USB-serial controller" in the lower right corner of the Virtual Machine window, and then select "Connect (disconnect from host) "to be recognized by the Ubuntu system.

3. Set serial device:/dev/ttyusb0 in the configuration of minicom and restart the Development Board. In this way, you can use minicom to print the serial port information normally.

4. Problems
If the above step minicom still does not work properly, the following error message is displayed:
# Sudo minicom
Minicom: cannot open/dev/ttyusb0: the file or directory does not exist.

At this time, you can try to change the USB port and then perform the above procedure again. If this error is still prompted, you can use the following method to solve it.

This method adds a serial device to the hardware and adds the device under the window to the virtual machine. That is to say, you need to add the USB to serial port when the window gets the focus, and then add the device to the virtual machine. Then you can view the device file of the added device under Ubuntu, usually/dev/tty0 or/dev/ttys0.

This method uses Windows USB to serial port as the serial port of the virtual machine, so tty0 or ttys0 is used instead of being loaded under Ubuntu.

The procedure is as follows:
(1) Open the VM environment and select "VM --> Settings (CTRL + D )".

(2) Click "add". In the Add hardware wizard, select "Serial Port" and click "Next ".

(3) Select the first item "use physical port on the host" and click "Next ".

(4) Select "physical serial port" as "Auto Detect", select "connect at power on", and click "finish.

(5) set serial device:/dev/tty0 or serial device:/dev/ttys0 in the configuration of minicom above, restart the development board, and then run minicom normally.

Another problem is that ifconfig in Ubuntu does not have an IP address,

You can do this:

Sudo gedit/etc/Network/interfaces

Auto Lo
Iface lo Inet loopback # Lo is the local loopback address: 127.1

Auto eth0
Iface eth0 Inet static
Address 192.168.1.152
Gateway 192.168.1.1
Netmask 255.255.255.0
Network 192.168.1.0
Broadcast 192.168.1.255 # Set the IP address of eth0

In this way, the IP address does not take effect immediately.
Sudo/etc/init. d/networking restart

If you only want to temporarily change the IP address, you do not need to modify the interface. You only need to use ifconfig. However, after the system restarts, the configuration in interfaces will be restored.

$ Sudo ifconfig eth0 192.168.1.111 netmask 255.255.255.0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.