Skip to content

arch/arm/rtl8721f: add UART character driver support - #19588

Open
dcgong2917 wants to merge 1 commit into
apache:masterfrom
dcgong2917:rtl8721f-uart-pr
Open

arch/arm/rtl8721f: add UART character driver support#19588
dcgong2917 wants to merge 1 commit into
apache:masterfrom
dcgong2917:rtl8721f-uart-pr

Conversation

@dcgong2917

Copy link
Copy Markdown
Contributor

Summary

Expose the RTL8721F general-purpose UARTs through the shared Ameba serial
driver in arch/arm/src/common/ameba. Only chip-specific glue is added:

  • arch/arm/src/rtl8721f/ameba_uart_chip.h — rtl8721F register bases, IRQs,
    clock masks and UART TX/RX pin-mux function codes consumed by the common
    driver.
  • Build wiring in Make.defs, ameba_board.mk and CMakeLists.txt (both
    make and cmake paths), guarded by CONFIG_AMEBA_UART, adding the common
    ameba_uart.c and the fwlib RAM register-layer source.
  • A board port table (rtl8721f_uart.c) registering UART0 at /dev/ttyS1
    on PA24/PA25. The LOG-UART keeps the console and /dev/ttyS0.
  • A new uart board config enabling the driver with the serialrx /
    serialblaster examples and runtime TERMIOS support, plus docs.

The common serial layer is reused unchanged. This mirrors the GPIO port
(#19582) pattern for this IC.

Impact

  • New feature for RTL8721F only; gated by CONFIG_AMEBA_UART (default n).
  • No change to the shared common/ameba sources or to other boards/ICs.
  • UART3 is shared with Bluetooth and is intentionally not exposed.

Testing

Built and flashed on the RTL8721F EVB (make and cmake both build a clean
nuttx.bin; checkpatch and nxstyle pass; defconfig is canonical).

Hardware-verified via a PA24/PA25 loopback:

  • serialrx/serialblaster single-message echo (hello_uart) — pass.
  • 2600-byte throughput, zero loss — pass.
  • TERMIOS reconfiguration: CS7 data-bit truncation (0xa5 -> 0x25), parity
    and stop-bit ioctl round-trip, and 9600-baud reprogramming — all pass.

Expose the RTL8721F general-purpose UARTs through the shared Ameba serial
driver in arch/arm/src/common/ameba.  Only the chip-specific glue is added:
a new ameba_uart_chip.h supplying the green2 register bases, IRQs, clock
masks and UART TX/RX pin-mux function codes, plus the build wiring and a
board port table registering UART0 at /dev/ttyS1.  The common serial layer
is reused unchanged.

A new "uart" board config enables the driver with the serialrx and
serialblaster examples and runtime TERMIOS support.

Verified on RTL8721F EVB hardware with a PA24/PA25 loopback: single-message
echo, 2600-byte serialrx/serialblaster throughput with no loss, and TERMIOS
reconfiguration (CS7 data-bit truncation, parity and stop-bit ioctl
round-trip, and 9600 baud reprogramming) all pass.

Signed-off-by: dechao_gong <dechao_gong@realsil.com.cn>
Assisted-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Arch: arm Issues related to ARM (32-bit) architecture Size: M The size of the change in this PR is medium Board: arm labels Jul 31, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

``arch/arm/src/common/ameba/ameba_gpio.h`` (port A/B, pin 0-31), matching the
Ameba SDK ``PinName`` layout.

uart

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcgong2917 please add the board picture that was missing in the previous PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Area: Documentation Improvements or additions to documentation Board: arm Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants