13.3.2.2.1 Software Design Flow

Initialization of the SPI Peripheral

Initialize the SPI instance SPI_0 by using MSS_SPI_init API.

SPI Master Mode Configuration

Configure MSS SPI_0 in master mode by using MSS_SPI_configure_master_mode API. The SPI peripheral generates a serial clock and data to the slave device.

The following parameters are required to configure SPI_0 so it can operate as a SPI Master.

  • SPI_0 instance data structure
  • Target SPI slave (SPI Flash, for example)
  • Serial peripheral interface operating mode
  • Divider value to generate serial interface clock signal from PCLK
  • Frame bit length

Data Transfer

Follow the steps to transfer data to SPI Flash or to receive data from SPI Flash.

  • Set the slave by using MSS_SPI_set_slave_select API.
  • Transfer the data frame by using MSS_SPI_transfer_frame API.
  • Deselect the slave after data transfer by using MSS_SPI_clear_slave_select API.

For more information about how to access Flash memory through SPI interface, see TU0548: Accessing Serial Flash Memory Using SPI Interface - Libero SoC v11.6 SoC and Keil uVision Flow for SmartFusion2 Tutorial.

For more information about the usage of SPI_0 peripheral in IAP, see the In-Application Programming chapter of UG0451: IGLOO2 and SmartFusion2 Programming User Guide.