UART

The phyCORE-AM67x provides access to up to 9 UART interfaces that can be used for configuration and data exchange with external peripheral devices. The phyBOARD-Rigel AM67x provides access to five of these interfaces through expansion connectors.

By default, the phyBOARD-Rigel AM67x is configured to use UART0 for a Linux console input and output. The UART0 signal is available through a micro-USB connector X5 via a UART to USB bridge. PHYTEC recommends allocating UART0 for console access on custom designs. You can see all available UART interfaces in the images and tables below. To learn more information about the phyCORE-AM67x UART interface, please see sections 7.5 and 11.3 in the Hardware Manual.

phyCORE-AM67x UART

The UART channels correspond to the following connectors and system paths.

UART

UART

Connector

Character Device File

Status

UART0

X49 (Micro USB), X6 (10-pin Header)

/dev/ttyS2

Default Linux Console at X49

X6 is currently unavailable

WKUP_UART0

X37 (Exp Connector)

/dev/ttyS3

Requirements

  • USB to TTL Cable 3 pin

  • 3x M/M Jumper Wire

    Note

    The expansion header was designed for 2mm pins. It is acceptable to use 2.54mm jumper pins during the development and verification of interfaces. The only issue arises when you switch back to plugging in a 2mm male header for an expansion board you created.

Hardware Setup

  • Power off and remove the power supply from the phyBOARD-Rigel AM67x.

    sh-phyboard-rigel-am67xx-1:~# poweroff
    
  • Connect the TTL Cable to the expansion header X37. Do not connect the cable to your host system yet.

TTL Cable and X37 Header Signals

GND

Black Connecter

Pin 7 (X37)

TXD

Orange Connecter

Pin 15 (X37)

RXD

Yellow Connecter

Pin 13 (X37)

../_images/pb-08036_wkup_uart0_pinout.webp
  • Power the phyBOARD-Rigel AM67x back on.

  • Inspect dmesg output to figure out the TTL device of the UART to USB bridge cable. If you already have connected a cable to the USB debug port, your TTL device will be very likely /dev/ttyUSB3.

Setting the Baud Rate

Before using the UART interface, you need to configure the baud rate. The following command sets the baud rate to 115200 bps for the UART interface:

sh-phyboard-rigel-am67xx-1:~# stty -F /dev/ttyS3 115200

You can verify the current settings using:

sh-phyboard-rigel-am67xx-1:~# stty -F /dev/ttyS3 -a

Sending Messages

To send data through the UART interface, you can use the echo command to write to the device:

sh-phyboard-rigel-am67xx-1:~# echo "Hello World" > /dev/ttyS3

For continuous transmission, you can use a loop:

sh-phyboard-rigel-am67xx-1:~# while true; do echo "Test Message" > /dev/ttyS3; sleep 1; done

Receiving Messages

To read incoming data from the UART interface, use the cat command:

sh-host:~$ cat /dev/ttyS3

This will display any incoming messages in real-time. Press Ctrl+C to stop reading.

For debugging purposes, you can also use minicom. Install it using:

sh-host:~$ sudo apt update
sh-host:~$ sudo apt install minicom

Start minicom:

sh-host:~$ minicom -D /dev/ttyS3 -b 115200

Booting via UART

See chapter UART on how to boot from UART.