Skip to content

Commit

Permalink
samv7/serial: allow TX/RX DMA for UART drivers
Browse files Browse the repository at this point in the history
So far only USART drivers could use TX/RX DMA. This commit adds the
support for UART drivers as well (with the exception of serial console).

UART peripheral does not have timeout interrupt, so external polling
is required to flush the RX data from DMA buffers even if the buffer
is not yet full. The board layer can do this by calling
sam_serial_dma_poll function.

Signed-off-by: Michal Lenc <[email protected]>
  • Loading branch information
michallenc committed Jan 29, 2025
1 parent abcbb1e commit 8e58b0f
Show file tree
Hide file tree
Showing 3 changed files with 291 additions and 41 deletions.
10 changes: 6 additions & 4 deletions Documentation/platforms/arm/samv7/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,12 @@ The peripheral implements four timer counter modules, each supporting three inde
Universal Synchronous Asynchronous Receiver Transceiver (USART)
---------------------------------------------------------------

The MCU supports both UART and USART controllers. USART peripheral can be used with TX and RX DMA support.
For RX DMA it is required to configure idle bus timeout value in ``CONFIG_SAMV7_SERIAL_DMA_TIMEOUT``.
This option ensures data are read from the DMA buffer even if it is not full yet. DMA support is
implemented only for USART peripheral and not for UART.
The MCU supports both UART and USART controllers. These peripheral can be used with TX and RX DMA support.
For RX DMA on USART, it is possible to configure idle bus timeout value in ``CONFIG_SAMV7_SERIAL_DMA_TIMEOUT``.
This option ensures data are read from the DMA buffer even if it is not full yet. UART peripherals do not have
this timeout support, therefore function :c:func:`sam_serial_dma_poll` should be called periodically to
flush the DMA buffers. Boards can use common :c:func:`board_uart_rxdma_poll_init` function to initialize
a timer triggering the poll.

There are several modes in which USART peripheral can operate (ISO7816, IrDA, RS485, SPI, LIN and LON).
Currently RS485 and SPI master are supported by NuttX.
Expand Down
Loading

0 comments on commit 8e58b0f

Please sign in to comment.