2024-10-01 02:36 AM
Hi
We have some custom hardware which we’re commissioning.
It contains a MMC Device which we’re trying to get working with a Microcontroller.
Currently operation fails at the MMC initialisation stage.
I wonder if you could help us, please?
The MMC device is a Swissbit SFEM032GB2ED1TO-A-5E-111-STD
(which advertises itself as JEDEC e·MMC 5.1 compliant)
The Microcontroller is a STM32F407IGT
(which says “an SD/SDIO/MMC host interface is available, that supports MultiMediaCard System Specification Version 4.2 in three different databus modes: 1-bit (default), 4-bit and 8-bit.)
Please can you tell us whether this combination of Microcontroller and MMC Device should work together in principle, or whether we’ve made a major mistake (in which case any recommendations in terms of a different MMC Device to try [ideally pin compatible])?
Many thanks in advance
Dave
2024-10-01 06:15 AM
By far the most likely scenario is that the two chips work well with each other. The MMC spec has not radically changed, and even if the MMC chip is newer, likely you can use a subset of features which are common to both for communication.
The HAL MMC functions have gotten better over the years, but may not work out of the box for your exact scenario. Likely will take a bit of effort and debugging on your part to get them working. If you can probe signals at the chip level, that can help to demystify things.
2024-10-09 02:04 AM
Hello, thank you for your reply. I am working with David on this issue.
The error comes from the below code inside the HAL_MMC_InitCard() function. Does it give you any clue?
/* Card initialization */
errorstate = MMC_InitCard(hmmc);
if(errorstate != HAL_MMC_ERROR_NONE)
{
hmmc->State = HAL_MMC_STATE_READY;
hmmc->ErrorCode |= errorstate;
return HAL_ERROR;
}
/* Set Block Size for Card */
errorstate = SDMMC_CmdBlockLength(hmmc->Instance, MMC_BLOCKSIZE); // Error got here.
if(errorstate != HAL_MMC_ERROR_NONE)
{
/* Clear all the static flags */
__HAL_MMC_CLEAR_FLAG(hmmc, SDIO_STATIC_FLAGS);
hmmc->ErrorCode |= errorstate;
hmmc->State = HAL_MMC_STATE_READY;
return HAL_ERROR;
}
Thank you
2024-10-09 05:56 AM
What ErrorCode are you seeing? Do you have the ability to view what's happening at the signal level?
2024-10-10 02:19 AM
I got errorcode = 4.
Attached you can find two screenshots. SCR01 after executing
/* Card initialization */
errorstate = MMC_InitCard(hmmc);
I noticed that the clock changes from 400 KHz to 24 MHz at the end.
SCR02 after executing
/* Set Block Size for Card */
errorstate = SDMMC_CmdBlockLength(hmmc->Instance, MMC_BLOCKSIZE);
Could it be a signal integrity issue?
Another matter is that I had to remove the external pull-up on the CMD line, otherwise it would get stacked in "MMC_PowerON(hmmc)". By datasheet, this signal should have a pull-up...
Thank you