How to : Install and setup Linux Minicom for UART communication

By | June 3, 2016

Minicom is a friendly terminal based program used for UART communication. This program works well with Linux and other Unix based systems. There are other serial programs available such as picocom, putty, coolcom, cutecom etc.. But, the first choice for embedded Linux developers is minicom.

Install minicom package:

In Ubuntu system run below command to install minicom.

$ sudo apt-get install minicom

Setup Minicom mode:

Minicom provides a menu to setup serial post settings. To open this menu run below command.

$ sudo minicom -s

You will be presented as shown below.

            | Filenames and paths      |
            | File transfer protocols  |
            | Serial port setup        |
            | Modem and dialing        |
            | Screen and keyboard      |
            | Save setup as dfl        |
            | Save setup as..          |
            | Exit                     |
            | Exit from Minicom        |

Since this is a terminal based program, mouse clicks won’t work. So, to navigate use up/down keys of keyboard.

Lets discuss about “serial port setup”. As you can see, there are other options available as well. But, they are noting to do with UART settings. We will discuss about those in the upcoming posts.

Serial port setup:

Navigate two steps down and select “serial post setup”. You will be presented with a menu as shown below.

    | 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?                                              |

Let us discuss about important options.

1. A  —  Serial Device :

Press ‘A’ to enter correct serial device node or serial interface. If you are unsure about device node then refer below sections.

How to find Serial Device Node - Click Me

– DB9 serial port :

If you are using a conventional IBM PC DB9 connection then device node will be ttyS0. So change as shown below.

A -    Serial Device      : /dev/ttyS0

– USB to Serial converters :

A USB to TTL (or) USB to RS232 converter detects as ttyUSBX. X is a integer start from 0. To know exact device node check below procedure.

  1. Insert USB to serial to computer
  2. Run below command
$ dmesg | tail

You will get similar log as shown below

minion@ubuntu:~$ dmesg | tail
[14098.219921] usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[14098.220087] usb 2-2.1: Product: USB-Serial Controller
[14098.220174] usb 2-2.1: Manufacturer: Prolific Technology Inc.
[14101.107080] usbcore: registered new interface driver usbserial
[14101.109450] usbcore: registered new interface driver usbserial_generic
[14101.111954] usbserial: USB Serial support registered for generic
[14101.225719] usbcore: registered new interface driver pl2303
[14101.234567] usbserial: USB Serial support registered for pl2303
[14101.240198] pl2303 2-2.1:1.0: pl2303 converter detected
[14101.284379] usb 2-2.1: pl2303 converter now attached to ttyUSB0

As you can see, ttyUSB0 is the device node in my case. So change the Serial Device accordingly.

A -    Serial Device      : /dev/ttyUSB0

– Communication Device Class (CDC):

Linux enumerates CDC port as ttyACMx. Where x is an integer starts form 0. If you have multiple CDC devices connected to Linux PC, then use below command to find exact device node.

$ dmesg | tail

In the minicom change Serial Device to /dev/ttyACM for CDC devices

A -    Serial Device      : /dev/ttyACM0

2. E –    Bps/Par/Bits – Baud rate:

Next, change the desired baudrate, parity, stopbit setting. To do that, press ‘E’. You will be presented with ‘comm parameters’ menu as shown below.

+---------[Comm Parameters]----------+
|                                    |
|     Current: 115200 8N1            |
| Speed            Parity      Data  |
| A: <next>        L: None     S: 5  |
| B: <prev>        M: Even     T: 6  |
| C:   9600        N: Odd      U: 7  |
| D:  38400        O: Mark     V: 8  |
| E: 115200        P: Space          |
|                                    |
| Stopbits                           |
| W: 1             Q: 8-N-1          |
| X: 2             R: 7-E-1          |
|                                    |
|                                    |
| Choice, or <Enter> to exit?        |

As you can see in the above menu, my current settings are 115200 8N1, where 115200 is baudrate, 8 is data bits, ‘N’ no parity, ‘1’ is No of stop bits.

Each option has its own alphabet. Press appropriate key to change the settings.

Suppose, if you want to change baudrate to desired value then press ‘A’ or ‘B’, where option ‘A’ is to set next standard baudrate, Option ‘B’ is to set previous standard baudrate value.

3. Hardware and Software flow control :

If you have specific information about hardware and software flow control then select accordingly, otherwise select ‘NO’.

Once you are done with serial terminal settings, go back to main menu.

If you want to use these settings as default for future use, then select “Save setup as dfl” and press Enter.

Now select ‘Exit‘ and press enter. This will open minicom serial terminal with your settings.

Welcome to minicom 2.7

OPTIONS: I18n                                                                
Compiled on Jan  1 2014, 17:13:22.                                           
Port /dev/ttyUSB0                                                              
Press CTRL-A Z for help on special keys


Leave a Reply

Your email address will not be published. Required fields are marked *