Information Center for ARM - EXAMPLE PROJECTS

## Information Center for ARM

## Flashloader for ATMEL

## usart_spi

This example demonstrates how to use USART in SPI mode. The USART is configured as SPI master or slave. Meanwhile, the SPI peripheral in the microcontroller is configured respectively, making it communicate with the USART peripheral. The example leaves UART to let user to switch the command between READ and WRITE from the view of master. The application first initializes UART as the interface to interact with users. By default, it initializes USART as SPI master and the SPI peripheral as SPI slave. The application waits for input from UART: - If 'w' is received, the master initiate a transmission by sending a block of data. The slave receives the data and dumps it to UART. - If 'r' is received, the master wait for data from slave and dump it to UART until the reception is finished. - If 's' is received, the master and slave are exchanged between USART1 and SPI. To assure the transferring succeeds, connect pins as the table above.