This page introduces the usage of UART on 40pin-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 |
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
If you want to use normal GPIO instead of UART, you can remove the UART node in Device Tree Overlay.