Hi Experts,
I using SDSPI_open() for DK-TM4C129X to mount the SD card. The function return a positive value even if there is no SD card in the board.
My question is: Is there any way to detect whether SD card is mounted in the System ? Or is there any way to detect SD card is working properly ?
Below is the code for your ref:
// Global Variable starts
SDSPI_Handle g_sdCardFd = NULL;
// Global Variable ends
bool mountSD()
{
if(!g_sdCardFd)
{
/* Mount and register the SD Card */
SDSPI_Params_init (&g_sdCardFdParams);
g_sdCardFd = SDSPI_open (Board_SDSPI0, DRIVE_NUM, &g_sdCardFdParams);
if (g_sdCardFd == NULL) {
Error_Block eb;
Error_init(&eb);
Error_raise(&eb, Error_E_generic, "\n%s: Mounting SD card", __FUNCTION__);
return false;
}
else {
print("\n%s:Drive %u is mounted", __FUNCTION__,DRIVE_NUM);
}
}
return true;
}