Chapter 2. API Reference
SPI_SLAVE_BIT_LSBFIRST
Transmit and receive LSB first.
Type Definitions
typedef struct
spi_slave_transaction_t
typedef void
(*slave_transaction_cb_t)(spi_slave_transaction_t
2.2.18 SPI Slave Half Duplex
Introduction
The half duplex (HD) mode is a special mode provided by ESP SPI Slave peripheral. Under this mode, the hardware
provides more services than the full duplex (FD) mode (the mode for general purpose SPI transactions, see
Driver). These services reduce the CPU load and the response time of SPI Slave, but the communication format is
determined by the hardware. The communication format is always half duplex, so comes the name of Half Duplex
Mode.
There are several different types of transactions, determined by the command phase of the transaction. Each trans-
action may consist of the following phases: command, address, dummy, data. The command phase is mandatory,
while the other fields may be determined by the command field. During the command, address, dummy phases, the
bus is always controlled by the master, while the direction of the data phase depends on the command. The data
phase can be either an in phase, for the master to write data to the slave; or an out phase, for the master to read data
from the slave.
About the details of how master should communicate with the SPI Slave, see
Protocol.
By these different transactions, the slave provide these services to the master:
• A DMA channel for the master to write a great amount of data to the slave.
• A DMA channel for the master to read a great amount of data from the slave.
• Several general purpose registers, shard between the master and the slave.
• Several general purpose interrupts, for the master to interrupt the SW of slave.
Terminology
• Transaction
• Channel
• Sending
• Receiving
• Data Descriptor
Driver Feature
• Transaction read/write by master in segments
• Queues for data to send and received
Driver usage
Slave initialization
Call
driver. The SPI slave will exclusively use the SPI peripheral, pins of the bus before it's deinitialized. Most config-
urations of the slave should be done as soon as the slave is being initialized.
The
spi_bus_config_t
spi_slave_hd_slot_config_t
Espressif Systems
spi_slave_transaction_t
spi_slave_hd_init()
specifies
how
specifies how the SPI Slave driver should work.
Submit Document Feedback
*trans)
ESP SPI Slave HD (Half Duplex) Mode
to initialize the SPI bus as well as the peripheral and the
the
bus
should
388
SPI Slave
be
initialized,
while
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?