65.11.2.1 SDMMC Tuning Sequence
The SDMMC tuning sequence must only be done when SD/SDIO SDR104 , e.MMC HS200 or HS400 is selected and for a 100-MHz SDCLK frequency or higher.
- Enable the retuning timer (SDMMC_RTC1R.TMREN = 1).
- Configure the retuning period by setting SDMMC_RTCVR.TCVAL.
- Set SDMMC_RTISTER.TEVT to ‘1’ so that the TEVT status flag in SDMMC_RTISTR rises each time the retuning timer counter period elapses.
- Set SDMMC_RTISIER.TEVT to ‘1’ to generate an interrupt on the TEVT status flag assertion (optional).
- Execute the tuning procedure as defined in “Sampling Clock Tuning Procedure” in the “SD Host Controller Simplified Specification V3.00” .
- Start the retuning timer count (write SDMMC_RTC2R.RLD to 1). At this step, data can be read by the SDMMC.
- Each time SDMMC_RTISTR.TEVT is set to ‘1’:
a. Execute the tuning procedure as defined in “Sampling Clock Tuning Procedure” in the “SD Host Controller Simplified Specification V3.00” before issuing the next command.
b. Restart the retuning timer count (write SDMMC_RTC2R.RLD to ‘1’).
c. Resume data reading from the device.
When several instances of SDMMC are implemented in a product, the TEVT status flag of each SDMMC instance can be checked by reading SDMMC_RTSSR.