MIMXRT1052-EVKB识别SD卡问题

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MIMXRT1052-EVKB识别SD卡问题

3,129 Views
jiangshicong
Contributor III

我自己在做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。

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

谢谢!!!

Tags (1)
0 Kudos
5 Replies

2,609 Views
kerryzhou
NXP TechSupport
NXP TechSupport

楼主你好!

你那边一共几张SD卡?我这边试了三张SD卡,都没问题. 有Sandisk的,还有Samsung的 都可以。

如果你那边板子用的是官方的RT1052-EVKB的话,我可以肯定的说板子是没有问题的。

我建议你再找几张不同品牌的SD卡试试。

另外在插入板子之前,你先做个FAT32的格式化。

pastedImage_14.png

我这边贴出我的测试串口打印结果:

FATFS example to demonstrate how to use FATFS with SD card.

Please insert a card into board.

Card inserted.

Make file system......The time may be long if the card capacity is big.

Create directory......

Create a file in that directory......

Create a directory in that directory......

List the file in that directory......
General file : F_1.DAT.
Directory file : DIR_2.

Write/read file until encounters error......

Write to above created file.
Read from above created file.
Compare the read/write content......
The read/write content is consistent.

Input 'q' to quit read/write.
Input other char to read/write file again.

这个是运行SDK fatfs demo之后的SD卡里面的内容。

pastedImage_15.png

希望能帮到你,如果还有问题,欢迎继续交流。

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

2,609 Views
jiangshicong
Contributor III

您好!谢谢您的热心帮助。你说的对,官方开发板是可以正常识别SD卡的。而我用的是自己按照开发板原理图画的板子,不是官方的开发板,我现在就是不知道会是什么硬件问题,会导致SD卡识别错误呢???

0 Kudos

2,609 Views
kerryzhou
NXP TechSupport
NXP TechSupport

那么你自己的板子其他简单的代码是否能跑起来?

你SD卡那边的原理图分享出来看看呢。

0 Kudos

2,609 Views
jiangshicong
Contributor III

其它程序是可以正常运行的。就是SD卡这部分有问题。下面是我自己画的原理图:

微信图片_20190222171456.png

下面是官方开发板的SD卡部分原理图:

微信图片_20190222171511.png

0 Kudos

2,609 Views
kerryzhou
NXP TechSupport
NXP TechSupport

那你外部跳线接上试试看,是否能工作?

0 Kudos