R01UH0823EJ0100 Rev.1.00
Page 1471 of 1823
Jul 31, 2019
RX23W Group
40. SD Host Interface (SDHIa)
40.5
Notes on Using the SDHI
40.5.1
Illegal Read Access During a Multi-Block Read and How To Avoid It
When the multi-block read command (CMD18) is issued to read one or two blocks, if the response to CMD18 stored in
the SDRSP10 register is read, the timing of the read access may cause the response to be read incorrectly.
shows examples of a normal read and an illegal read when using CMD18 to read two blocks.
Figure 40.23
Multi-Block Read Processing When Reading Two Blocks
In the example of the illegal read, when the interrupt is generated by receiving the response to CMD18, the timing for
reading the SDRSP10 register during the interrupt handling is delayed, and instead of the response for CMD18 being
read, the response for CMD12 or the data during the response for CMD12 may be read.
This problem can be avoided by performing either of the following:
When reading one block or two blocks, use a single block read command instead of a multi-block read command.
When reading the response for CMD18, read the SDRSP54 register instead of the SDRSP10 register.
When using a multi-block read command to read three or more blocks, CMD12 will not be issued if no block data is
read, which will prevent this problem from happening. Also, when using a multi-block write command, the above
problem can be avoided by transmitting block data after reading the response to CMD25.
40.5.2
SDBUFR Register Illegal Write Error
When writing to the SDBUFR register after issuing a single block write command or a multi-block write command, write
data for the size set by the SDSIZE.LEN[9:0] bits. If the amount of data written to the SDBUFR register is greater than
the size set by the SDSIZE.LEN[9:0] bits, an illegal write error occurs in the SDBUFR register, and the SDSTS2.ILW
flag becomes 1. However, the padding data included in the data being written to the SDBUFR register is ignored, so this
error does not occur. For example, if the data size set by the SDSIZE.LEN[9:0] bits is an odd number, of the data written
to the SDBUFR register, there is a remainder of 1 byte or 3 bytes. Although the extra data is written to the register, no
error occurs. If the data size set by the SDSIZE.LEN[9:0] bits is an even number, and there is a remainder of 2 bytes, no
error occurs even if these 2 bytes are written to the SDBUFR register.
If data written to the SDBUFR register is not transmitted, the SDSTS2.SDCLKCREN flag may remain set to 0. In this
case, in order to set the SDSTS2.SDCLKCREN flag to 1, the SDRST.SDRST bit must be set to 0 and then set back to 1.
SDHI
(hardware) operation
Issue CMD18
Receive response to
CMD18
Receive block data
Receive block data
+
Issue CMD12
Receive response to
CMD12
CMD18 issuance
processing
Read the response
register (CMD18)
Block data read 1
Block data read 2
Interrupt
Interrupt
Interrupt
Read the response
register (CMD12)
Interrupt
Normal read
SDHI
(hardware) operation
Issue CMD18
Receive response to
CMD18
Receive block data
Receive block data
+
Issue CMD12
Receive response to
CMD12
CMD18 issuance
processing
Interrupt
Read the response
register (?)
Illegal read
Software operation
Software operation
X