SD Card Inactive State
During the process of trying to write my own MDD stack, I found a comment in the code given by Microchip. It states:
//Check if all attempts failed and we timed out. Normally, this won’t happen,
//unless maybe the SD card was busy, because it was previously performing a
//read or write operation, when it was interrupted by the microcontroller getting
//reset or power cycled, without also resetting or power cycling the SD card.
//In this case, the SD card may still be busy (ex: trying to respond with the
//read request data), and may not be ready to process CMD0. In this case,
//we can try to recover by issuing CMD12 (STOP_TRANSMISSION).
Power cycling is the process of power resetting the card by taking away the voltage supply of the card and then slowly reintroduce the voltage back into the card. The detail of this process can be found in SD card spec given by Phison and some other SD card spec sheet. To do a power cycle, the voltage level of the SD card needs to be hold below 0.5V for at least 1msec. Power cycle is required to reactive cards that went into the inactive states.
SD cards that are in inactive states will not respond to any signals, it will just stay inactive as if the time in the SD card had been stopped. There are two ways to drive a card into inactive state, one is by manually sending a command CMD16 (GO_INACTIVE_STATE) to the SD card and also if the voltage is incompatible to the card when responding to ACMD41 which checks for the voltage compatibility of the SD card. It is also noticed that the SD card were to hang, the initialization process stuck at the loop for getting a response for ACMD41. It might had sent the card into inactive state.