Skip to content

Using USART and UART

Joshua Salzedo edited this page Mar 21, 2021 · 4 revisions

Note: The buffer used must use singleton so that DMA can correctly access the buffer.

Instantiating the USART

In addition to the standard serial configuration, clocks, and interrupt name, the specific DMA streams must also be known. The DMA streams can be found in the MCU's reference manual under the DMAn request mapping. The stream configuration is type checked.

See the f4 serial example for an example construction.

Reading

To read from the USART, the receive method returns a future that completes when one of the following occurs:

  1. The passed buffer becomes full.
  2. The USART falls idle after receiving some data.
  3. An error occurs.

Writing

The transmit method returns a future when one of the following occurs:

  1. the provided buffer is fully transmitted.
  2. an error occurs.
Clone this wiki locally