【iCore4 双核心板_ARM】例程十三:SDIO实验——读取SD卡信息
实验现象:
核心代码:
int main(void) { system_clock.initialize(); led.initialize(); usart6.initialize(115200); usart6.printf("\x0c"); usart6.printf("\033[1;32;40m"); usart6.printf("Hello, I am iCore4!\r\n\r\n\r\n"); if(BSP_SD_Init() != 0){ usart6.printf("SD ERROR!\r\n"); while(1){ LED_RED_ON; HAL_Delay(500); LED_RED_OFF; HAL_Delay(500); } } BSP_SD_GetCardInfo(&SDCardInfo); switch(SDCardInfo.CardType){ case CARD_SDSC:usart6.printf("SD CardType\t\t: CARD_SDSC\r\n");break; case CARD_SDHC_SDXC:usart6.printf("SD CardType\t\t: CARD_SDHC_SDXC\r\n");break; case CARD_SECURED:usart6.printf("SD CardType\t\t: CARD_SECURED\r\n");break; } switch(SDCardInfo.CardVersion){ case CARD_V1_X:usart6.printf("SD CardVersion\t: CARD_V1_X\r\n");break; case CARD_V2_X:usart6.printf("SD SD CardVersion\t: CARD_V2_X\r\n");break; } usart6.printf("SD CardCapacity\t\t: %dMB\r\n",(unsigned int)(SDCardInfo.BlockNbr * SDCardInfo.BlockSize) >> 20); usart6.printf("SD BlockSize\t\t: %dByte\r\n",SDCardInfo.BlockSize); usart6.printf("SD RelCardAdd\t\t: %d\r\n",SDCardInfo.RelCardAdd); while(1){ LED_GREEN_ON; HAL_Delay(500); LED_GREEN_OFF; HAL_Delay(500); } }
源代码下载链接:
链接:https://pan.baidu.com/s/1nwsI8HF 密码:0imt
iCore4链接: