Difference between revisions of "Getting Started With Minicom"

From wiki.emacinc.com
Jump to: navigation, search
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{todo| InProgress (10.28.2015-16:36->JJ+)|Jeffrey Jung| project=OE 5.0,InProgress,JJ,MD }}
+
{{todo| Complete (10.28.2015-16:36->JJ+);(11.2.2015-18:00->JJ+);(11.3.2015-14:25->JJ+);(11.04.2015-13:00->MD-);(11.04.2015-17:15->JJ+);(11.05.2015-18:55->MD-);(11.09.2015-15:14->JJ+);(11.10.2015-11:00->MD+);(11.10.2015-12:32->KY+) |Jeffrey Jung| project=OE 5.0,Complete,JJ,MD,KY}}
 
{{#seo:minicom
 
{{#seo:minicom
 
|title=Getting Started With Minicom
 
|title=Getting Started With Minicom
 
|titlemode=append
 
|titlemode=append
|keywods=
+
|keywords=minicom,PuTTY,serial console,terminal
 
|description=A guide to help customers connect to their devices with minicom
 
|description=A guide to help customers connect to their devices with minicom
 
}}
 
}}
 
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /****************************************  Page Description Text  ****************************************/ -->
 
<!-- /****************************************  Page Description Text  ****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- <span style="background:#00FF00;color:#FF0000;font-size:300%">'''''Put the page description text here.'''''</span>
 
<!-- <span style="background:#00FF00;color:#FF0000;font-size:300%">'''''Put the page description text here.'''''</span>
 
 
__TOC__
 
__TOC__
 
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /***************************************** Background Information ****************************************/ -->
 
