Minicom-tutorial

Minicom tutorial


Project maintained by Derrekito Hosted on GitHub Pages — Theme by mattgraham

Introduction

Minicom is a serial communication program, which we can use with the Dragon12 board. This program is used from console to interface with D-Bug12 and send the text file to the board.

Installation

Minicom can be downloaded from Freecode or the following terminal command can be used to download and install the program:

sudo apt-get install minicom

CAUTION: I've seen some potentially fake sites posing as the 'official' Minicom website with untrusted security certificates. It would be best to use your distributions' repository if possible.

Configuration

Now that Minicom is installed, the program must be configured properly to interface with the board. To start the configuration process type in the following command and switch:

minicom -s

Now the following menu should be displayed:

+-----[configuration]------+
| 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        |
+--------------------------+

Next, select “Serial port setup” and press to continue. You should be greeted with the following screen:

+-----------------------------------------------------------------------+
| A -    Serial Device      : /dev/ttyUSB0                              |
| B - Lockfile Location     : /var/lock                                 |
| C -   Callin Program      :                                           |
| D -  Callout Program      :                                           |
| E -    Bps/Par/Bits       : 9600 8N1                                  |
| F - Hardware Flow Control : No                                        |
| G - Software Flow Control : Yes                                       |
|                                                                       |
|    Change which setting?                                              |
+-----------------------------------------------------------------------+
| Screen and keyboard      |
| Save setup as dfl        |
| Save setup as..          |
| Exit                     |
| Exit from Minicom        |
+--------------------------+

To edit the selected Serial Device:

To edit Flow Control:

To edit the baud rate and related settings press the 'E' key.You should be presented with the following:

+-----------------+---------[Comm Parameters]----------+----------------+ 
| A -    Serial De|                                    |                | 
| B - Lockfile Loc|     Current:  9600 8N1             |                | 
| C -   Callin Pro| Speed            Parity      Data  |                | 
| D -  Callout Pro| A:         L: None     S: 5  |                | 
| E -    Bps/Par/B| B:         M: Even     T: 6  |                | 
| F - Hardware Flo| C:   9600        N: Odd      U: 7  |                | 
| G - Software Flo| D:  38400        O: Mark     V: 8  |                | 
|                 | E: 115200        P: Space          |                | 
|    Change which |                                    |                | 
+-----------------| Stopbits                           |----------------+ 
        | Screen a| W: 1             Q: 8-N-1          | 
        | Save set| X: 2             R: 7-E-1          | 
        | Save set|                                    | 
        | Exit    |                                    | 
        | Exit fro| Choice, or  to exit?        | 
        +---------+------------------------------------+ 

After the settings are set up correctly, press Enter to continue. When the configuration is complete you should be presented with the original screen. Selected Save setup as dfl (save setup as default) then select Exit from Minicom.

Using Minicom

Type minicom in a terminal to run Minicom. The following sequence should appear:

+-----------------------+
|                       |
|  Initializing Modem   |
|                       |
+-----------------------+

followed by something similar to the following:

Welcome to minicom 2.3                                      
                                                    
OPTIONS: I18n                                           
Compiled on Oct 24 2008, 06:47:12.                              
Port /dev/ttyUSB0                                       
                                                    
                 Press CTRL-A Z for help on special keys 

Minicom is now 'listening' to the serial port (/dev/ttyUSB0 is the serial device is in this example). Once the Dragon12 is connected to the serial port, press the “reset” button on the board. Note that it is unimportant if the device was connected before or after configuration. You should receive the following D-Bug12 prompt:

Welcome to minicom 2.3                                      
                                                    
OPTIONS: I18n                                           
Compiled on Oct 24 2008, 06:47:12.                              
Port /dev/ttyUSB0                                       
                                                    
                 Press CTRL-A Z for help on special keys                
                                                                        
                                                                        
                                                                        
D-Bug12 4.0.0b32                                                        
Copyright 1996 - 2005 Freescale Semiconductor                       
For Commands type "Help"                                    
                                                    
>   

Transferring Text (ASCII) Files

To transfer a text file to the Dragon12 board, type in load in D-Bug12. Then press Ctrl+A and press the S key for “upload”. Thus far you should see:

Welcome to minicom 2.3                                      
                                                    
OPTIONS: I18n                                           
Compiled on Oct 24 2008, 06:47:12.                              
Port /dev/ttyUSB0                                       
                             +-[Upload]--+                      
                 Press CTRL-A| zmodem    |n special keys                
                             | ymodem    |                              
                             | xmodem    |                              
                             | kermit    |                              
D-Bug12 4.0.0b32             | ascii     |                              
Copyright 1996 - 2005 Freesca+-----------+tor                       
For Commands type "Help"                                    
                                                    
>load                                               

                                                
 CTRL-A Z for help |  9600 8N1 | NOR | Minicom 2.3    | VT102 | Offline 

Select 'ascii' and press Enter. Minicom will now display a text based folder navigation, for example:

We+------------------------[Select a file for upload]-------------------------+
  |Directory: /home/user-name                                                 |
OP| [..]                                                                      |
Co| [.folder]                                                                 |
Po| [.amarok-nightly]                                                         |
  | [.cache]                                                                  |
  | [.compiz]                                                                 |
  | [.config]                                                                 |
