Search by Tags

Configuring Serial Port Debug Console (Linux/U-Boot)

 

Article updated at 31 Jul 2020
Compare with Revision




Subscribe for this article updates

Introduction

On our Toradex modules, the U-Boot boot loader and the Linux kernel use UART_A as serial debug console. The serial console is the primary and most reliable interface to the boot loader and Linux kernel. This article has two main sections:

  • How to use (attach to and communicate via) the debug UART, a.k.a serial console.
  • How to disable the debug UART.

Warning: We do not recommend to use UART_A for any other purpose. Disabling it prevents analyzing errors (e.g. crash of the user interface) or analyzing if the system is in a non-bootable state.

Warning: This article shows how to disable the debug messages on the serial console only. In case you would like to disable debug messages or the virtual console on graphical output (DVI-I, HDMI, LVDS, or VGA) please refer to the Framebuffer (Linux) article.

Use the Debug UART (Serial Console)

You can easily access your Toradex SoM via the serial, in this section, you will find out how to set up the hardware on each of our boards as well as know the parameters.

Console Serial Parameters

Connecting to the board requires some parameters, here they are:

  • port: it depends on your hardware, often it is /dev/ttyUSBx on Linux, or COMx on Windows, being x a number to be determined in the next section.
  • Baud Rate: 115200
  • Parity: none
  • Bits: 8
  • Stopbits: 1
  • Flow control: none

Windows - Find the Number of the COM Port

Go to Control Panel and find the Device Manager. Your COMx port will be listed under Ports.


  • Windows device manager

    Windows device manager

Linux - Find the Number of the ttyUSB Port

Unplug the device from your computer and run:

$ ls /dev/ttyUSB*

Plug the device and run the same command again, your device will be listed:

$ ls /dev/ttyUSB*

Note: Verdin has an integrated serial-to-USB converter that lists 4 ttyUSB* devices. The highest index is the serial console. Example, if you see /dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyUSB2 and /dev/ttyUSB3 listed, then /dev/ttyUSB3 is the serial console.

Linux - Add User to Dialout Group

To avoid being requested to use sudo all the time, you can add your user to the dialout group. You can find your user name with the whoami command. To do it in a single-line, in your development PC, run:

$ sudo usermod -a -G dialout $(whoami)

To apply the changes, either reboot or log-off, and log-in.

Hardware

Select your carrier board from the tabs below:

Connect a USB micro-B to USB Type-A cable to X66.


  • Serial Setup for Verdin Development Board

    Serial Setup for Verdin Development Board

Note: Notice that the micro USB connector (X66) has an integrated USB-serial converter that provides access to the computer on module debug serial port.

Connect a USB C to USB Type-A cable to DEBUG.


  • Serial setup for Dahlia Carrier Board

    Serial setup for Dahlia Carrier Board

Note: Notice that the USB C connector (DEBUG) has an integrated USB-serial converter that provides access to the computer on module debug serial port.

Connect the DB9 to the IDC adapter cable to the X22 connector on the Ixora:


  • IDC header connected to the Ixora Carrier Board

    IDC header connected to the Ixora Carrier Board

Note: The adapter is included in the Toradex Cable Kit, the standard we used is normally called DTK or Intel standard.

Connect your host machine to the adapter cable using a serial cable or Serial to USB converter:


  • Serial setup for Ixora Carrier Board

    Serial setup for Ixora Carrier Board

Use UART-1 via the USB Type-B connector X29:


  • Using UART via USB X27

    Using UART via USB X27

Make sure that the jumpers JP10 and JP12 are set to USB mode as shown in the image below:


  • Jumpers JP10 and JP12 - USB mode

    Jumpers JP10 and JP12 - USB mode

Connect the DB9 to the IDC adapter cable to the X13 connector on the Iris:


  • IDC header connected to the Iris Carrier Board

    IDC header connected to the Iris Carrier Board

Note: The adapter is included in the Toradex Cable Kit, the standard we used is normally called DTK or Intel standard.

Connect your host machine to the adapter cable using a serial cable or Serial to USB converter:


  • Serial setup for the Iris Carrier Board

    Serial setup for the Iris Carrier Board

Connect a USB micro-B to USB Type-A cable to X4.


  • Serial setup for Aster Carrier Board

    Serial setup for Aster Carrier Board

Note: Notice that the micro USB connector (X4) can be employed as a means to power the system and also has an integrated USB-serial converter that provides access to the computer on module debug serial port.

Use UART A via the USB Type-B connector X27:


  • Using UART via USB X27

    Using UART via USB X27

Make sure that the jumpers JP19 and JP17 are set to USB mode as shown in the image below:


  • Jumpers JP17 and JP19 - USB mode

    Jumpers JP17 and JP19 - USB mode

Setting up a terminal

In case you want to know how to set up a terminal emulator to start accessing your module, please refer to Serial Terminal Emulator article.

Find my Board IP

To get your board IP address, follow the instructions from the section Find your IP and MAC address on the article Basic Linux Commands.

Examples why you need your board IP:

  • You are connecting to the debug UART because you were unable to login via SSH due to missing the board IP.
  • The DHCP tables from your LAN router were refreshed and now the board has a different IP address.
  • You want to access a service hosted on the board, for instance, a web-server or a remote graphical user interface.

Disable the Debug UART (Serial Console)

Here are sections for disabling the console on U-Boot and the Linux kernel.

Disable U-Boot Console Output on UART_A

Custom U-Boot

The following config options need to be defined in the respective board header file to quiet messages on the serial console:

CONFIG_SILENT_CONSOLE
CONFIG_SYS_DEVICE_NULLDEV
CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC

For enabling silent console append the environment variable 'silent=1' to CONFIG_EXTRA_ENV_SETTINGS in respective board header file.
Please refer to the following article concerning setup/compilation of the same:

Build U-Boot and Linux Kernel from Source Code

Note: Enabling silent console just bypasses the console messages to null. Depending on the module type and U-Boot version you might still be able to interrupt U-Boot by pressing the specified key which allows you to control the U-Boot at run time.

Disable most Log Messages from Linux Kernel

To get fewer debug messages from the Linux Kernel one can use the "quiet" Kernel parameter.

# setenv defargs '${defargs} quiet'
# saveenv

Disable Linux Kernel Console Output on UART_A

Disable the console from kernel completely by setting the console= option on the kernel command line. This can be achieved by doing it from U-Boot prompt or using U-Boot-envtools under Linux to modify the env variables:

# setenv console null
# saveenv

or
using U-Boot-envtools under Linux:

# fw_setenv console null
# reboot

After this, no kernel messages/serial login are available on debug serial port anymore. To re-enable the debug serial port console one needs to reset the 'console' variable back to respective serial tty(e.g: ttyLP0 on Colirbi VFxx).

# setenv console ttyLP0
# saveenv

or
using U-Boot-envtools under Linux:

# fw_setenv console ttyLP0
# reboot

Configure Baudrate for Serial Getty on UART_A

While during boot the serial baudrate is taken from the U-Boot environment variable

baudrate

the later login shell baudrate needs to be configured separately if required in resp.

/etc/systemd/system/getty.target.wants/serial-getty@<serial device>.service

file:

i.MX 6/7:
/etc/systemd/system/getty.target.wants/serial-getty@ttymxc0.service
Tegras:
/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service

Disable Serial Getty on UART_A

Newer BSPs always start an explicit serial getty on UART_A which can be disabled as follows:

# systemctl disable serial-getty@ttyS0.service

An interesting blog post from Mr. Poettering about the thematic can be found here.

Using the serial console with Toradex Computer Modules