
In this block transfer, there are 15 destination burst transactions in a DMA block transfer. But the watermark
level,
DMATDLR
, is high. Therefore, the probability of SPI transmit underflow is low because the DMA
controller has plenty of time to service the destination burst transaction request before the SPI transmit
FIFO buffer becomes empty. †
Thus, the second case has a lower probability of underflow at the expense of more burst transactions per
block. This provides a potentially greater amount of bursts per block and worse bus utilization than the
former case. †
Therefore, the goal in choosing a watermark level is to minimize the number of transactions per block, while
at the same time keeping the probability of an underflow condition to an acceptable level. In practice, this
is a function of the ratio of the rate at which the SPI transmits data to the rate at which the DMA can respond
to destination burst requests. †
Transmit FIFO Buffer Overflow
Setting the DMA transaction burst length to a value greater than the watermark level that triggers the DMA
request may cause overflow when there is not enough space in the transmit FIFO buffer to service the
destination burst request. Therefore, the following equation must be adhered to in order to avoid overflow:
†
DMA burst length <=
FIFO_DEPTH
-
DMATDLR
In case 2:
DMATDLR
= 192, the amount of space in the transmit FIFO buffer at the time of the burst request
is made is equal to the DMA burst length. Thus, the transmit FIFO buffer may be full, but not overflowed,
at the completion of the burst transaction. †
Therefore, for optimal operation, DMA burst length should be set at the FIFO buffer level that triggers a
transmit DMA request; that is: †
DMA burst length =
FIFO_DEPTH
-
DMATDLR
Adhering to this equation reduces the number of DMA bursts needed for block transfer, and this in turn
improves bus utilization. †
The transmit FIFO buffer will not be full at the end of a DMA burst transfer if the SPI controller has
successfully transmitted one data item or more on the serial transmit line during the transfer. †
Receive FIFO Buffer Overflow
During SPI serial transfers, receive FIFO buffer requests are made to the DMA whenever the number of
entries in the receive FIFO buffer is at or above the DMA Receive Data Level Register, that is
DMATDLR
+
1.This is known as the watermark level. The DMA responds by fetching a burst of data from the receive
FIFO buffer. †
Data should be fetched by the DMA often enough for the receive FIFO buffer to accept serial transfers
continuously, that is, when the FIFO buffer begins to fill, another DMA transfer is requested. Otherwise the
FIFO buffer will fill with data (overflow). To prevent this condition, the user must set the watermark level
correctly. †
Choosing Receive Watermark Level
Similar to choosing the transmit watermark level, the receive watermark level,
DMATDLR
+ 1, should be set
to minimize the probability of overflow, as shown in the SSP Serial Format continuous Transfer figure. It is
a trade off between the number of DMA burst transactions required per block versus the probability of an
overflow occurring. †
SPI Controller
Altera Corporation
cv_54019
Transmit FIFO Buffer Overflow
19-26
2013.12.30