The slave operation of the core supports
a FIXED burst at the transmit or receive FIFO only. The length of this burst transaction
should be based on the FIFO Depth parameter as
well as the transmit or receive occupancy register. Take note of this to avoid any
overrun or underrun errors of the DTR or DRR FIFO.
Use these steps to successfully complete a SPI transaction:
- Start from proper state including SPI bus arbitration.
- Configure the master DGIER and IPIER registers. Also configure the slave DGIER and IPIER registers as required.
- Write configuration data to the master SPI device SPICR register as required.
- Write configuration data to the slave SPI device SPICR register as required.
- Write the active-Low, one-hot encoded slave select address to the master SPISSR register.
- Write all data to the slave SPI DTR register/FIFO as required.
- Write all data to the master SPI DTR register/FIFO.
- Write the enable bit to the master SPICR register which starts the transfer.
- Wait for interrupt (typically IPISR bit 4) or poll status for completion.
- Read the IPISR register of both master and slave SPI devices as required.
- Perform interrupt requests as required.
- Read the SPISR register of both master and slave SPI devices as required.
- Perform actions as required or dictated by SPISR register data.