Note

This is the documentation for the latest development branch and may refer to features that are not available in released versions. If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

UART Example#

Introduction#

This example is a cross-loopback test program for UART2 and UART3, covering multiple baud rates, parity, stop bits, polling, buffers, and stress tests.

Source location: src/rtsmart/examples/peripheral/uart/test_uart.c

Example Behavior#

  • Fixed pin mapping:

    • UART2: TX=11, RX=12

    • UART3: TX=50, RX=51

  • Automatically configures multiple groups of parameters for batch testing (baud rate/parity/stop bits)

  • Performs basic send/receive, poll, recv_available, configuration read/write, and random stress tests

  • Summarizes pass/fail results for each configuration group

Key Interfaces#

  • drv_uart_inst_create() / drv_uart_inst_destroy()

  • drv_uart_set_config() / drv_uart_get_config()

  • drv_uart_write() / drv_uart_read()

  • drv_uart_poll() / drv_uart_recv_available()

  • drv_uart_configure_buffer_size()

  • drv_fpioa_set_pin_func()

Build and Run#

cd src/rtsmart/examples/peripheral/uart
make
./test_uart

This example has no command-line arguments.

Tip

For UART interface details, please refer to UART API Documentation.

Comments list
Comments
Log in