![FTDI FT51A Скачать руководство пользователя страница 38](http://html1.mh-extra.com/html/ftdi/ft51a/ft51a_application-note_2341158038.webp)
Application Note
AN_289 FT51A Programming Guide
Version 1.0
Document Reference No.: FT_000962 Clearance No.: FTDI# 483
37
Copyright © 2015 Future Technology Devices International Limited
is followed by a data byte being clocked out with the master driving CLK. The master always
supplies the first byte, which is called a command byte. After this the desired number of data
bytes are transferred before the transaction is terminated by the master de-asserting slave select.
An SPI Master is able to abort a transfer at any time by de-asserting its SS# output. This will
cause the Slave to end its current transfer and return to an idle state.
Data transfer can be controlled by the CPU using interrupts/status register
SPI_SLAVE_INT
. Data
sent to the SPI Slave block can be read out from the
SPI_SLAVE_RX
register and data to be sent out
has to be written to the
SPI_SLAVE_TX
register. In case of data being sent from the block there are
bits indicating when there is space to write into the Tx holding register. Also, there is a Tx overrun
bit which is set when data is attempted to be written to a full Tx register, a bit indicating whether
the state machine is busy processing a transfer and a Tx done interrupt when a byte has been
sent. In the case of data to be received by the block there is a RX full interrupt indicating new data
to be read out by the CPU and Rx overrun bit that indicates that data has been received when RX
register was full.
Data transfers can also be controlled by DMA. More details on how to configure DMAs to work with
the SPI Slave block can be found in the DMA section of this document.
2.4.1
SPI_SLAVE_CONTROL
Bit
Position
Bit Field Name
Type
Reset
Description
7..2
Reserved
RFU
0
Reserved
1
spi_slave_dev_en
R/W
0
Enable SPI Slave
0
spi_slave_soft_reset
R/W
0
Reset SPI Slave
Table 2.37 SPI Slave Control Register
The SPI Slave Control register provides top-level enables and reset functions for the SPI Slave
module.
The SPI Slave module is enabled by setting the
spi_slave_dev_en
bit to 1. Clearing this bit will
disable the module.
To reset the module, a 1 is written to the
spi_slave_soft_reset
bit. This is cleared when the reset
is performed and will therefore always read as ‘0’.
2.4.2
SPI_SLAVE_TX_DATA
Bit
Position
Bit Field Name
Type
Reset
Description
7..0
Data
R/W
0
Byte of data to be transmitted from
the SPI Slave module
Table 2.38 SPI Slave Transmit Register
This register contains data to be transmitted from the Slave to the Master.