-
Notifications
You must be signed in to change notification settings - Fork 11
Serial Console
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.
Location of 10-pin connector CN7 on the UP board, highlighted in blue
CN7 adapter to serial + USB2.0. Find it at UP shop
FTDI (serial to USB) cable
The UART0
interface can be found in pins 9 and 10 on 10-pin connector CN7.
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
- 10-pin wafer box connector cable (one such adapter is available from the UP shop)
- 3.3V Serial cable (for example, an FTDI cable)
- Depending on the type of serial cable: jumper wires
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 |
10 | UART0_TXD | 3-pin: pin 1 (with ▲ mark) | |
4, 8 | GND | 3-pin: pin 3 |
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 | 5 |
2 | 4 |
3 | 1 |
You can get to the BIOS menu by pressing Esc
on your client after booting the board.
By default, ubilinux allows using UART0 as an interface from installation time to installed system.
To install ubilinux through the 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.
To enable the serial console on Ubuntu, first configure GRUB:
$ sudoedit /etc/default/grub
Remove the options: quiet splash
$ sudo mkdir /etc/default/grub.d
$ sudoedit /etc/default/grub.d/serial.cfg
Note: in the below configurations, use ttyS5 (instead of ttyS4) if using UP Xtreme, use ttyS0 (instead of ttyS4) if using upboard
On that file, add the following config:
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX console=tty0 console=ttyS4,115200n8"
GRUB_TERMINAL_INPUT="console serial"
GRUB_TERMINAL_OUTPUT="gfxterm serial"
GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200"
If you are working on Ubuntu 18.04 LTS, you should use the next configuration:
GRUB_CMDLINE_LINUX="console=tty1 console=ttyS4,115200n8"
GRUB_TERMINAL_INPUT="console serial"
GRUB_TERMINAL_OUTPUT="gfxterm serial"
GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --stop=1"
To finish this step, run update-grub
.
Using ttyS4 with Upstart to get a login console.
On Ubuntu 16.04 (Xenial) and 18.04 (Bionic), if you also need a terminal on the serial TTY (which is probably the case), Upstart must be configured to start one.
Run sudo /etc/init/ttyS4.conf and add this config:
sudo systemctl enable getty@ttyS4
sudo reboot
Notes
- BIOS menus are not available through this interface by default.
- Detailed instructions will be added here. For now, see: Pinout_UART
- Serial cable (for example, an FTDI cable)
- Jumper cables for the GPIO pins may be needed
USB 3.0 device mode (Type-A to Micro-B) cable
It is also possible to use the USB3.0 OTG port as an interface for the 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.
The functionality should work out of the box from BIOS version 2.1. No bios settings modifications are needed.
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
For Linux UP2 devices, you will need to create your own disk partition and enable the g_mass_storage module:
dd if=/dev/zero of=usb-up2.img bs=1M count=400
parted -s usb-up2.img mklabel msdos
parted -s usb-up2.img mkpart primary fat32 0 100%
Optionally enable it for EFI
parted -s usb-up2.img set 1 boot on
parted -s usb-up2.img set 1 esp on
Then
dev=$(sudo losetup -f --show usb-up2.img)
sudo partprobe ${dev}
sudo mkdosfs ${dev}p1
Optionally mount and play with your new file system
mkdir -p tmpmnt
sudo mount ${dev}p1 tmpmnt
add or modify files in the partition if needed
# Unmount
sudo umount tmpmnt
Enable Mass Storage
sudo modprobe g_mass_storage file=usb-up2.img stall=0
Connect UP Squared via OTG to Windows/Linux Host The Host should now detect the UP Squared as device and mount the partition created above.
Cleanup
sudo losetup -d ${dev}
- Device mode USB3.0 cable
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
NOTE: This wiki is the main source of documentation for developers working with (or contributing to) the UP products. If this is your first time hearing about UP, we recommend starting with our main UP website, and our UP community page.