All,

I'm wondering if anyone is successfully using sdmmc on stm32h7 in the current tree (version 13.1.0)

I'm trying to add sdmmc support to newly added stm32h7s8-dk board (based on the newer stm32h7s3l8) and running into SDMMC initialization issues that look to originate in mmcsd_cardidentify() where the initial CMD0 command succeeds(since command went on the wire with no expected response) and the following CMD1 also reports as succeeding (leading mmcsd_cardidentify() to believe the attached card is an MMC card instead of an SD card).

The issue looks to originate from the call to mmcsd_sendcmdpoll(priv, MMC_CMD1, ...) followed by SDIO_RECVR3(...) that returns OK (indicating a response when the attached trace diagram clearly shows at marker 0 that the SDMMC controller floats the CMD line, but the card does not pull it down to initiate a response) I believe the problem is that mmcsd_sendcmdpoll() invokes SDIO_SENDCMD then SDIO_WAITRESPONSE() to get a repsonse, and on return mmcsd_cardidentify() invokes SDIO_RECVR3() to determine if the response is valid.

SDIO_WAITRESPONSE() invokes stm32_waitresponse() which waits for SDMMC_STA to indicate either CTIMEOUT or CCRCFAIL  (0x45) and when it sees 0x40(CTIMEOUT), sets both CTIMEOUT and CRCFAIL bits in SDMMC_ICR to clear the corresponding bits in SDMMC_STA.  Then when SDIO_RECV3() invokes stm32_recvshort(), it checks for CTIMEOUT in SDMMCR_STA (which is now cleared!) and not seeing such extracts a response (0x0 in this case since CMD line never indicated a response) and return OK leading mmcsd_cardidentify() to believe its an MMC card...

I've gone through the TRM for both stm32h7533 and stm32h7s3l8 and outside of SDMMC DMA handling the two controller look close enough that at least for initialization they should act the same.

Any thoughts on how to fix/workaround are most appreciated. Thanks in advanced!

--
Peter Barada
[email protected]

Reply via email to