<!-- /***************************************** Background Information ****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:bg | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
 
{{:Templateimpl:bg | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
<code>minicom</code> is a serial communication program that connects to devices through a GNU/Linux PC's serial ports. If run by calling its name without any additional arguments, it uses whatever settings have been saved for its defaults in <code>/etc/minicom/minirc.dfl</code>. For those using a Windows, PuTTY is a great application to make such connections between a Windows PC and one of our EMAC devices. More information about PuTTY can be found at http://wiki.emacinc.com/wiki/PuTTY.
+
<code>minicom</code> is a serial communication program that connects to devices through a GNU/Linux PC's serial ports. If run by calling its name without any additional arguments, it uses whatever settings have been saved for its defaults in <code>/etc/minicom/minirc.dfl</code>. For those using Windows, PuTTY is a viable application to make such connections between a Windows PC and one of our EMAC devices. More information about PuTTY can be found at http://wiki.emacinc.com/wiki/PuTTY.
  
<!-- Pulling a lot of this information from the LifeRay 'Using Minicom' and 'iPac-9x25 Getting Started' pages -->
+
Please note that while PuTTY will work, it is missing a number of features relative to a real Linux terminal.  In particular, a number of keystroke shortcuts will not work with PuTTY, and not all output will be displayed correctly in PuTTY (although it does manage to display most output correctly). For serious work with Linux, a real Linux terminal (such as minicom, described here) is strongly recommended.
  
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
Line 26: Line 23:
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:geninfo | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
 
{{:Templateimpl:geninfo | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
The use of <code>minicom</code> is required when connecting to and EMAC board for testing purposes. This pages sets out to provide general information about using <code>minicom</code> as well as a guide to demonstrate using it to connect with EMAC devices.
+
The use of a terminal emulator, such as <code>minicom</code>, is required when connecting to an EMAC board via a serial console. This page sets out to provide general information about using <code>minicom</code> to communicate between EMAC machines and a development PC.
 +
 
 +
The following list of arguments can be used to alter minicom's behavior from the command line:
 +
 
 +
;-b <baudrate>
 +
:The serial port baud rate used by the external device–typically a SOM.
 +
;-D <device_name>
 +
:The device name for the serial port being used.
 +
;-h
 +
:Show a list of arguments that minicom accepts.
 +
 
 +
For a more comprehensive list of options and their descriptions, read the manpage for minicom:
 +
{{cli|man minicom|hostname=developerpc|username=user}}
 +
 +
The calling convention for minicom is as follows:
 +
<code>minicom [OPTIONS] [configuration]</code>
 +
 
 +
Where <code>[OPTIONS]</code> is a space-delimited list of options from among those listed above.
 +
<code>[configuration]</code> is a configuration file that can be found in <code>/etc/minicom/</code>.
 +
 
 +
Note that most configurations are named <code>minirc.<some_name></code> where <code><some_name></code> is what should be specified in place of <code>[configuration]</code> above.
 +
 
  
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
Line 32: Line 50:
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:using | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
 
{{:Templateimpl:using | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
<cl>1. If <code>minicom</code> has yet to be installed on your development Linux machine, use <code>apt-get</code> to install the <code>minicom</code> package
+
<cl>1. If <code>minicom</code> has yet to be installed on your Linux machine, use <code>apt-get</code> to install the <code>minicom</code> package
{{clo|indent=1}}
+
{{cli|sudo apt-get install minicom|hostname=developerpc|username=user}}
{{clio|sudo apt-get install minicom|hostname=developerpc|username=user}}
 
{{clos}}
 
  
 
* The <code>minicom</code> settings will need to be changed so that the application will be able to find your device. Pull up the settings using the <code>-s</code> option.
 
* The <code>minicom</code> settings will need to be changed so that the application will be able to find your device. Pull up the settings using the <code>-s</code> option.
{{clo|indent=1}}
+
{{cli|sudo minicom -s|hostname=developerpc|username=user}}
{{clio|sudo minicom -s|hostname=developerpc|username=user}}
+
 
{{clos}}
+
This should bring up a colorful display listing the different settings. If the display isn't colored, arrow down to '''Exit from Minicom'''. Run the <code>minicom</code> command with the option <code>-con</code>. The <code>c</code> specifies the color display and <code>on</code> tells <code>minicom</code> to display the interface in color. <code>minicom</code> can be made to always run in color by modifying the <code>~/.bashrc</code> file, setting the <code>MINICOM</code> environment variable by adding the lines shown below, and restarting your terminal session (or sourcing your <code>.bashrc</code>) to make the change take effect:
 +
<pre>
 +
MINICOM&#x3d;'-con'
 +
export MINICOM
 +
</pre>
  
* The first thing that will need to be configured is the '''Serial port setup'''. Arrow down to the title and press the Enter key.<br/>[Screenshot?]
+
Another method to set <code>minicom</code> to always display in color is to set an alias for <code>minicom</code> to <code>minicom -con</code>. However, doing this could lead to problems or confusion when trying to run minicom with other aliases or with a very specific set of commandline options, so the environment variable method should be used instead wherever possible.
 +
<pre>
 +
alias minicom='minicom -con'
 +
</pre>
  
* To modify the different configurations, press the key corresponding to the setting. For example, press the 'A' key to modify the '''Serial Device'''. Press the 'Enter' key to save the parameters for the setting. The EMAC devices will require the '''Bps/Par/Bits''', and flow control settings. Set '''Bps/Par/Bits''' to 115200 baud, 8 data bits and no priority. Set both flow control settings to ''''No''''. <br /> [[File:Minicomserialport.png| Serial Port Setup for minicom]]
+
* The first thing that will need to be configured is the '''Serial port setup'''. Arrow down to the title and press the 'Enter' key.
 +
<br />
  
If you're likely to use the same serial port when connecting to your device with minicom, modify the '''Serial Device''' setting to have the path to the port. This way, you'll be able to run the command without any options or commands. Press the 'Esc' key to save the settings and to be be brought back to the configurations page
+
* To modify the different configurations, press the key corresponding to the setting. For example, press the 'A' key to modify the path to the '''Serial Device'''. Press the 'Enter' key to save the parameters for the setting. The settings for specific EMAC devices can be found at the [[Serial_Connections | Serial Connections]] page. <br /> [[File:Minicomserialport.png| Serial Port Setup for minicom]]
 +
<br />
 +
In this screenshot, the "115200 8N1" for the '''Bps/Par/Bits''' setting indicates the baud rate is set to 115200, data bits set to 8 (the '8' in 8N1), parity is set to none (the 'N' in 8N1), and stop bits is set to 1 (the '1' in 8N1).
  
* The next setting that needs to be configure is the '''Modem and dialing'''. Press the 'A" key and delete its content. Hit the 'Enter' key to save the setting as blank. Do this for B-K, and H. Hit the 'Esc' key when finished deleting the content of these settings. That's all the modifications that need to be done to get <code>minicom</code> set up. Arrow down to '''Exit from Minicom''' and press 'Enter'.
+
* Press enter and scroll to '''Modem and dialing''' and press enter again. Clear out the '''Init string''', '''Reset string''', '''Dialing prefix #1''', '''Dialing suffix #1''', '''Dialing prefix #2''', '''Dialing suffix #2''', '''Dialing prefix #3''', '''Dialing suffix #3''' by pressing the corresponding letters [A-H] then deleting the string. The final result should look like: <br />[[File:Minicom_dialing_parameter_setup.png| Minicom dialing and parameter setup]]
 +
<br />
  
 +
* You will most likely wish to modify the '''Serial Device''' setting to have the path to the serial port you normally use. This way, you'll be able to run the command without any options or commands.
 +
Press the 'Esc' key to be be brought back to the configurations page.
 +
 +
* The next setting that needs to be configured is the '''Modem and dialing'''. Press the 'A' key and delete its content. Hit the 'Enter' key to set the setting as blank. Also do this for B through H and K. Hit the 'Esc' key when finished deleting the content of these settings.
 +
* That's all the modifications that need to be done to get <code>minicom</code> set up. You'll need to save the configurations in one of two ways:
 +
:*You may want to save the configuration as the default whenever <code>minicom</code> is launched. Arrow down to '''Save setup as dfl''' and press 'Enter'.
 +
 +
:*You may also save the modifications as its own configuration. This is advantageous if you have many serial ports or if you have multiple systems with varying serial connection configurations. Arrow down to '''Save setup as..''' and press 'Enter'. Name the configuration as something unique, like <code>ttyS11</code> to identify that the path to the serial device is <code>/dev/ttyS11</code>. The new file created for your configuration will be <code>/etc/minicom/mini.ttyS11</code>.  You may pass the configuration as an argument to use that configuration when launching <code>minicom</code>:
 +
:{{cli|minicom ttyS11|hostname=developerpc|username=user}}
 +
 +
 +
:If a "<code>cannot write to"</code> message pops up, you likely aren't running the command as root. Re-run  "<code>minicom -s</code>" with <code>sudo</code>.
 +
 +
* Once you have saved the configuration, arrow down to '''Exit from Minicom'''.
 
</cl>
 
</cl>
 +
  
 
== Running Minicom ==
 
== Running Minicom ==
Now that everything is configured, let's make the connection to the device.
+
Now that everything is configured, you are ready to open the serial connection.
<cl>1. Run the <code>minicom</code> command with the option <code>-D</code> and the path to the device as an argument.
+
<cl>1. Run the <code>minicom</code> command to start <code>minicom</code> with the serial port setting you configured above. If you wish to use <code>minicom</code> on a different serial port, see the note below.
{{clo|indent=1}}
 
{{clio|minicom -D /dev/ttyS10|hostname=developerpc|username=user}}
 
{{clos}}
 
Using the <code>-o</code> option will allow <code>minicom</code> to make the connection more quickly by not sending AT commands to initialize a modem.
 
  
* Log in to the device as the root user
+
* Log in, if necessary, with the appropriate username and password for the device. Login information can be found [[System_Log_In | here]].
{{clo}}
+
You're now able to communicate to the device and use <code>minicom</code> in the same way as using the terminal for the device.
{{clos}}
 
 
</cl>
 
</cl>
 +
{{ note | When opening a connection to a different serial port than what has been saved from the <code>minicom</code> configurations, use the <code>-D</code> option to specify the path to the desired serial port. For example, to use <code>/dev/ttyUSB0</code>, run <code>minicom</code> like this:
 +
 +
 +
{{cli|minicom -D /dev/ttyUSB0| hostname=developerpc| username=user}}
 +
 +
}}
 +
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*****************************************      Examples        *****************************************/ -->
 
<!-- /*****************************************      Examples        *****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
{{:Templateimpl:examples | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
+
<!-- There's only one example, so we really don't need an entire section for it.  Plus, the cli template looks nice inside the Note box.
 +
 
 +
{{:Templateimpl:examples | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}  
 +
Suppose the port <code>/dev/ttyS10</code> is specified as the default. If the desired path to a different port is at <code>/dev/ttyUSB0</code>, run <code>minicom</code> as follows:
 +
{{cli|minicom -D /dev/ttyUSB0| hostname=developerpc| username=user}} -->
  
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
Line 73: Line 121:
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:conclusion | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
 
{{:Templateimpl:conclusion | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
 +
This program is a very important tool for developers. The serial console is essential for working with the bootloader on ARM systems, since U-Boot cannot be accessed via ssh.  Using the serial console, you will be able to configure the bootloader, to program new kernels via the bootloader, to program new filesystems, to make a copy of the filesystem on a board, and to perform memory checks using U-Boot.  The serial console will also enable you to see startup and shutdown messages, to configure and debug the system when networking is not configured or is not working, and to debug the system when the machine is not booting up.
  
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
Line 78: Line 127:
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:moreinfo | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
 
{{:Templateimpl:moreinfo | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
*  
+
* [[System_Log_In | System Log In]]
 +
 
  
 
{{:Templateimpl:whatnext | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
 
{{:Templateimpl:whatnext | initials=JJ | title=Getting Started With Minicom | desc=Description for SEO | project=OE 5.0 }}
*
+
* [[Serial_Connections | Serial Connections]]

Latest revision as of 15:45, 13 July 2017

TODO: {{#todo: Complete (10.28.2015-16:36->JJ+);(11.2.2015-18:00->JJ+);(11.3.2015-14:25->JJ+);(11.04.2015-13:00->MD-);(11.04.2015-17:15->JJ+);(11.05.2015-18:55->MD-);(11.09.2015-15:14->JJ+);(11.10.2015-11:00->MD+);(11.10.2015-12:32->KY+) |Jeffrey Jung|OE 5.0,Complete,JJ,MD,KY}}

Background

minicom is a serial communication program that connects to devices through a GNU/Linux PC's serial ports. If run by calling its name without any additional arguments, it uses whatever settings have been saved for its defaults in /etc/minicom/minirc.dfl. For those using Windows, PuTTY is a viable application to make such connections between a Windows PC and one of our EMAC devices. More information about PuTTY can be found at http://wiki.emacinc.com/wiki/PuTTY.

Please note that while PuTTY will work, it is missing a number of features relative to a real Linux terminal. In particular, a number of keystroke shortcuts will not work with PuTTY, and not all output will be displayed correctly in PuTTY (although it does manage to display most output correctly). For serious work with Linux, a real Linux terminal (such as minicom, described here) is strongly recommended.

General Information

The use of a terminal emulator, such as minicom, is required when connecting to an EMAC board via a serial console. This page sets out to provide general information about using minicom to communicate between EMAC machines and a development PC.

The following list of arguments can be used to alter minicom's behavior from the command line:

-b <baudrate>
The serial port baud rate used by the external device–typically a SOM.
-D <device_name>
The device name for the serial port being used.
-h
Show a list of arguments that minicom accepts.

For a more comprehensive list of options and their descriptions, read the manpage for minicom:

user@developerpc:~# man minicom

The calling convention for minicom is as follows: minicom [OPTIONS] [configuration]

Where [OPTIONS] is a space-delimited list of options from among those listed above. [configuration] is a configuration file that can be found in /etc/minicom/.

Note that most configurations are named minirc.<some_name> where <some_name> is what should be specified in place of [configuration] above.


Getting Started With Minicom

  1. If minicom has yet to be installed on your Linux machine, use apt-get to install the minicom package

    user@developerpc:~# sudo apt-get install minicom
  2. The minicom settings will need to be changed so that the application will be able to find your device. Pull up the settings using the -s option.

    user@developerpc:~# sudo minicom -s

    This should bring up a colorful display listing the different settings. If the display isn't colored, arrow down to Exit from Minicom. Run the minicom command with the option -con. The c specifies the color display and on tells minicom to display the interface in color. minicom can be made to always run in color by modifying the ~/.bashrc file, setting the MINICOM environment variable by adding the lines shown below, and restarting your terminal session (or sourcing your .bashrc) to make the change take effect:

    MINICOM='-con'
    export MINICOM
    

    Another method to set minicom to always display in color is to set an alias for minicom to minicom -con. However, doing this could lead to problems or confusion when trying to run minicom with other aliases or with a very specific set of commandline options, so the environment variable method should be used instead wherever possible.

    alias minicom='minicom -con'
    
  3. The first thing that will need to be configured is the Serial port setup. Arrow down to the title and press the 'Enter' key.

  4. To modify the different configurations, press the key corresponding to the setting. For example, press the 'A' key to modify the path to the Serial Device. Press the 'Enter' key to save the parameters for the setting. The settings for specific EMAC devices can be found at the Serial Connections page.
    Serial Port Setup for minicom
    In this screenshot, the "115200 8N1" for the Bps/Par/Bits setting indicates the baud rate is set to 115200, data bits set to 8 (the '8' in 8N1), parity is set to none (the 'N' in 8N1), and stop bits is set to 1 (the '1' in 8N1).

  5. Press enter and scroll to Modem and dialing and press enter again. Clear out the Init string, Reset string, Dialing prefix #1, Dialing suffix #1, Dialing prefix #2, Dialing suffix #2, Dialing prefix #3, Dialing suffix #3 by pressing the corresponding letters [A-H] then deleting the string. The final result should look like:
    Minicom dialing and parameter setup

  6. You will most likely wish to modify the Serial Device setting to have the path to the serial port you normally use. This way, you'll be able to run the command without any options or commands. Press the 'Esc' key to be be brought back to the configurations page.

  7. The next setting that needs to be configured is the Modem and dialing. Press the 'A' key and delete its content. Hit the 'Enter' key to set the setting as blank. Also do this for B through H and K. Hit the 'Esc' key when finished deleting the content of these settings.

  8. That's all the modifications that need to be done to get minicom set up. You'll need to save the configurations in one of two ways:

    • You may want to save the configuration as the default whenever minicom is launched. Arrow down to Save setup as dfl and press 'Enter'.
    • You may also save the modifications as its own configuration. This is advantageous if you have many serial ports or if you have multiple systems with varying serial connection configurations. Arrow down to Save setup as.. and press 'Enter'. Name the configuration as something unique, like ttyS11 to identify that the path to the serial device is /dev/ttyS11. The new file created for your configuration will be /etc/minicom/mini.ttyS11. You may pass the configuration as an argument to use that configuration when launching minicom:
    user@developerpc:~# minicom ttyS11


    If a "cannot write to" message pops up, you likely aren't running the command as root. Re-run "minicom -s" with sudo.
  9. Once you have saved the configuration, arrow down to Exit from Minicom.


Running Minicom

Now that everything is configured, you are ready to open the serial connection.

  1. Run the minicom command to start minicom with the serial port setting you configured above. If you wish to use minicom on a different serial port, see the note below.

  2. Log in, if necessary, with the appropriate username and password for the device. Login information can be found here. You're now able to communicate to the device and use minicom in the same way as using the terminal for the device.



NOTE
When opening a connection to a different serial port than what has been saved from the minicom configurations, use the -D option to specify the path to the desired serial port. For example, to use /dev/ttyUSB0, run minicom like this:


user@developerpc:~# minicom -D /dev/ttyUSB0


Conclusion

This program is a very important tool for developers. The serial console is essential for working with the bootloader on ARM systems, since U-Boot cannot be accessed via ssh. Using the serial console, you will be able to configure the bootloader, to program new kernels via the bootloader, to program new filesystems, to make a copy of the filesystem on a board, and to perform memory checks using U-Boot. The serial console will also enable you to see startup and shutdown messages, to configure and debug the system when networking is not configured or is not working, and to debug the system when the machine is not booting up.

Further Information

Where to Go Next


Pages with Related Content