Skip to main content
MK..1
Associate III
February 11, 2024
Solved

problem porting SDMMC EMMC sleep/awake cmd to SDIO

  • February 11, 2024
  • 1 reply
  • 1696 views

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);

Best answer by Saket_Om

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().

1 reply

Technical Moderator
April 30, 2024

Hello @MK..1 

 

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

.

 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
MK..1
MK..1Author
Associate III
April 30, 2024

Hi

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

Saket_OmBest answer
Technical Moderator
May 2, 2024

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().

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om