求教:5509A读取SD卡阻塞
时间:10-02
整理:3721RD
点击:
SD卡是1G的FAT32格式的
我是调用CSL库函数进行操作的,在例程中加入MMC_read函数程序貌似就卡住了,查看了下网上的资料感觉像是阻塞,具体现象如下:正常现象:
MMC Controller setup test...
SD card found
Asking SD card for its RCA...
RCA sent is 0xb368
Initialized card successfully
TEST PASSED
加了MMC_read函数的现象
MMC Controller setup test...
SD card found
Asking SD card for its RCA...
RCA sent is 0x
程序代码:
void main()
{
Uint16 mybuf[256],i,mybuf1[256];
CSL_init();
PLL_config(&myConfig);
printf ("MMC Controller setup test...\n");
mmc0 = MMC_open(MMC_DEV1);
MMC_setupNative(mmc0,&Init); //initialize the MMC controller
// MMC_getConfig(mmc0,&test);
MMC_sendGoIdle(mmc0); //Sends a broadcast GO_IDLE command
for (count=0;count<4016;count++)
asm(" NOP");
cardtype = MMC_sendOpCond(mmc0,0x00100000); //Sets the operating voltage window while in Native mode
if (cardtype == 0xFFFF){
printf ("Card not recognized\n");
exit(0);
}
//MMC_setCardType(card, cardtype);
if (cardtype == MMC_CARD){
printf ("Setting 10 as RCA value\n");
cid = &cardid;
/* Instruct all cards to send their Card Identification Data */
MMC_sendAllCID(mmc0,cid); // get the CID structure for all cards.
card = &cardalloc;
//retVal = MMC_setRca(mmc0,card,0x8DAB);
retVal = MMC_setRca(mmc0,card,2);
/* The host can request for the CSD in the standby state. This *
* structure contains the data outlined below */
printf ("Reading CSD structure for MMC card\n");
csd = &cardcsd;
retVal=MMC_sendCSD(mmc0);
MMC_getCardCsd(mmc0, csd);
} else {
printf ("SD card found\n");
cid = &cardid;
/* Instruct all cards to send their Card Identification Data */
SD_sendAllCID(mmc0,cid);
// printf ("The values in the CID of the SD card are:\n");
printf ("Asking SD card for its RCA...\n");
card = &cardalloc;
rca = SD_sendRca(mmc0,card);
printf ("RCA sent is 0x%x\n", rca);
/* The host can request for the CSD in the standby state. This *
* structure contains the data outlined below */
retVal = MMC_sendCSD(mmc0);
// sdcsd = &sdcardcsd;
// SD_getCardCsd(mmc0, sdcsd);
}
retVal = MMC_selectCard(mmc0,card);
MMC_read(mmc0,0x238200,mybuf,256);
for(i=0;i<6000;i++);
printf ("Initialized card successfully\n");
printf ("TEST PASSED\n");
while(1);
}