spips
Vitis Drivers API Documentation
xspips_flash_polled_example.c File Reference

Overview

This file contains a design example using the SPI driver (XSpiPs) in polled mode with a Serial Flash device.

This examples performs transfers in polled mode. The hardware which this example runs on, must have a Serial Flash for it to run. This example has been tested with SST25W080.

Note

None.

 MODIFICATION HISTORY:
 Ver   Who Date     Changes


1.00 sg 1/30/13 First release ms 04/05/17 Modified Comment lines in functions to recognize it as documentation block for doxygen generation and also modified filename tag to include the file in doxygen examples. 3.2 nsk 03/26/19 Add support for versal 3.9 sb 07/05/23 Added support for system device-tree flow.

Functions

int SpiPsFlashPolledExample (XSpiPs *SpiInstancePtr, u16 SpiDeviceId)
 The purpose of this function is to illustrate how to use the XSpiPs device driver in polled mode. More...
 
int main (void)
 Main function to call the SPI Flash Polled Example. More...
 

Function Documentation

int main ( void  )

Main function to call the SPI Flash Polled Example.

Returns
  • XST_SUCCESS if successful
  • XST_FAILURE if not successful
Note
None

References SpiPsFlashPolledExample().

int SpiPsFlashPolledExample ( XSpiPs SpiInstancePtr,
u16  SpiDeviceId 
)

The purpose of this function is to illustrate how to use the XSpiPs device driver in polled mode.

This function writes and reads data from a serial flash.

Parameters
SpiInstancePtris a pointer to the SPI driver instance to use.
SpiDeviceIdis the Instance Id of SPI in the system.
Returns
  • XST_SUCCESS if successful
  • XST_FAILURE if not successful
Note

If the device slave select is not correct and the device is not responding on bus it will read a status of 0xFF for the status register as the bus is pulled up.

References XSpiPs_Config::BaseAddress, XSpiPs_CfgInitialize(), XSPIPS_CLK_PRESCALE_8, XSPIPS_FORCE_SSELECT_OPTION, XSpiPs_LookupConfig(), XSPIPS_MANUAL_START_OPTION, XSPIPS_MASTER_OPTION, XSpiPs_SelfTest(), XSpiPs_SetClkPrescaler(), XSpiPs_SetOptions(), and XSpiPs_SetSlaveSelect().

Referenced by main().