Serial Peripheral Interface Controller
UG0331 User Guide Revision 15.0
526
14.3.2.2 Use Model 2: Interfacing Any SPI Slave Device Using MSS SPI Routing
Through Fabric
The external SPI slave devices like serial display device can be interfaced using SmartFusion2 MSS SPI
routing through fabric ports. The fabric ports can be brought out to the GPIO header to interface the SPI
slave device with SmartFusion2 device. Follow the instructions provided in the
page 520 to
configure SPI_0 with connection type fabric in the application. Double click
IO- Constraints
under
Edit
Constraints
in the Libero SoC design flow window to configure the appropriate GPIO header Pin
numbers for MSS SPI_0 fabric ports to brought out the SPI signals to interface the SPI slave device with
SmartFusion2 Device.
Figure 227 •
Interfacing External SPI Slave Device Using MSS SPI Routing Through Fabric Block Diagram
14.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 will 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 below 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.
TU0548: Accessing Serial Flash Memory Using SPI Interface - Libero SoC v11.6 SoC and
Keil uVision Flow for SmartFusion2 Tutorial
for more information on how to access Flash memory
through SPI interface.
066
)3*$
)DEULF
63,B
([WHUQDO63,6ODYH
'HYLFH
63,BB'2B0)
63,BB&/.B0)
63,BB662B0)
63,BB',B)0
6,
6&.
&6
62
6PDUW)XVLRQ