R01UH0823EJ0100 Rev.1.00
Page 1456 of 1823
Jul 31, 2019
RX23W Group
40. SD Host Interface (SDHIa)
40.3.6.4 Single Block Write Command (CMD24)
shows an example of issuing the single block write command (CMD24).
1. Set the flags in registers SDSTS1 and SDSTS2 to 0.
2. Set the SDHI clock in the SDCLKCR register, and set the interrupt requests to be masked in registers SDIMSK1
for details on setting the SDCLKCR register.
3. After setting the argument field value for CMD24 to the SDARG register, write 0000 0018h to the SDCMD
register. The SDHI issues CMD24 when a value is written to the SDCMD register.
4. When the response is received, the SDSTS1.RSPEND flag becomes 1, and the response end interrupt request is
generated.
5. Set the SDSTS1.RSPEND flag to 0 and read the response stored in the SDRSP10 register. If the read response is in
error, set the SDSTOP.STP bit or SDIOMD.IOABT bit to 1, and the command sequence can be stopped. When the
command sequence is stopped, the SDSTS1.ACEND flag becomes 1. Note that when this command sequence is
stopped, CMD12 and CMD52 are not automatically issued.
6. After the response is received, set the SDIMSK1.ACENDM bit to 0, and set the SDIMSK2.BWEM bit to 0.
7. When the SDBUFR register becomes write accessible, the SDSTS2.BWE flag becomes 1, and the BWE interrupt
request is generated.
8. Set the SDSTS2.BWE flag to 0, and write the amount of data set in the SDSIZE.LEN[9:0] bits to the SDBUFR
register. After writing to the SDBUFR register, the SDHI transmits write data to the SD card. Also, after writing to
the SDBUFR register, data transmission may cause a communication error or timeout to occur.
9. After all data has been written to the SD card, the SDHI receives the CRC status token, and the SDHI_D0 pin line
becomes busy (low). Then, when the SDHI exits the busy state, the SDSTS1.ACEND flag becomes 1, and the
access end interrupt request is generated.
10. Set the SDSTS1.ACEND flag to 0.
Perform error processing (clear the interrupt flag) if a communication error or timeout occurs.