This is an old revision of the document!
This page introduces the usage of UART on GPIO Header.
| 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 | UART7 | 12(TX) | GPIO3_C0 | 112 | uart7 | /dev/ttyS7 |
| 14(RX) | GPIO3_C1 | 113 |
In order to use the UART, you need to enable the UART function via Device Tree Overlay.
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
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
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
Edit /boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlay.env to add uart node to fdt_overlays node if it doesn't exist.
e.g. Enable UART1, you need to add uart7 to node fdt_overlays if it doesn't exist.
fdt_overlays=uart7
After reboot, you will see the UART device node.
$ ls /dev/ttyS7
/dev/ttyS7
If you want to use normal GPIO instead of UART, you can remove the UART node in Device Tree Overlay.