Serial console

Aus BECOM Systems Support
Version vom 22. August 2023, 20:35 Uhr von en>Peter (1 Version importiert)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

We use the Kermit program to gain access to the serial console of a device.

Linux

With common Linux distributions, you don't have to install any additional device drivers. The kernel includes drivers for CP210x UART-to-USB converters used in our products.

kermit

Install kermit

Search for a package named "ckermit" in your Linux distribution and install it.

Kermit's webpage: [1]

Connect the board

If you connect board and PC via a suitable USB cable, you should see similar lines in the output of your kernel log:

harald@WS-HP4600-35:~$ dmesg
[103187.008040] usb 7-1: new full speed USB device using uhci_hcd and address 8
[103187.172349] usb 7-1: configuration #1 chosen from 1 choice
[103187.177620] cp2101 7-1:1.0: cp2101 converter detected
[103187.288040] usb 7-1: reset full speed USB device using uhci_hcd and address 8
[103187.440427] usb 7-1: cp2101 converter now attached to ttyUSB0
harald@WS-HP4600-35:~$ 

Now you may use the device file /dev/ttyUSB0 to connect to the serial console of your board.

Start kermit

Start kermit and set its configuration.

$ kermit
C-Kermit 8.0.211, 10 Apr 2004, for Linux
 Copyright (C) 1985, 2004,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(...) C-Kermit>set line /dev/ttyUSB0
(...) C-Kermit>set speed 115200
/dev/ttyUSB0, 115200 bps
(...) C-Kermit>set carrier-watch off
(...) C-Kermit>set flow-control none
(...) C-Kermit>set prefixing all
(...) C-Kermit>set parity none
(...) C-Kermit>set stop-bits 1
(...) C-Kermit>set modem none
(...) C-Kermit>set file type bin
(...) C-Kermit>set file name lit
(...) C-Kermit>connect
Connecting to /dev/ttyUSB0, speed 115200
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------

A little helper script

The script checks the kernel log for the LAST serial device connected and opens kermit on it. A configuration file for each possible device is required.

  • serialterminal.sh (script)
#!/bin/sh
SERTERM=`dmesg|grep "converter now attached to ttyUSB"|tail -n 1|sed -e 's/.*ttyUSB/kermit/'`
kermit ~/stuff/${SERTERM}USB
  • kermit0USB (conf file)
set line /dev/ttyUSB0
set speed 115200
set carrier-watch off
set flow-control none
set prefixing all
set parity none
set stop-bits 1
set modem none
set file type bin
set file name lit
connect
  • kermit1USB (conf file)
set line /dev/ttyUSB1
set speed 115200
set carrier-watch off
set flow-control none
set prefixing all
set parity none
set stop-bits 1
set modem none
set file type bin
set file name lit
connect
  • ...

Working with the kermit prompt (e.g. serial transfers)

We show working with the kermit prompt with an example: Updating Redboot over serial terminal.

  • After kermit is connected hit the following keys
Ctrl + '\', afterwards 'c'

to get back to Kermit's prompt. To set the serial transfer protocol e.g. to XMODEM, type now

set protocol xmodem

For sending a file, type e.g.

send /tftpboot/redboot.bin

After the transfer is complete, you can re-connect to the board by typing

c

or

connect

minicom

Install minicom

>$: apt-get install minicom

Connect the board

If you connect board and PC via a suitable USB cable, you should see similar lines in the output of your kernel log:

>$ dmesg
[103187.008040] usb 7-1: new full speed USB device using uhci_hcd and address 8
[103187.172349] usb 7-1: configuration #1 chosen from 1 choice
[103187.177620] cp2101 7-1:1.0: cp2101 converter detected
[103187.288040] usb 7-1: reset full speed USB device using uhci_hcd and address 8
[103187.440427] usb 7-1: cp2101 converter now attached to ttyUSB0

Now you may use the device file /dev/ttyUSB0 to connect to the serial console of your board.

Start minicom

Start minicom and set its configuration.

>$ minicom
  1. configure minicom with pressing CTRL+A and then Z
  2. press O for cOnfigure Minicom
  3. select Serial port setup
  4. change the Serial Device to /dev/ttyUSB0
  5. set Hardware Flow Control to No
  6. press enter for leave the menue
  7. select Save setup as dfl

Now minicom is read to receive data.

Windows

Install device driver

Our products use a CP210x UART-to-USB converter from Silicon Labs. You have to install a device driver first. You can download it here: https://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx

Install terminal program

For Windows, there are several tools available you might choose from:

  • TeraTerm: Can be downloaded from https://en.sourceforge.jp/projects/ttssh2/releases/
  • PuTTY: Can be downloaded here.
  • HTerm: Can be downloaded from Der-Hammer. This tool provides a deeper insight and allows for easy debugging in case you have problems with your terminal. Possibilities include viewing received data in hex or binary format.
  • Hyperterminal: Use this in case you do not want to install another tool. This comes shipped with most Windows XP installations (Run -> hypertrm.exe) but was dumped in Windows7

General Setup

  • Use a baud rate of 115200.
  • Use 8 data bits, 1 stop bit (8N1).
  • Don't use any flow control.

PuTTY

Initial Setup

  • Download either the package or the single putty.exe file and run it.
  • Click "Serial" and enter the correct COM port (you may find that out using Start -> Run -> compmgmt.msc)
  • In "Speed", enter 115200
  • In "Window", change the number of "Lines of scrollback" to 9999 (this will allow you to scroll back further)
  • In "Serial (last option in category)" check that data bits is set to 8, Stop bits is set to 1 and parity is set to None. Set flow control to XON/XOFF or None.
  • Go back to Session, enter a name into the "Saved Sessions" field, then click Save

Further Sessions

  • If you followed the instructions above, simply double click on the Save Session and all your settings will be restored.