Slave Microwire Serial Transfers; Software Control For Slave Selection - Altera Cyclone V Device Handbook

Hide thumbs Also See for Cyclone V:
Table of Contents

Advertisement

cv_54019
2013.12.30
To complete a continuous serial transfer from a serial master to the SPI slave, follow these steps:
1. If the SPI slave is enabled, disable it by writing 0 to SSIENR.
2. Set up the SPI control registers for the transfer. You can set these registers in any order.
• Write CTRLR0 (for SPI transfers, set SCPH and SCPOL identical to the master device.
• Write TXFTLR and RXFTLR to set FIFO buffer threshold levels.
• Write the IMR register to set up interrupt masks.
3. Enable the SPI slave by writing 1 to the SSIENR register.
4. If the transfer mode is transmit and receive (TMOD=2'b00) or transmit only (TMOD=2'b01), write data
for transmission to the master into the transmit FIFO buffer (write DR). If the transfer mode is receive
only (TMOD=2'b10), you need not write data into the transmit FIFO buffer. The current value in the
transmit shift register is retransmitted.
5. The SPI slave is now ready for the serial transfer. The transfer begins when a serial-master device selects
the SPI slave.
6. When the transfer is underway, the BUSY status can be polled to return the transfer status. If a transmit
FIFO empty interrupt request is made, write the transmit FIFO buffer (write DR). If a receive FIFO full
interrupt request is made, read the receive FIFO buffer (read DR).
7. The transfer ends when the serial master removes the select input to the SPI slave. When the transfer is
completed, the BUSY status is reset to 0.
8. If the transfer mode is not transmit only (TMOD != 01), read the receive FIFO buffer until empty.
9. Disable the SPI slave by writing 0 to SSIENR.

Slave Microwire Serial Transfers

For SPI slave, the Microwire protocol operates in much the same way as the SPI protocol. There is no decode
of the control frame by the SPI slave.

Software Control for Slave Selection

When using software to select slave devices, the input select lines from serial slave devices is connected to a
single slave select output on the SPI master.
Example: Slave Selection Software Flow for SPI Master
1. If the SPI master is enabled, disable it by writing 0 to SSIENR.
2. Write CTRLR0 to match the required transfer.
3. If the transfer is receive only, write the number of frames into CTRLR1.
4. Write BAUDR to set the transfer baud rate.
5. Write TXFTLR and RXFTLR to set FIFO buffer threshold levels.
6. Write IMR register to set interrupt masks.
7. Write SER register bit[0] to logic '1' to select slave 1 in this example.
8. Write SSIENR register bit[0] to logic '1' to enable SPI master.
SPI Controller
Send Feedback
Slave Microwire Serial Transfers
19-23
Altera Corporation

Advertisement

Table of Contents
loading

Table of Contents