![Nuvoton NUC970 series Technical Reference Manual Download Page 909](http://html1.mh-extra.com/html/nuvoton/nuc970-series/nuc970-series_technical-reference-manual_1720277909.webp)
NUC970 Technical Reference Manual
Publication Release Date: Dec. 15, 2015
- 909 -
Revision V1.30
NUC97
0
T
E
CHNIC
A
L
RE
F
E
RE
N
CE
MA
NUA
L
SDH controller uses an independent clock source named SDCLK as engine clock. SDCLK can be
completely asynchronous with system clock HCLK, SDCLK is changeable. However the HCLK should
be faster than SDCLK.
This SDH controller can generate all types of 48-bit command to SD card and retrieve all types of
response from SD card. After response in, the content of response will be stored at SDH_RESP0 and
SDH_RESP1. SD controller will calculate CRC-7 and check its correctness for response. If CRC-7 is
error, CRC_IF (SDH_INTSTS[1]) will be set and CRC7 (SDH_INTSTS[2])
will be ‘0’. For response
R1b, software should notice that after response in, SD card will put busy signal on data line DAT0;
software should check this status with clock polling until it became high. For response R3, CRC-7 is
invalid; but SD controller will still calculate CRC-7 and get an error result, software should ignore this
error and clear CRC_IF (SDH_INTSTS[1]) flag.
This SD controller is composed of two state machines they are command/response part and data part.
For command/response part, the trigger bits are CO_EN (SDH_CTL[0]), RI_EN (SDH_CTL[1]),
R2_EN (SDH_CTL[4]), CLK74_OE (SDH_CTL[5]) and CLK8_OE (SDH_CTL[6]). If all of these bits
enabled, the execution priority will be CLK74_OE (SDH_CTL[5]), CO_EN (SDH_CTL[0]), RI_EN
(SDH_CTL[1])/ R2_EN (SDH_CTL[4]), and then CLK8_OE (SDH_CTL[6]). Please note that RI_EN
(SDH_CTL[1]) and R2_EN (SDH_CTL[4])
can’t be triggered at the same time.
For data part, there are DI_EN (SDH_CTL[2]) and DO_EN (SDH_CTL[3]) for choose. Every time, only
one of them could be triggered. If DI_EN (SDH_CTL[2]) is triggered, SD controller waits start bit from
data line DAT0 immediately, and then get specified amount data from SD card. After data-in, SD
controller will check CRC-16 correctness; if it is error, CRC_IF (SDH_INTSTS[1]) will be set and
CRC16 (SDH_INTSTS[3])
will be ‘0’. If DO_EN (SDH_CTL[3]) is triggered, SD controller will wait
response in finished, and then send specified amount data to SD card. After data-out, SD controller
will get CRC statu
s from SD card and check its correctness; it should be ‘010’, otherwise CRC_IF
(SDH_INTSTS[1]) will be set and CRCSTAT (SDH_INTSTS[6:4]) will be the value it received.
If R2_EN (SDH_CTL[4]) is triggered, SD controller will receive response R2 (136 bits) from SD card,
CRC-
7 and end bit will be dropped. The receiving data will be placed at DMA’s buffer, starting from
address offset 0x0.
This SD controller also provides multiple block transfer function (change BLKLEN (SDH_BLEN[10:0])
to change the block length) to accelerate data transfer throughput. If CRC-7, CRC-16 or CRC status is
error, SD controller will stop transfer and set CRC_IF (SDH_INTSTS[1]) high. In this situation, the
SDH has to be reset.
There is a hardware time-out mechanism for response in and data in inside SD engine. Specify a 24-
bit time-out value at TMOUT (SDH_TMOUT[23:0]), and then SDH controller will decide when to time-
out based on this value.