补录:
便于各位自行定位问题所在, 这里给出我的SD卡读取代码, 如果这部分可以正常工作, 就不要在SD卡上面浪费时间了, 不是SD卡的问题 uint64_t CardCap; //SD卡容量
HAL_SD_CardCIDTypeDef SDCard_CID;
HAL_SD_CardInfoTypeDef SDCardInfo;
SD_Driver.disk_initialize(0);
HAL_SD_GetCardCID(&hsd1,&SDCard_CID); //获取CID
HAL_SD_GetCardInfo(&hsd1,&SDCardInfo); //获取SD卡信息
CardCap=(uint64_t)(SDCardInfo.LogBlockNbr)*(uint64_t)(SDCardInfo.LogBlockSize); //计算SD卡容量
uart_printf("Card ManufacturerID: %d \r\n",SDCard_CID.ManufacturerID); //制造商ID
uart_printf("CardVersion: %d \r\n",(uint32_t)(SDCardInfo.CardVersion)); //卡版本号
uart_printf("Class: %d \r\n",(uint32_t)(SDCardInfo.Class)); //
uart_printf("Card RCA(RelCardAdd):%d \r\n",SDCardInfo.RelCardAdd); //卡相对地址
uart_printf("Card BlockNbr: %d \r\n",SDCardInfo.BlockNbr); //块数量
uart_printf("Card BlockSize: %d \r\n",SDCardInfo.BlockSize); //块大小
uart_printf("LogBlockNbr: %d \r\n",(uint32_t)(SDCardInfo.LogBlockNbr)); //逻辑块数量
uart_printf("LogBlockSize: %d \r\n",(uint32_t)(SDCardInfo.LogBlockSize)); //逻辑块大小
uart_printf("Card Capacity: %d MB\r\n",(uint32_t)(CardCap>>20)); //卡容量
|