cancel
Showing results for 
Search instead for 
Did you mean: 

eMMC stop and restart

DShar.17
Associate II

hi all,

we have an application that requires powering an eMMC down and then back up while the MCU keeps running.

Background

We're successfully using the eMMC connected to the SDMMC1 peripheral running on a 25MHz 8-bit bus, with ClockPowerSave ENABLED. In this configuration the eMMC will not restart because it doesn't get the required 74 clocks that are part of the initialization, and simply does not respond to the first command (there are only 4 or 5 clocks before CMD starts to toggle):

0690X00000AtWDRQA3.png

One solution was to run with ClockPowerSave DISABLED, but that came at the cost of a power increase of some 18mW, which in this application is not acceptable.

Another solution that we came upon, is to run with ClockPowerSave ENABLED, but to disable it

hmmc->Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
SDMMC_Init(hmmc->Instance, hmmc->Init);

just before shutting down the eMMC with HAL_MMC_DeInit(), and then to re-enable it after HAL_MMC_Init():

hmmc->Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_ENABLE;
HAL_MMC_ConfigWideBusOperation(hmmc, SDMMC_BUS_WIDE_8B);

On restart, the 74 clocks (or at least, most of them) come at 25MHz before HAL_MMC_Init() slows the bus down to the 200kHz initialization speed:

0690X00000AtWGkQAN.png

Question

Given that eMMCs are not made to be hot swappable, is this a reliable way to stop and restart the device? Is there a better way?

3 REPLIES 3

I'd imagine there are commands and parameters on the eMMC side, check the specs.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
DShar.17
Associate II

Thank you for your reply.

Follow Up

It turns out that the silicon is designed to only produce the 74 clocks once ... when the SDMMC peripheral's Power Control Register's PWRCTRL bits are set to "Power-on" ... fair enough, the eMMC is not expected to be power cycled independently of the MCU.

So the solution was to generate those 74 clocks ourselves, by manipulating the GPIO directly.

Dear Sir,

Would you mind to share the source code for restarting the mmc? Cheers