FW v1.16.1 broke HAL MMC Driver
Using a custom board with an STM32F769 I had successfully interfaced to an eMMC with the HAL-MMC driver. The limitations of the driver's ability to query the extended CSD were clearly noted on this forum. I implemented my own routines to retrieve this information and correct the block sizes (after HAL_MMC_Init call). After upgrading to F7 FW v1.16.1 (released mid February) I noticed this functionality had been added to the driver itself so I removed my version.
The out of the box driver fails when calling MMC_ReadExtCSD() from HAL_MMC_GetCardCSD() with a command timeout (CTIMEOUT) error. After quite a bit of debuggin I compared the driver to the STM32L series driver and noticed in that version the SDMMC_CmdSelDesel() call was made prior to HAL_MMC_GetCardCSD(). After making the modification the code runs successfully. I'm by no means an SDMMC expert but I believe this fix needs to be made in the next firmware release. I would appreciate ST/Community confirming the issue. The "fixed" and suspect code is below:
/////// Working Code //////////
/* Select the Card */
errorstate = SDMMC_CmdSelDesel(hmmc->Instance, (uint32_t)(((uint32_t)hmmc->MmcCard.RelCardAdd) << 16U));
if(errorstate != HAL_MMC_ERROR_NONE)
{
return errorstate;
}
/* Get CSD parameters */
if (HAL_MMC_GetCardCSD(hmmc, &CSD) != HAL_OK)
{
return hmmc->ErrorCode;
} /////// Suspect Code //////////
/* Get CSD parameters */
if (HAL_MMC_GetCardCSD(hmmc, &CSD) != HAL_OK)
{
return hmmc->ErrorCode;
}
/* Select the Card */
errorstate = SDMMC_CmdSelDesel(hmmc->Instance, (uint32_t)(((uint32_t)hmmc->MmcCard.RelCardAdd) << 16U));
if(errorstate != HAL_MMC_ERROR_NONE)
{
return errorstate;
}