The “cu” command

From a given occasion a short introduction to the cu command.

The cu command is used to call up another system and act as a dial in terminal. It can also do simple file transfers with no error checking.

minicom is another popular serial communication program. Unfortunately, many users have reported problems using it with U-Boot and Linux, especially when trying to use it for serial image download. It’s use is therefore discouraged.

http://www.denx.de/wiki/view/DULG/SystemSetup#Section_4.4.

Other alternatives are screen, picocom and kermit.

Install the “cu” command

[chris@thinkpad ~]$ sudo yum install uucp

Configure the “cu” command

[chris@thinkpad ~]$ sudo vim /etc/uucp/sys
[chris@thinkpad ~]$ cat /etc/uucp/sys
# This is an example of a sys file. This file is syntax compatible
# with Taylor UUCP (not HDB, not anything else). Please check uucp
# documentation if you are not sure how to configure Taylor UUCP config files.
# Edit the file as appropriate for your system, there are sample files
# in /usr/share/doc/uucp-1.07/samples.

# Everything after a '#' character is a comment.


# /dev/ttyUSB0 at 115200 bps:
#
system          USB0@115200
port            serial0_115200
time            any

[chris@thinkpad ~]$ sudo vim /etc/uucp/port
[chris@thinkpad ~]$ cat /etc/uucp/port
# This is an example of a port file. This file is syntax compatible
# with Taylor UUCP (not HDB, not anything else). Please check uucp
# documentation if you are not sure how to configure Taylor UUCP config files.
# Edit the file as appropriate for your system, there are sample files
# in /usr/share/doc/uucp-1.07/samples.

# Everything after a '#' character is a comment.

#
# /dev/ttyUSB0 at 115200 bps:
#

port            serial0_115200
type            direct
device          /dev/ttyUSB0
speed           115200
hardflow        false

[chris@thinkpad ~]$

Connect to the serial line

[chris@thinkpad ~]$ cu USB0@115200
Connected.
HTLLCLC

U-Boot 2013.01-00033-g852e10a-dirty (Feb 07 2013 - 16:21:11)

CPU:   Freescale i.MX23 rev1.4 at 454 MHz
BOOT:  SSP SD/MMC #0
DRAM:  64 MiB
MMC:   MXS MMC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0
mmc0 is current device
462 bytes read in 0 ms
Loaded environment from uEnv.txt
Importing environment from mmc ...
3684752 bytes read in 0 ms
8450 bytes read in 0 ms
Booting from mmc ...
## Booting kernel from Legacy Image at 42000000 ...
  Image Name:   Linux-3.7.6-dirty
  Image Type:   ARM Linux Kernel Image (uncompressed)
  Data Size:    3684688 Bytes = 3.5 MiB
  Load Address: 40008000
  Entry Point:  40008000
  Verifying Checksum ... OK
## Flattened Device Tree blob at 41000000
  Booting using the fdt blob at 0x41000000
  Loading Kernel Image ... OK
OK
  Using Device Tree in place at 41000000, end 41005101

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0
[    0.000000] Linux version 3.7.6-dirty (chris@thinkpad) (gcc version 4.7.3 20121207 (release) [ARM/embedded-4_7-branch revision 194305] (GNU Tools for ARM Embedded Processors) ) #1 Tue Feb 5 11:02:16 CET 2013
...

Copy a file over the serial line

Create a test file on your Linux PC:

[chris@thinkpad ~]$ echo "This is a test file" >> testfile.txt
[chris@thinkpad ~]$ cat testfile.txt
This is a test file
[chris@thinkpad ~]$

To copy a file from the local system to the remote system, enter:

[root@olinuxino ~]# ~p testfile.txt
Remote file name [testfile.txt]:
1
[file transfer complete]
[connected]
[root@olinuxino ~]# ls
fixterm  housenka.sh  led_blink  testfile.txt  wconfig
[root@olinuxino ~]# cat testfile.txt
This is a test file
[root@olinuxino ~]#

To copy a file from the remote system to the local system, enter:

[root@olinuxino ~]# ~t /var/log/messages.log
Local file name [messages.log]: olinuxino_messages.log
[file transfer complete]
[connected]
[root@olinuxino ~]#
[chris@thinkpad ~]$ du -h olinuxino_messages.log
512K    olinuxino_messages.log
[chris@thinkpad ~]$ tail olinuxino_messages.log
Dec 31 18:34:32 olinuxino kernel: [ 2065.160000] wlan0: Selected IBSS BSSID ee:73:d9:ca:2e:92 based on configured SSID
Dec 31 18:34:32 olinuxino dhcpcd[141]: version 5.6.4 starting
Dec 31 18:34:32 olinuxino dhcpcd[141]: all: configured as a router, not a host
Dec 31 18:34:33 olinuxino dhcpcd[141]: wlan0: broadcasting for a lease
Dec 31 18:34:36 olinuxino dhcpcd[141]: wlan0: offered 10.42.0.48 from 10.42.0.1
Dec 31 18:34:36 olinuxino dhcpcd[141]: wlan0: acknowledged 10.42.0.48 from 10.42.0.1
Dec 31 18:34:36 olinuxino dhcpcd[141]: wlan0: checking for 10.42.0.48
Dec 31 18:34:41 olinuxino dhcpcd[141]: wlan0: leased 10.42.0.48 for 3600 seconds
Dec 31 18:34:52 olinuxino dhcpcd[141]: forked to background, child pid 169
Dec 31 18:54:53 olinuxino -- MARK --
[chris@thinkpad ~]$

Disconnect

[root@olinuxino ~]# ~.

Disconnected.
[chris@thinkpad ~]$