cancel
Showing results for 
Search instead for 
Did you mean: 

problem porting SDMMC EMMC sleep/awake cmd to SDIO

MK..1
Associate III

Hi

I see sleep/awake cmd is implemeneted in HAL fpr STM32H7only.

Now I ported it myself to Stm32f446 myself successfully. However instead of while loop below, i inserted a HAL_Delay(1);

H7 has a SDMMC but Stm32f446 has a SDIO.

In the H/ HAL bit SDMMC_FLAG_BUSYD0END flag is checked to check when device is ready.

SDMMC_FLAG_BUSYD0END is bit 20 in SDMMC status register (SDMMC_STAR)

This bit how ever does not exist in SDIO status register (SDIO_STA).

How can I implement this on Stm32f446 ?

Its is about this while loop which i need to rewrite:

Thx

 

/* Wait that the device is ready by checking the D0 line */

while ((!__HAL_MMC_GET_FLAG(hmmc, SDMMC_FLAG_BUSYD0END)) && (errorstate == HAL_MMC_ERROR_NONE))

{

if ((HAL_GetTick() - tickstart) >= timeout)

{

errorstate = SDMMC_ERROR_TIMEOUT;

}

}

 

/* Clear the flag corresponding to end D0 bus line */

__HAL_MMC_CLEAR_FLAG(hmmc, SDMMC_FLAG_BUSYD0END);

1 ACCEPTED SOLUTION

Accepted Solutions

hello @MK..1 

To get the state of MultiMediaCards, the API that should be used is HAL_MMC_GetCardState()

To get the state of SD cards, the API that should be used is HAL_SD_GetCardState().

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

View solution in original post

4 REPLIES 4
Saket_Om
ST Employee

Hello @MK..1 

 

To check the state of the SD card, you can use the API HAL_MMC_GetCardState().

.

 

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

Hi

I am talking about a EMMC not SD card. Does that apply to EMMC as well?

hello @MK..1 

To get the state of MultiMediaCards, the API that should be used is HAL_MMC_GetCardState()

To get the state of SD cards, the API that should be used is HAL_SD_GetCardState().

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

Hello @MK..1 

 

Please mark my answer as best by clicking on the "Accept as Solution" button if it fully answered your question. This will help other users find this solution faster.

 

Thanks for your contribution.

Omar

 

 

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar