Serial console

From UpWiki
Jump to: navigation, search

The UP board can be controlled without a monitor or input peripherals (headless setup), but through a serial connection to a host machine. Various hardware ports can be enabled for this serial console. The following sections document the procedure for each of them.

10-pin connector CN7 (UART0)

Location of 10-pin connector CN7 on the UP board, highlighted in blue
CN7 adapter to serial + USB2.0 (UP shop)
FTDI (serial to USB) cable

The UART0 interface can be found in pins 9 and 10 on 10-pin connector CN7 (refer to the connectors description document).

It is enabled as a debug terminal as early as the BIOS stage.

To use it, connect your serial cable to the UP and configure the serial client (such as minicom or picocom, included with ubilinux, or putty, for Windows) on your host with these parameters:

  • Speed: 115200 bps
  • Data bits: 8
  • Parity bit: no
  • Stop bits: 1
  • Hardware flow control: no

Tips: The port name is Communications Port (COM1) in Windows 10

Required parts

  • 10-pin wafer box connector cable (one such adapter is available from the UP shop)
  • 3.3V Serial cable (for example, a FTDI cable)
  • Depending on the type of serial cable: jumper wires

Using the provided adapter

The adapter from the UP shop brings three connectors out of CN7:

CN7 pin Description Group Adapter connector
1 USB_VCC USB 1 USB 2.0 plug
2 USB_HSIC_P3_D-
3 USB_HSIC_P3_D+
4 GND
5 USB_VCC USB 1 USB 2.0 plug
6 USB_HSIC_P3_D-
7 USB_HSIC_P3_D+
8 GND
9 UART0_RXD UART0 3-pin: pin 2 red
10 UART0_TXD 3-pin: pin 1 white (with ▲ mark)
4, 8 GND 3-pin: pin 3 black

For serial console usage, the 3-pin connector can then be brought to some other kind of serial cable (for instance, using jumper wires).

For a FTDI cable, for example, the mapping should be:

3-pin FTDI
1 white yellow 5
2 red orange 4
3 black black 1

BIOS menu access

You can get to the BIOS menu by pressing Esc on your client after booting the board.

ubilinux

By default, ubilinux allows using UART0 as an interface from installation time to installed system.

To install ubilinux through serial console:

  • Configure the terminal as shown above before booting the installation media.
  • On the GRUB menu that appears, pick the Install (serial console) entry.

After installation, a TTY is always available on UART0, no matter how you installed the system in the first place.

Ubuntu

To enable the serial console on Ubuntu, first configure GRUB:

$ sudo mkdir /etc/default/grub.d
$ sudoedit /etc/default/grub.d/serial.cfg

On that file, add the following config:

GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX console=tty0 console=ttyS0,115200n8"
GRUB_TERMINAL_INPUT="console serial"
GRUB_TERMINAL_OUTPUT="gfxterm serial"
GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200"

To finish this step, run update-grub.

ttyS0

On Ubuntu 14.04 (Trusty), if you also need a terminal on the serial TTY (which is probably the case), Upstart must be configured to start one. Run sudoedit /etc/init/ttyS0.conf and add this config:

# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty -L 115200 ttyS0 vt102

Finally, enable the terminal:

sudo start ttyS0

40-pin GPIO header (UART1)

Notes

  • BIOS menus are not available through this interface by default.
  • Detailed instructions will be added here. For now, see: Pinout#UART

Required parts

  • Serial cable (for example, a FTDI cable)
  • Jumper cables for the GPIO pins may be needed

USB3.0 OTG port in device mode

USB 3.0 device mode (Type-A to Micro-B) cable

UP

It is also possible to use the USB3.0 OTG port as an interface for serial console. To enable this feature, ensure that these BIOS settings are in place:

Chipset > South Bridge > Default DRD Config: DeviceMode
Chipset > South Bridge > USB OTG Support: PCI mode

This switches the OTG port role from host mode to device mode.

UP Squared

The functionality should work out of the box from BIOS version 2.1. No bios settings modification are needed.

g-serial device

If you want to use your UP2 board as a serial device, first you must load the g-serial module:

sudo modprobe g_serial 

You could check a new device was created:

ls /dev/ttyG*

Then, just enable the device and check the board is ready:

sudo systemctl enable getty@ttyGS0
sudo systemctl start getty@ttyGS0
dmesg | tail

Storage device

For Linux UP2 devices, you will need to create your own disk partition and enable the g_mass_storage module:

First, create a device image for your partition, in this case 400MB memory space:

sudo dd if=/dev/zero of=/usb-up2.img bs=1M count=400

Then, you must format your device as FAT32:

sudo mkdosfs -F 32 /usb-up2.img

Finally, the g_mass_storage must be loaded for your new device:

sudo modprobe g_mass_storage file=/usb-up2.img stall=0

For Linux hosts, If you connect your USB OTG port, you should see your new device automatically.

For Windows hosts, you will need to reformat your UP2 storage device, using diskpart tool, for example:

Run CMD in Windows as an Administrator and execute the diskpart tool:

diskpart
list disk

Note the number assigned to your disk and replace X in the next command with that number

select disk X
clean all
create partition primary
active
format fs=fat32 label="UP2-USB"
assign
exit

Your UP2 storage device will be lauched automatically if the format disk was done successfully.

Required parts

  • Device mode USB3.0 cable

ubilinux

Once the BIOS is correctly configured, you can follow these steps to test USB3.0 serial console:

  • Plug the device end of the cable to the UP board and boot the board.
  • Execute
 $ sudo modprobe g_serial
 $ sudo systemctl start getty@ttyGS0
  • Plug the host end of the cable to your host and look for a new TTY device entry in /dev (for example, /dev/ttyACM0).

You should now be able to access a TTY from your host device:

$ sudo picocom /dev/ttyACM0