Philips LPC2119 User Manual page 151

Arm-based microcontroller
Hide thumbs Also See for LPC2119:
Table of Contents

Advertisement

Philips Semiconductors
ARM-based Microcontroller
The following sequence describes how one should process a data transfer with the SPI block when it is set up to be a slave. This
process assumes that any prior data transfer has already completed. It is required that the system clock driving the SPI logic be
at least 8X faster than the SPI.
1. Set the SPI control register to the desired settings.
2. Write the data to transmitted to the SPI data register (optional). Note that this can only be done when a slave SPI transfer
is not in progress.
3. Wait for the SPIF bit in the SPI status register to be set to 1. The SPIF bit will be set after the last sampling clock edge of
the SPI data transfer.
4. Read the SPI status register.
5. Read the received data from the SPI data register (optional).
6. Go to step 2 if more data is required to transmit.
Note that a read or write of the SPI data register is required in order to clear the SPIF status bit. Therefore, at least one of the
optional reads or writes of the SPI data register must take place, in order to clear the SPIF status bit.
Exception Conditions
Read Overrun - A read overrun occurs when the SPI block internal read buffer contains data that has not been read by the
processor, and a new transfer has completed. The read buffer containing valid data is indicated by the SPIF bit in the status
register being active. When a transfer completes, the SPI block needs to move the received data to the read buffer. If the SPIF
bit is active (the read buffer is full), the new receive data will be lost, and the read overrun (ROVR) bit in the status register will
be activated.
Write Collision - As stated previously, there is no write buffer between the SPI block bus interface, and the internal shift register.
As a result, data must not be written to the SPI data register when a SPI data transfer is currently in progress. The time frame
where data cannot be written to the SPI data register is from when the transfer starts, until after the status register has been read
when the SPIF status is active. If the SPI data register is written in this time frame, the write data will be lost, and the write collision
(WCOL) bit in the status register will be activated.
Mode Fault - The SSEL signal must always be inactive when the SPI block is a master. If the SSEL signal goes active, when
the SPI block is a master, this indicates another master has selected the device to be a slave. This condition is known as a mode
fault. When a mode fault is detected, the mode fault (MODF) bit in the status register will be activated, the SPI signal drivers will
be de-activated, and the SPI mode will be changed to be a slave.
Slave Abort - A slave transfer is considered to be aborted, if the SSEL signal goes inactive before the transfer is complete. In
the event of a slave abort, the transmit and receive data for the transfer that was in progress are lost, and the slave abort (ABRT)
bit in the status register will be activated.
SPI Interface
LPC2119/2129/2292/2294
151
Preliminary User Manual
January 08, 2004

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Lpc2129Lpc2292Lpc2294

Table of Contents