TI中文支持网
TI专业的中文技术问题搜集分享网站

求教:5509A读取SD卡阻塞

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);

}

Shine:

C5509A CSL不支持SDHC FAT32格式。

user4731232:

回复 Shine:

那请问下我在格式化SD卡时,需要格式化成什么格式?我是win10系统,可选的格式化的文件格式是1、NTFS 2、FAT(默认) 3、FAT32 4、exFAT

我看了下我的SD卡,是1GB的,应该不是SDHC吧

Shine:

回复 user4731232:

对,你的卡1GB不是SDHC,选择2. FAT(默认) 。

user4731232:

回复 Shine:

将SD卡格式化为FAT(默认),分配单元大小选为16KB和默认配置大小分别尝试了下,还是之前的现象

MMC Controller setup test…SD card foundAsking SD card for its RCA…RCA sent is 0x 

请问下该怎么办?

Shine:

回复 user4731232:

csl里的read_write例程可以运行吗?

你是加了MMC_read函数程序才会出错?

user4731232:

回复 Shine:

是的,加了

  MMC_read(mmc0,0x421600,mybuf,512);  for(i=0;i<6000;i++);

这两句话就出现不能正常printf了,注释掉就好了

请问下csl的read_read例程在哪?我用的是CCS6.1

user4731232:

回复 Shine:

我的例程是开发板提供的,我也看了下网上的资料,也是这样操作的。加断点跑,直接跑不到这句话就停下了

加大heap size, stack size果然好了,非常感谢您

赞(0)
未经允许不得转载:TI中文支持网 » 求教:5509A读取SD卡阻塞
分享到: 更多 (0)