spips
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Groups Pages
xspips_slave_polled_example.c File Reference

Overview

Implements a design example using the SPI controller in slave mode.

The example performs transfers in polled mode and has been tested with Aardvark Analyzer as Master. The example echoes data which it receives from the master. The slave controller expects MAX_DATA bytes of data from the master to transmit onto the SPI bus which the slave receives into its Rx buffer. It polls until the Rx FIFO is filled with the Threshold limit of data which is set to MAX_DATA. On sending data, the master receives dummy bytes in response. Master has to send MAX_DATA dummy bytes to read back the echoed data.

Note
The slave mode test needs an external master to send data to the Spi device. The example has been tested with Aardvark Analyzer as Master. The Clock Polarity and Phase should match between master and the slave.
MODIFICATION HISTORY:
Ver   Who Date     Changes


2.0 sb 08/22/14 First release ms 04/05/17 Modified Comment lines in functions to recognize it as documentation block for doxygen generation. 3.9 sb 07/05/23 Added support for system device-tree flow. 3.13 sb 09/09/25 Fix GCC warnings. 3.14 vlt 12/18/25 Update Doxygen comments to include SDT flow details. 3.15 vn 08/26/26 Fix Doxygen warnings. 3.15 tb 09/30/26 Align Doxygen comments with AMD documentation standards

#include "xparameters.h"
#include "xspips.h"
#include "xil_printf.h"

Macros

#define MAX_DATA   100
 Max data size in bytes. More...
 
#define UNIQUE_VALUE   0xAA
 Unique test data value. More...
 

Functions

int SpiPsSlavePolledExample (UINTPTR BaseAddress)
 Illustrates how to use the XSpiPs device driver in Slave mode. More...
 
int main (void)
 Calls the SPI Slave Example. More...
 

Variables

u8 ReadBuffer [MAX_DATA]
 Data received from the master. More...
 
u8 WriteBuffer [MAX_DATA]
 Data to send to the master. More...