D-| [.dbus]                                                                   |
Co| [.dvdcss]                                                                 |
Fo| [.dvdrip]                                                                 |
  | [.eclipse]                                                                |
>l| [.emerald]                                                                |
  | [.fontconfig]                                                             |
  |              ( Escape to exit, Space to tag )                             |
  +---------------------------------------------------------------------------+
                                                                                
                 [Goto]  [Prev]  [Show]   [Tag]  [Untag] [Okay]                 
                                                                                
 CTRL-A Z for help |  9600 8N1 | NOR | Minicom 2.3    | VT102 |      Offline    

Note: Directories preceded with a period are “hidden” folders and should appear before all non-hidden folders.

Navigation Keys:

Use the Up and Down arrows to select a file or directory Press the space-bar key twice to enter a directory or to select a file Select the “[..]” located at the top to enter a higher directory or previous directory. After selecting a file (.s1 record file) for upload press Enter to transfer. After a successful transfer has been completed, the following should be displayed in terminal:

Welcome to minicom 2.3                                                         
                                                                               
OPTIONS: I18n                                                                  
Compiled on Oct 24 2008, 06:47:12.                                             
Port /dev/ttyUSB0                                                              
         +------------[ascii upload - Press CTRL-C to quit]------------+       
         |ASCII upload of "labx_hcs12.abs.s1"                          |       
         |Line delay: 2 ms, character delay 1 ms                       |       
         |                                                             |       
         |0.7 Kbytes transferred at 754 CPS... Done.                   |       
D-Bug12 4|                                                             |       
Copyright| READY: press any key to continue...                         |       
For Comma|                                                             |       
         +-------------------------------------------------------------+       
>load                                                                          
                                                                               
>                                                                              
>load                                                                          
                                                                               
                                                                               
                                                                               
                                                                               
 CTRL-A Z for help |  9600 8N1 | NOR | Minicom 2.3    | VT102 |      Offline   

After following the prompted instruction to continue, use the appropriate D-Bug12 instruction to run the transferred .s1 record.

Uncommon Issues

If file transfer fails or hangs, some additional tweaks in Minicom may be needed. Sometimes the serial devices do not talk to each other nicely resulting in one being overloaded by the other. The final remedy may require some trial and error on your part. To start off type in:

minicom -s

Select “File transfer protocols” and now the following should be displayed:

+------------------------------------------------------------------------------+
|     Name             Program                 Name U/D FullScr IO-Red. Multi  |
| A  zmodem     /usr/bin/sz -vv -b              Y    U    N       Y       Y    |
| B  ymodem     /usr/bin/sb -vv                 Y    U    N       Y       Y    |
| C  xmodem     /usr/bin/sx -vv                 Y    U    N       Y       N    |
| D  zmodem     /usr/bin/rz -vv -b -E           N    D    N       Y       Y    |
| E  ymodem     /usr/bin/rb -vv                 N    D    N       Y       Y    |
| F  xmodem     /usr/bin/rx -vv                 Y    D    N       Y       N    |
| G  kermit     /usr/bin/kermit -i -l %l -s     Y    U    Y       N       N    |
| H  kermit     /usr/bin/kermit -i -l %l -r     N    D    Y       N       N    |
| I  ascii      /usr/bin/ascii-xfr -dsv -c 1 -l Y    U    N       Y       N    |
| J    -                                                                       |
| K    -                                                                       |
| L    -                                                                       |
| M  Zmodem download string activates... D                                     |
| N  Use filename selection window...... Yes                                   |
| O  Prompt for download directory...... No                                    |
|                                                                              |
|   Change which setting? (SPACE to delete)                                    |
+------------------------------------------------------------------------------+

At this point we will only be interested in the “ascii” section which uses the program “ascii-xfr”. To edit this section press the “I” key which corresponds to the row ASCII is in. Now, a courser should appear next to ASCII, however we do not want to edit the “name” column, so press Enter to continue onto the “Program” column. Now here is the tricky part, by changing some switches for ascii-xfr we can have our transfer create a delay after every character or line is transferred, among other things we will not worry about here. Below contains a list of switches for Ascii-xfr:

Usage: ascii-xfr -s|-r [-dvn] [-l linedelay] [-c character delay] filename  
       -s:  send                                            
       -r:  receive                                         
       -e:  send the End Of File character (default is not to)          
       -d:  set End Of File character to Control-D (instead of Control-Z)   
       -v:  verbose (statistics on stderr output)                   
       -n:  do not translate CRLF  LF                       
       Delays are in milliseconds.      

The usage list can be generated by typing ascii-xfr in a terminal session. In the above example there is a character delay of one millisecond (i.e. -c 1) and a line delay of one millisecond (i.e. -l 1). After the desired settings are inputted, press enter to move onto the next column, and repeat until the previous menu is displayed. Remember to select Save setup as dfl prior to exiting and using the new settings. Play with these values to suit your situation. If this does not remedy your problem, it may be something entirely unrelated. As a reminder you can always refer back to the Serial in Linux Tutorial.

Misc. Resources

For further information on minicom please refer to its manual from Linux.die.net or by typing man minicom in a terminal. If you would like to try out the C compiler for the HCS12 in Linux refer to GCC-HCS12. Are you still having difficulties installing or configuring minicom in Ubuntu or Debian? Try referring to the Debian MINICOM Install HOWTO.