Microchip® Advanced Software Framework

Quick start guide for

FreeRTOS SPI peripheral control functions

This is the quick start guide for the FreeRTOS SPI 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 mode, and fully asynchronous mode.

freertos_spi_write_packet() is used to transmit data in standard mode. freertos_spi_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_spi_read_packet() is used to receive data in standard mode. freertos_spi_read_packet() does not return until all the requested data has been received. This is safe because, in master mode, the amount of data being received is controlled by the receiving device, and therefore known in advance. Other FreeRTOS tasks will execute while the data is being received.

freertos_spi_write_packet_async() is used to transmit data in the fully asynchronous mode. freertos_spi_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_spi_write_packet_async() and freertos_spi_read_packet_async() must not be used when the peripheral is initialized to use standard mode. Likewise, freertos_spi_write_packet() and freertos_spi_read_packet() must not be used when the peripheral is configured to use fully asynchronous mode.

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.

Standard Mode Functions

Fully Asynchronous Mode Functions