2024-08-08 04:47 AM - last edited on 2024-08-19 03:28 AM by Peter BENSCH
Hi,
We are working on a low power application which uses an emmc memory. Now we have problem when Deinit mmc driver. When mmc is disabled we have a base consumption of XXuA (stop 2 power mode) but when it is needed mmc must be enabled (using Init functions from HAL) and then disabled again (using DeInit functions from HAL). after this process it is not possible to reach again XXuA, a 8mA are added to the base consumption. Is it needed to add some deinit function to the system or must we disable (forced) some clocks or internal supplies to asure de-initialization of mmc driver?
Thanks
2024-08-12 07:52 AM
Welcome @cgamu, to the community!
It would help potential helpers a little, if you could provide a few general conditions:
Regards
/Peter
2024-08-19 03:13 AM - last edited on 2024-08-19 03:30 AM by Peter BENSCH
Hi @Peter BENSCH ,
Thanks for your suggestions.
MCU: STM32U585VIT6
eMMC: ASFC4G31M-51BIN
Supply: 3V
Lines connected to uC:
CODE:
static RetVal_t SDMMC1_MMC_Init(void)
{
RetVal_t result = IDN_OK;
hmmc1.Instance = SDMMC1;
hmmc1.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
hmmc1.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
hmmc1.Init.BusWide = SDMMC_BUS_WIDE_8B;
hmmc1.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
hmmc1.Init.ClockDiv = 2;
if (HAL_MMC_Init(&hmmc1) != HAL_OK)
{
HAL_MMC_DeInit(&hmmc1);
result = ERROR;
initialized = FALSE;
}
else
{
initialized = TRUE;
}
return result;
}
RetVal_t SD_hm_init(void)
{
RetVal_t result = OK;
hal_gpio_request_info_t gpio_info;
gpio_info.port = PWR_FLASH_EN_Port;
gpio_info.pin = PWR_FLASH_EN_Pin;
gpio_info.mode = GPIO_MODE_OUTPUT_PP;
gpio_info.pull = GPIO_NOPULL;
GPIO_Request(&gpio_info);
GPIO_WritePin(PWR_FLASH_EN_Port, PWR_FLASH_EN_Pin, GPIO_SET);
if (SDMMC1_MMC_Init() != OK) {
result = ERROR;
}
else
{
}
HAL_MMC_CardInfoTypeDef mmc_info;
HAL_MMC_GetCardInfo(&hmmc1, &mmc_info);
sdmmc_info.BlockSize = mmc_info.BlockSize;
sdmmc_info.NumBlocks = mmc_info.BlockNbr;
return result;
}
RetVal_t SD_hm_deInit(void)
{
RetVal_t result = OK;
HAL_MMC_DeInit(&hmmc1);
HAL_GPIO_WritePin(PWR_FLASH_EN_Port, PWR_FLASH_EN_Pin, GPIO_RESET);
HAL_GPIO_Release(PWR_FLASH_EN_Port, PWR_FLASH_EN_Pin);
return result;
}
Hope this helps,