一 文档描述 最近在恩智浦官方发现有些网友在使用LPCXpressoLPC4337 以及LPCXpressoLPC43S67板子,结合外设板OM13082revB,运行官方lpcopen中的perph_sdmmc例程的时候,串口打印信息总是失败: Initializing RTC (might take few seconds)...Done Hello NXP Semiconductors ***SDCARD demo*** Opening MESSAGE.TXT from SD Card...Card Acquirefailed... Failed. Failed with rc=3. Done. Printing contents of MESSAGE.TXT... Failed with rc=9. Close the file. Failed with rc=9. Create a new file (hello.txt). Card Acquire failed... Failed with rc=3. Write text data "Hello world!" to HELLO.TXT Failed with rc=9. 0 bytes written. Close the file. Failed with rc=9. Open root directory. 二,解决方案 经过检查与测试,发现这个问题不是软件问题,而是外设板硬件问题导致,外设板上面的SD卡槽中引脚4VDD没有3.3V电源。所以需要外部跳线,连接SD卡槽引脚4和3.3V电源,具体连接方法如下图所示: SD pin4连接CN7pin12。 为了便于大家辨识SD大卡卡槽引脚,这里同时附上SD卡槽引脚图:
连线之后,插入SD大卡,再次测试lpcopen的SDMMC例程,可以正确运行代码,因为例程首先只读SD卡中的MESSAGE.txt文件,所以如果在SD卡中预先放入一个MESSAGE.TXT,会使程序读取成功,然后再在SD卡中新建一个hello.txt的文件,并在文件中写入hello.txt字样。 硬件修改后,打印结果如下: Initializing RTC (might take few seconds)...Done Hello NXP Semiconductors ***SDCARD demo*** Opening MESSAGE.TXT from SD Card...Done. Printing contents of MESSAGE.TXT... MESSAGE.TXTClose the file. Create a new file (hello.txt). Write text data "Hello world!" to HELLO.TXT 14 bytes written. Close the file. Open root directory. Directory listing... 14 HELLO.TXT 11 MESSAGE.TXT Test completed. 拔出SD之后,检查SD卡中内容如下:
希望这个解决方案,能够帮助遇到类似问题的网友节约时间。 |