Datasheet
06 February 2012 Broadcom Europe Ltd. 406 Science Park Milton Road Cambridge CB4 0WW Page 158
© 2012 Broadcom Corporation. All rights reserved
10.6 Software Operation
10.6.1 Polled
a) Set CS, CPOL, CPHA as required and set TA = 1.
b) Poll TXD writing bytes to SPI_FIFO, RXD reading bytes from SPI_FIFO until all
data written.
c) Poll DONE until it goes to 1.
d) Set TA = 0.
10.6.2 Interrupt
e) Set INTR and INTD. These can be left set over multiple operations.
f) Set CS, CPOL, CPHA as required and set TA = 1. This will immediately trigger a
first interrupt with DONE == 1.
g) On interrupt:
h) If DONE is set and data to write (this means it is the first interrupt), write up to 16
bytes to SPI_FIFO. If DONE is set and no more data, set TA = 0. Read trailing data
from SPI_FIFO until RXD is 0.
i) If RXR is set read 12 bytes data from SPI_FIFO and if more data to write, write up to
12 bytes to SPIFIFO.
10.6.3 DMA
Note: In order to function correctly, each DMA channel must be set to perform 32-bit
transfers when communicating with the SPI. Either the Source or the Destination Transfer
Width field in the DMA TI register must be set to 0 (i.e. 32-bit words) depending upon
whether the channel is reading or writing to the SPI.
Two DMA channels are required, one to read from and one to write to the SPI.
j) Enable DMA DREQ’s by setting the DMAEN bit and ADCS if required.
k) Program two DMA control blocks, one for each DMA controller.
l) DMA channel 1 control block should have its PER_MAP set to x and should be set to
write ‘transfer length’ + 1 words to SPI_FIFO. The data should comprise:
i) A word with the transfer length in bytes in the top sixteen bits, and the control
register settings [7:0] in the bottom eight bits (i.e. TA = 1, CS, CPOL, CPHA as
required.)
ii) ‘Transfer length’ number in words of data to send.
m) DMA channel 2 control block should have its PER_MAP set to y and should be set to
read ‘transfer length’ words from SPI_FIFO.
n) Point each DMA channel at its CB and set its ACTIVE bit to 1.
o) On receipt of an interrupt from DMA channel 2, the transfer is complete.