Dev/Host/Minicom
Minicom is a serial communication program with many many features which make it very usefull to connect to targets.
Allow normal users to access ttys and store configurations
Despite what you will read on many places : you do not need to be root to run or configure minicom !!! (but you will need a well configured system).
Get access to ttys
First, you must add the users which should be allowed to run minicom to a group with read and write access to the ttys you want to use, which are most of the time under the "dialout" group (ttyS*, ttyUSB*, ttyACM*, ...).
Well, this part is not really minicom configuration, but it has to be done to use minicom as normal user, so here it is :)
This, of course, is done by the system administrator (root or any user allowed to run the adduser command) :
adduser username dialout
This will only be effective for the next login of the user "username". So if you are already logged in a graphical session and do not want to logout and login back, you can simply use the command "su username" in a terminal to get a new session in which you are in the dialout group for the current session and have access (in this terminal) to the ttys which are in the dialout group.
Store / modify configurations as normal user
Then you may want to be able to store new configurations.
Indeed, one option is to run "minicom -s" as root, change the configuration, and "Save setup as.." to store the configuration
under /etc/minicom/.
But this will create system-wide configurations (Ok, you may be the only user of your system ... but that's not an excuse to do things the wrong way)
When you run minicom with a configuration name, for example "minicom [options] my_config" then minicom will also look for a configuration file named "$HOME/.minirc.my_config" ... in your home directory !
Of course, you can try to create your config manually by looking at examples in /usr/share/doc/minicom/examples or looking over the web for sample configurations, but there's a much more simple way.
I'm using "ttyUSB0" as the config name for the "/dev/ttyUSB0" tty as I feel like it's easy to remember, but the config name can be anything you would remember.
Run minicom with this config name (the tty must be present, plug your USB-serial adapter if it's not the case yet) :
minicom -D /dev/ttyUSB0 ttyUSB0
You can now configure minicom by hitting "Ctrl+a" and "o" ... and instead of "Save setup as dfl" you get "Save setup as ttyUSB0". Make the required changes to your configuration (see below), and use this menu entry to save your configuration.
Now, to create many configurations (say, for ttyUSB1, ttyUSB2, you can simply copy the "~/.minirc.ttyUSB0" file and even edit the copy directly and change the "pu port" line to get the same config for these other ttys.
Configure Minicom
Most of the time, when you start minicom for embedded system development, the default configuration is not appropriate.
The most common modifications to the configuration are the following ones :
$ minicom -D /dev/ttyUSB0 ttyUSB0 [Hit "Ctrl-a" and then "o" to enter configuration menu] --> Serial port setup A --> /dev/ttyUSB0 [You must make a change here or it will not get saved in configuration] E --> Bps/Par/Bits [Opens Comm Parameters menu] --> Comm Parameters E --> 115200 Q --> 8N1 (8 data bits, No parity, 1 stop bit) [Hit Enter to exit sub menu] F --> Hardware Flow Control [Set to No] [Hit Enter to exit sub menu] --> Screen and keyboard R --> Line Wrap [Set to Yes] T --> Add carriage return [Set to Yes] --> Save setup as ttyUSB0 --> Exit [Exit from configuration menu] [Hit "Ctrl-a" and then "q" to leave minicom]
Note that you must exit minicom ("Ctrl-a" and "q") in order to use the new configuration.
you can now run minicom with your new configuration :
minicom ttyUSB0
Minicom invocation
A simple way to start minicom is, as regular user :
minicom -ow -D /dev/ttyUSB0 [-C log_file]
But if you've followed the steps of the previous section and saved your configuration under "ttyUSB0" (file "~/.minirc.ttyUSB0"), then you can simply
minicom ttyUSB0 [-C log_file]
The "-C log_file" option is not required, but if present it will create a file called "log_file" and log all trafic to it (or append to it if the file exists)