UART

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

By default, the phyBOARD-Lyra AM62x is configured to use UART0 for a Linux console input and output. The UART0 signal is available through a micro-USB connector X49 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-AM62x UART interface, please see sections 7.5 and 11.3 in the Hardware Manual.

phyCORE-AM62x UART phyCORE-AM62x UART Backside

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

UART

UART

Connector

Character Device File

Status

UART0

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

/dev/ttyS2

Default Linux Console at X49

X42 is currently unavailable

UART1

X17 (Exp Connector)

/dev/ttyS3

Used for TI System Firmware Debugging

UART2

X36 (WiFi/BT connector)

/dev/ttyS4

Not Implemented. Allocated to BT.

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-Lyra AM62x.

    sh-phyboard-lyra-am62xx-3:~# poweroff
    
  • Connect the TTL Cable to the expansion header X17. Do not connect the cable to your host system yet.

TTL Cable and X17 Header Signals

GND

Black Connecter

Pin 6 (X17)

TXD

Orange Connecter

Pin 14 (X17)

RXD

Yellow Connecter

Pin 20 (X17)

../_images/pcm-07124_uart-x17-pinout.webp
  • Power the phyBOARD-Lyra AM62x 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-lyra-am62xx-3:~# stty -F /dev/ttyS3 115200

You can verify the current settings using:

sh-phyboard-lyra-am62xx-3:~# 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-lyra-am62xx-3:~# echo "Hello World" > /dev/ttyS3

For continuous transmission, you can use a loop:

sh-phyboard-lyra-am62xx-3:~# 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.