- Purpose
This example uses Serial Peripheral Interface (SPI) of samv71_xplained_ultra/same70_xplained_pro board in slave mode to communicate with another samv71_xplained_ultra board's SPI in master mode. The memory move operations through the unidirectional communication are controlled by XDMAC for SPI transmitter and receiver,one XDMAC channel for transmitter and one channel for receiver.
- Requirements
This package can be used with two SAM evaluation kits boards. Please connect the SPI pins from one board to another.
- SAME70-Xplained – SAME70-Xplained
- VCC – VCC
- NPCS0(PB02, EXT1-PIN6) – NPCS0(PB02, EXT1-PIN6)
- MISO(PD20, EXT1-PIN17) – MISO(PD20, EXT1-PIN17)
- MOSI(PD21, EXT1-PIN16) – MOSI(PD21, EXT1-PIN16)
- SPCK(PD22, EXT1-PIN18) – SPCK(PD22, EXT1-PIN18)
GND – GND
- Descriptions
This example shows control of the SPI, and how to configure and transfer data with SPI through XDMAC. By default, example runs in SPI slave mode, waiting SPI slave & COM port inputs.
The code can be roughly broken down as follows:
- Usage
- Compile the application.
- Connect the COM port of the evaluation board to the computer and open it in a terminal.
- Settings: 115200 bauds, 8 bits, 1 stop bit, no parity, no flow control.
- Download the program into the evaluation board and run it.
- Upon startup, the application will output the following line on the terminal:
* -- Spi Example --
* -- xxxxxx-xx
* -- Compiled: xxx xx xxxx xx:xx:xx --
* -I- Initialize SPI as slave
*
*Menu
*------
* 0: Set SPCK = 500000 Hz
* 1: Set SPCK = 1000000 Hz
* 2: Set SPCK = 2000000 Hz
* 2: Set SPCK = 5000000 Hz
* t: Perform SPI master
* h: Display menu
- The following traces detail operations on the SPI example, displaying success or error messages depending on the results of the commands.