Microchip® Advanced Software Framework

Quick start guide for

FreeRTOS UART peripheral control functions

This is the quick start guide for the FreeRTOS UART peripheral, with step-by-step instructions on how to configure and use the service.

The service can be initialized to operate in one of two different modes - standard transmit mode, and fully asynchronous transmit mode. There is only one receive mode.

freertos_uart_write_packet() is used to transmit data in standard mode. freertos_uart_write_packet() does not return until all the data has been fully transmitted. Other FreeRTOS tasks will execute while the data transmission is in progress.

freertos_uart_write_packet_async() is used to transmit data in the fully asynchronous mode. freertos_uart_write_packet_async() returns as soon as the data transmission has started (not when it has finished), and can opt to be notified by FreeRTOS when the transmission is complete. The buffer being transmitted must not be altered until the transmission is complete.

freertos_uart_write_packet_async() must not be used when the peripheral is initialized to use standard mode. Likewise, freertos_uart_write_packet() must not be used when the peripheral is configured to use fully asynchronous mode.

On asynchronous full duplex peripherals, such as the UART, data can be received at any time, not just when a receive function is called. On these peripherals, to ensure data is not lost, the FreeRTOS drivers are configured to place all received data into a dma buffer, no matter when the data arrives. When a receive function is called, the data already in the dma buffer is copied into the user buffer specified in a parameter to the receive function. Available but unread data remains in the dma buffer, ready for the next receive function call.

Refer to the FreeRTOS peripheral control projects in the Atmel ASF distribution for complete working examples, and the FreeRTOS web site for information on getting started with FreeRTOS.

Transmitting In Standard Mode

Transmitting in Fully Asynchronous

Mode

Receiving