Skip to main content
Explorer
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);

    This topic has been closed for replies.
    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().

    .

     

    MK..1Author
    Explorer
    April 30, 2024

    Hi

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

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