AnsweredAssumed Answered

MIMXRT1052-EVKB识别SD卡问题

Question asked by 仕聪 蒋 on Feb 21, 2019
Latest reply on Feb 22, 2019 by Kerry Zhou

我自己在做SD卡识别时遇到一个问题,使用官方SDK包里面的样例fatfs_examples。下载程序到板子上,按复位键运行程序后,在格式化SD卡时报错,错误码为3(The physical drive cannot work),可是我单步运行时,又没有报错,而是在创建目录时报错,最终定位到下面函数:

bool SDMMCEVENT_Wait(sdmmc_event_t eventType, uint32_t timeoutMilliseconds)
{
uint32_t startTime;
uint32_t elapsedTime;

volatile uint32_t *event = SDMMCEVENT_GetInstance(eventType);

if (timeoutMilliseconds && event)
{
startTime = g_eventTimeMilliseconds;
do
{
elapsedTime = (g_eventTimeMilliseconds - startTime);
} while ((*event == 0U) && (elapsedTime < timeoutMilliseconds));
*event = 0U;

return ((elapsedTime < timeoutMilliseconds) ? true : false);
}
else
{
return false;
}
}

此函数最终返回的是false。

想问一下各位大神,有没有遇到这样的问题,应该怎么解决。硬件会有问题吗??

谢谢!!!

Outcomes