Linux serial tool minicom

Linux minicom

Minicom in Linux is a serial communication tool for serial communication with external devices. It can be used to communicate and configure with embedded devices, debug devices, network devices, etc.

  1. Debug and configure serial devices: minicom can be used to connect and debug various serial devices, such as modems, routers, switches, etc. Through minicom, users can view the output information of the device, send instructions for configuration and debugging.
  2. Remote terminal connection: minicom can be used as a terminal emulator for remote connection to other computers or devices. Through the serial port connection, the user can operate the remote device on the local computer for remote management and maintenance.
  3. Data transfer and file transfer: minicom supports data transfer through the serial port, which can be used to transfer files, backup data, etc. Users can send files to and receive files from remote devices via minicom.
  4. System debugging and troubleshooting: minicom can be used to debug and troubleshoot system failures. Connect to the system console through the serial port, users can view the system startup information, error logs, etc., to help locate and solve problems.
  5. Embedded development and debugging: minicom is an important tool for embedded system developers. It can be used to communicate with embedded devices for program download, debugging and testing.

minicom can conveniently carry out serial communication and remote terminal connection in the Linux system, and is very useful for debugging, configuring and managing various serial devices and troubleshooting the system.

Author: Charcoal Grilled Maodan , click on the blogger to learn more.


提示:Minicom终端界面中退出十无响应,可以 ‘Ctrl' + C退出进程。


1. minicom open serial port

1.1 Install Minicom

sudo apt-get install minicom

1.2 Configure Minicom

  • minicom-configuration
sudo minicom -s

insert image description here
Configure minicom according to personal preference.

  • Select the serial device
    In the configuration interface, use the up and down arrow keys to select "Serial port setup", and then press the Enter key.
    Serial port setup

  • Configure serial port parameters:
    In the serial port setting interface, you can configure parameters such as baud rate, data bits, stop bits, and parity bits.
    In the example, the port is /dev/ttyUSB0, the baud rate is 111520, the data bit is 8bit, no stop bit, no parity, no flow control.
    insert image description here

  • Save configuration
    After the configuration is complete, press the F10 key to save the configuration and exit.

  • Use Minicom
    Minicom's terminal interface to open minicom and start monitoring serial port data.

minicom

In the Minicom terminal interface, you can send and receive serial data. Press the Ctrl+A key, and then press the Z key to open the Minicom command menu, which contains some commonly used commands.

  • Exit Minicom:
    In the Minicom terminal interface, press the Ctrl+A key, and then press the X key to exit Minicom.

2 USB to serial port setting default permissions

In Ubuntu, udev rules can be used to dynamically match and set the permissions of the /dev/ttyUSB0 node. udev is a device manager for managing devices in Linux systems. Open a terminal and create a udev rules file as root user.

2.1 Write udev rules

The command to create a new rules file is as follows:

sudo nano /etc/udev/rules.d/99-usb-serial.rules

In 99-usb-serial.rules, add the following:

KERNEL=="ttyUSB[0-9]*", MODE="0666"

Save and close the file.

2.2 udev rules take effect immediately

Reload the udev rules with the command:

sudo udevadm control --reload-rules

Replug the USB device or restart the system, the udev rules will automatically match and set the permission of the /dev/ttyUSB0 node to 0666, that is, all users have read and write permissions.

Tips

  1. When I exited, I found that I could not return to the terminal. I /dev/ttyUSB* found that the permission was root, and I changed it to the current user to solve this problem.
-KERNEL=="ttyUSB[0-9]*", MODE="0666"
+KERNEL=="ttyUSB[0-9]*", OWNER="userName", MODE="0666"
  1. After adding the log saving setting, the terminal log will be recorded in the specified file.

Summarize

It is worthwhile for the blogger to step on the pit and write it. Welcome to follow the blogger to learn more.

Guess you like

Origin blog.csdn.net/weixin_35723192/article/details/131526063