Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

products:sbc:common:applications:gpio:uart

This is an old revision of the document!


UART

Introduction

This page introduces the usage of UART on 40-Pin Header.

UART Information

UART PIN GPIO Name GPIO Number DT Overlays Node Device Node
VIM1/2 UART_AO_B 15(RX) GPIOAO_5 506 uart4 /dev/ttyS4
16(TX) GPIOAO_4 505
VIM3/3L UART_C 15(RX) GPIOH_6 433 uart3 /dev/ttyS3
16(TX) GPIOH_7 434
VIM4 UART_E 15(RX) GPIOY_7 491 uart_e /dev/ttyS4
16(TX) GPIOY_6 490
VIM1S UART_C 15(RX) GPIOD_3 457 uart_c /dev/ttyS2
16(TX) GPIOD_2 456
Edge2 UART1 2(TX) GPIO0_B5 13 uart7 /dev/ttyS7
3(RX) GPIO0_B6 14

Enable UART

In order to use the UART, you need to enable the UART function via Device Tree Overlay.

VIM1/2/3/3L/Edge1

Edit /boot/env.txt to add the uart node to overlays node if it doesn't exist.

Take VIM3 as an example to enable UART_C, you need to add uart3 node to overlays node if it doesn't exist.

overlays=pwm_ao_a pwm_f uart3

After reboot, you will see the UART device node.

$ ls /dev/ttyS3
/dev/ttyS3

VIM4

Edit /boot/dtb/amlogic/kvim4.dtb.overlay.env to add uart node to fdt_overlays node if it doesn't exist.

e.g. Enable UART_E, you need to add uart_e to node fdt_overlays if it doesn't exist.

fdt_overlays=uart_e

After reboot, you will see the UART device node.

$ ls /dev/ttyS4
/dev/ttyS4

VIM1S

Edit /boot/dtb/amlogic/kvim1s.dtb.overlay.env to add uart node to fdt_overlays node if it doesn't exist.

e.g. Enable UART_C, you need to add uart_c to node fdt_overlays if it doesn't exist.

fdt_overlays=uart_c

After reboot, you will see the UART device node.

$ ls /dev/ttyS2
/dev/ttyS2

Edge2

Edit /boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlay.env to add uart node to fdt_overlays node if it doesn't exist.

fdt_overlays=uart7

After reboot, you will see the UART device node.

$ ls /dev/xx
/dev/xx

Disable UART to Use GPIO

If you want to use normal GPIO instead of UART, you can remove the UART node in Device Tree Overlay.

Last modified: 2022/12/01 05:36 by ivan