- Purpose
This example uses Serial Peripheral Interface (SPI) of one EK board in slave mode to communicate with another EK board's SPI in master mode by PDC function.
- Requirements
This package can be used with two SAM evaluation kits boards. Please connect the SPI pins from one board to another.
- Descriptions
This example shows control of the SPI, and how to configure and transfer data with SPI. By default, example runs in SPI slave mode, waiting SPI slave & UART inputs.
This example has been tested with the following board:
- sam3n4c_sam3n_ek
- sam3s4c_sam3s_ek
- sam3sd8c_sam3s_ek2
- sam4s16c_sam4s_ek
- sam4sd32c_sam4s_ek2
- sam4n16c_sam4n_xplained_pro
- sam4c16c_sam4c_ek
- samg53n19_samg_xplained_pro
- sam4cp16b_sam4cp16bmb
- samg55j19_samg_xplained_pro
The code can be roughly broken down as follows:
-
't' will start SPI transfer test.
-
Configure SPI as master, and set up SPI clock.
-
Send 64-byte data and receive data from slave at same time, after that compare the result.
-
Setup SPI clock for master.
- Usage
- Compile the application.
- Connect the UART 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 Pdc Example --
-- xxxxxx-xx
-- Compiled: xxx xx xxxx xx:xx:xx --
- The following traces detail operations on the SPI PDC example, displaying success or error messages depending on the results of the commands.