UART

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

By default, the phyBOARD-Lynx AM62Px 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-AM62Px UART interface, please see sections 7.5 in the Hardware Manual.

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

UART

UART

Connector

Character Device File

Status

UART0

X5 (Micro USB)

/dev/ttyS2

Default Linux Console

UART1

X7 (RS232/RS485 2x5 Header)

/dev/ttyS3

Requirements

Hardware Setup

  • Power off and remove the power supply from the phyBOARD-Lynx AM62Px.

    phyboard-lynx-am62pxx-1:~# poweroff
    
  • Connect the DB9 Male 2x5 to RS232 Female Cable (included in the development kit) to the X7 connector (red line indicates Pin 1).

  • Connect a USB to RS-232 serial adapter to the female end of the DB9 cable. Do not connect the cable to your host system yet.

X7 Pin Mapping

Signal

Pin

TXD

5

RXD

3

GND

9

  • Power the phyBOARD-Lynx AM62Px 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:

phyboard-lynx-am62pxx-1:~# stty -F /dev/ttyS3 115200

You can verify the current settings using:

phyboard-lynx-am62pxx-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:

phyboard-lynx-am62pxx-1:~# echo "Hello World" > /dev/ttyS3

For continuous transmission, you can use a loop:

phyboard-lynx-am62pxx-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.