Page 1 of 1

Problem with SDMMC interface CMD55?

Posted: Wed Aug 04, 2021 1:40 pm
by Bambo
Hi,

I'm currently working on a project that uses a MicroSD SDHC card as its storage.

At the moment i'm having problems with initializing SD cards. Sometimes the SD will initialize ok but other times the same cards won't. I've pinned the bug down to a particular line of code but I am having no luck apply fixes i find online.

The bug is here: https://github.com/stm32duino/Arduino_C ... sd.c#L3546. The line "errorstate = SDMMC_CmdAppCommand(hsd->Instance, 0);" is returning 4, but it makes no sense because that command is ran a couple statements before here https://github.com/stm32duino/Arduino_C ... sd.c#L3534 and that returns no errors.

So in summary when the second CMD55 is sent, it returns an error but the first time it does not.

Some references:
1. https://community.st.com/s/question/0D5 ... er-acmd-41
2. https://community.st.com/s/question/0D5 ... ue-stm32l4

Can anyone help me figure this out?

Thanks!

Re: Problem with SDMMC interface CMD55?

Posted: Wed Aug 04, 2021 3:05 pm
by Bambo
Update:

I've configured the SDMMC clock to be 8MHz and starting with a clock div of 78 to bring it to 100KHz for initialization but it doesn't seem to affect it.