UART REFERENCE
1. Overview¶
This article mainly introduces how to configure uart and how to use it at the user level.
2. Kernel Config¶
Configure the corresponding pad to uart mode in Kernel padmux dts
.
Fig 2-1 PAD Config
After config, recompile the kernel and replace the kernel image to the project to burn
3. Use Uart¶
3.1. Confirm /dev/ttySx Used By Uart Pin¶
Check the dts to confirm which serialx the uart corresponds to.
Serialx corresponds to /dev/ttySx.
Fig 3-1 Check serialx
3.2. Use Application Layer¶
Refer to the following link for application layer usage:
https://blog.csdn.net/aaron_111/article/details/84876508
4. Uart Driver Architecture and debug¶
Figure 4-1 Uart driver framework
It can be seen from the above figure that the driver is mainly connected to the uart controller and the corresponding pad in series.
The following registers can be used to determine whether the corresponding uart controller and padmux are connected in series:
-
Uart controller
0x101e 0x53(16bit)
Figure 4-2
Figure 4-3
-
Padmux
0x101e 0x03(16bit)
Figure 4-4
The corresponding relationship of the public version demo four-way uart is as follows:
<PAD_FUART_RX PINMUX_FOR_FUART_MODE_2 MDRV_PUSE_FUART_RX >, <PAD_FUART_TX PINMUX_FOR_FUART_MODE_2 MDRV_PUSE_FUART_TX >, <PAD_UART1_RX PINMUX_FOR_UART1_MODE_1 MDRV_PUSE_UART1_RX >, <PAD_UART1_TX PINMUX_FOR_UART1_MODE_1 MDRV_PUSE_UART1_TX >, <PAD_GPIO8 PINMUX_FOR_UART2_MODE_2 MDRV_PUSE_UART2_RX >, <PAD_GPIO9 PINMUX_FOR_UART2_MODE_2 MDRV_PUSE_UART2_TX >,
PM_UART is the terminal serial port, which is configured by default.
< PAD_PM_UART_RX PINMUX_FOR_UART0_MODE_0 MDRV_PUSE_UART0_RX >, < PAD_PM_UART_TX PINMUX_FOR_UART0_MODE_0 MDRV_PUSE_UART0_TX >,