This example demonstrates the SPI mode provided by the USART peripherals on SAMV7/E7 Microcontrollers.
Requirements
This package can be used with SAMV71 Xplained Ultra board or SAME70 Xplained board. Please connect the USART and SPI pins on one board as following matching table:
- USART0 -- SPI0 (for USART0 as SPI master)
- SCK0(PB13 pin05 on J504) - SCK (SCK on J506)
- TXD0(PB01 pin14 on EXT1) - MOSI (MOSI on J506)
- RXD0(PB00 pin13 on EXT1) - MISO (MISO on J506)
- RTS0(PB03 PIN05 on EXT1) - NSS (PB02 pin06 on EXT1)
- USART0 -- SPI0 (for USART0 as SPI slave)
- SCK0(PB13 pin05 on J504) - SCK (SCK on J506)
- RXD0(PB00 pin13 on EXT1) - MOSI (MOSI on J506)
- TXD0(PB01 pin14 on EXT1) - MISO (MISO on J506)
- CTS0(PB02 PIN06 on EXT1) - NPCS1(PD25 pin15 on EXT1)
Description
This example demonstrates how to use USART in SPI mode. The USART is configured as SPI master and slave. Meanwhile, the SPI peripheral in the Microcontroller is configured respectively, making it to communicate with the USART peripheral.
The application first initializes DBGU as the interface to interact with users. The application waits for input from DBGU:
Menu : ------
- M: Configure USART as spi master
- S: Configure USART as spi slave
- H: Display this menu
Usage
- Build the program and download it inside the board. Please refer to the Getting Started with SAM V71/E70 Microcontrollers.pdf
- Connect a serial cable to the DBGU port on the evaluation kit.
- On the computer, open and configure a terminal application (e.g. HyperTerminal on Microsoft Windows) with these settings:
- 115200 baud rate
- 8 bits of data
- No parity
- 1 stop bit
- No flow control
- Start the application. The following traces shall appear on the terminal:
-- USART SPI Example xxx --
-- SAMxxxxx-xx
-- Compiled: xxx xx xxxx xx:xx:xx --
References