Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:common:applications:gpio:uart

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:common:applications:gpio:uart [2023/08/13 21:25]
jacobe [Demo Source Code]
products:sbc:common:applications:gpio:uart [2023/11/07 05:09] (current)
nick [Enable UART]
Line 7: Line 7:
 ===== UART Information ===== ===== UART Information =====
  
-|            UART       ^ PIN      ^ GPIO Name  ^ GPIO Number   DT Overlays Node  ^  Device Node  ^ +|            UART       ^ PIN      ^ GPIO Name  ^  DT Overlays Node  ^  Device Node  ^ 
-^  VIM1/   UART_AO_B  |  15(RX)  |  GPIOAO_5  |  506         |  uart4              /dev/ttyS4   | +^  VIM1/   UART_AO_B  |  15(RX)  |  GPIOAO_5  |  uart4              /dev/ttyS4   | 
-| :::       | :::          16(TX)  |  GPIOAO_4  |  505         | :::                | :::           | +| :::       | :::          16(TX)  |  GPIOAO_4  | :::                | :::           | 
-^  VIM3/3L  |  UART_C      15(RX)  |  GPIOH_6   |  433         |  uart3              /dev/ttyS3   | +^  VIM3/3L  |  UART_C      15(RX)  |  GPIOH_6    uart3              /dev/ttyS3   | 
-| :::       | :::          16(TX)  |  GPIOH_7   |  434         | :::                | :::           | +| :::       | :::          16(TX)  |  GPIOH_7   | :::                | :::           | 
-^  VIM4      UART_E      15(RX)  |  GPIOY_7   |  491         |  uart_e            |  /dev/ttyS4   | +^  VIM4      UART_E      15(RX)  |  GPIOY_7    uart_e            |  /dev/ttyS4   | 
-| :::       | :::          16(TX)  |  GPIOY_6   |  490         | :::                | :::           | +| :::       | :::          16(TX)  |  GPIOY_6   | :::                | :::           | 
-^  VIM1S    |  UART_C      15(RX)  |  GPIOD_3   |  457         |  uart_c            |  /dev/ttyS2   | +^  VIM1S    |  UART_C      15(RX)  |  GPIOD_3    uart_c            |  /dev/ttyS2   | 
-| :::       | :::          16(TX)  |  GPIOD_2   |  456         | :::                | :::           |+| :::       | :::          16(TX)  |  GPIOD_2   | :::                | :::           |
 ===== Enable UART ===== ===== Enable UART =====
  
Line 28: Line 28:
 ```shell ```shell
 overlays=pwm_ao_a pwm_f uart3 overlays=pwm_ao_a pwm_f uart3
 +```
 +
 +After reboot, you will see the UART device node.
 +
 +```shell
 +$ ls /dev/ttyS3
 +/dev/ttyS3
 +```
 +
 +<tabbox VIM3 with 5.15 kernel>
 +
 +Edit ''/boot/dtb/amlogic/kvim3.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 ''uart3'' to node ''fdt_overlays'' if it doesn't exist.
 +
 +```shell
 +fdt_overlays=uart3
 +
 +```
 +
 +After reboot, you will see the UART device node.
 +
 +```shell
 +$ ls /dev/ttyS3
 +/dev/ttyS3
 +```
 +
 +<tabbox VIM3L with 5.15 kernel>
 +
 +Edit ''/boot/dtb/amlogic/kvim3l.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 ''uart3'' to node ''fdt_overlays'' if it doesn't exist.
 +
 +```shell
 +fdt_overlays=uart3
 +
 ``` ```
  
Line 87: Line 125:
  
 // set correct serial path // set correct serial path
-#define SERIAL_PORT "/dev/ttyS4"+#define SERIAL_PORT "/dev/ttyS2"
  
 int main() { int main() {
Line 150: Line 188:
 Compile test code: Compile test code:
  
-''$ gcc uart.c -o uart''+``` 
 +$ gcc uart.c -o uart 
 +```
  
 ===== Test demonstration ===== ===== Test demonstration =====
Line 160: Line 200:
 ``` ```
  
-Open ttyUSBX on PC and input hello+After connecting PIN15, PIN16 and GND to PC, open ttyUSBX and input hello
  
 ``` ```
Last modified: 2023/08/13 21:25 by jacobe