UM10208_2
© NXP B.V. 2007. All rights reserved.
User manual
Rev. 02 — 1 June 2007
291 of 362
NXP Semiconductors
UM10208
Chapter 23: LPC2800 SD/MMC
The DPSM moves to the RECEIVE state if it receives a start bit before a timeout, and
loads the data block counter. If it reaches a timeout before it detects a start bit, or a start
bit error occurs, it moves to the IDLE state and sets the timeout status flag.
•
RECEIVE: Serial data received from a card is packed in bytes and written to the data
FIFO. Depending on the transfer mode bit in the data control register, the data transfer
mode can be either block or stream:
-In block mode, when the data block counter reaches zero, the DPSM waits until it
receives the CRC code. If the received code matches the internally generated CRC
code, the DPSM moves to the WAIT_R state. If not, the CRC fail status flag is set and
the DPSM moves to the IDLE state.
-In stream mode, the DPSM receives data while the data counter is not zero. When
the counter is zero, the remaining data in the shift register is written to the data FIFO,
and the DPSM moves to the WAIT-R state.
If a FIFO overrun error occurs, the DPSM sets the FIFO error flag and moves to the
WAIT_R state.
•
WAIT_S: The DPSM moves to the IDLE state if the data counter is zero. If not, it waits
until the data FIFO empty flag is de-asserted, and moves to the SEND state.
Note: The DPSM remains in the WAIT_S state for at least two clock periods to meet Nwr
timing constraints.
•
SEND: The DPSM starts sending data to a card. Depending on the transfer mode bit
in the data control register, the data transfer mode can be either block or stream:
-In block mode, when the data block counter reaches zero, the DPSM sends an
internally generated CRC code and end bit, and moves to the BUSY state.
-In stream mode, the DPSM sends data to a card while the enable bit is HIGH and the
data counter is not zero. It then moves to the IDLE state.
If a FIFO underrun error occurs, the DPSM sets the FIFO error flag and moves to the
IDLE state.
•
BUSY: The DPSM waits for the CRC status flag:
-If it does not receive a positive CRC status, it moves to the IDLE state and sets the
CRC fail status flag.
-If it receives a positive CRC status, it moves to the WAIT_S state if MD0 is not low
(the card is not busy).
If a timeout occurs while the DPSM is in the BUSY state, it sets the data timeout flag and
moves to the IDLE state.
The data timer is enabled when the DPSM is in the WAIT_R or BUSY state, and
generates the data timeout error:
•
When transmitting data, the timeout occurs if the DPSM stays in the BUSY state for
longer than the programmed timeout period.
When receiving data, the timeout occurs if the end of the data is not true, and if the
DPSM stays in the WAIT_R state for longer than the programmed timeout period.
4.3.8 Data counter
The data counter has two functions: