Hi,
I am working on quite complex project, core of this project is FreeRTOS with TI-POSIX wrapper and simplelink SDK. Our application uses SD card and Chan's FATFS for some application specific stuff. Unfortunately, card detect pin from SD slot is not connected to any GPIO, so to see if there is any memory card inserted we periodically try to mount fatfs() to see if SD card is available. In general case what is happening under the hood is that
1) SD_Open() is called.
2) f_mount() is called and from within this function FatFS glue function to initialize the storage device is called. From within this function SD_initialize() is called and based on it's result we decide whether SD card is available or not.
3) If mounting failed (for instance, because card is not available), then SD_Close() is called
4) After mounting failure wait for 60 seconds and go to step 1.
In general this approach works good with SD host driver from TI SDK version 3.something and with fixes that we've introduced previously (this and this). But in updated TI SKD (5.10) we discovered that (except everything else) following lines were added to initHwFunction
/* Store current clock configuration */
clockcfg = HWREG(ARCM_BASE + APPS_RCM_O_MMCHS_CLK_GEN);
/*
* Set PLL CLK DIV to 8 in order to get 80KHz clock freuqnecy. The
* requirement to wake up the card with the initialization stream
* is 80 clock cycles in 1ms.
*/
HWREG(ARCM_BASE + APPS_RCM_O_MMCHS_CLK_GEN) |= PLL_CLK_DIV8;
/* Set clock frequency to 80KHz for initialization stream */
MAP_SDHostSetExpClk(hwAttrs->baseAddr,
MAP_PRCMPeripheralClockGet(PRCM_SDHOST), SD_INIT_FREQ_80KHZ);
/* Enable SD initialization stream */
HWREG(hwAttrs->baseAddr + MMCHS_O_CON) |= SD_INIT_STREAM;
/* Dummy command to send out the 80 clock cycles */
send_cmd(handle, DUMMY, DUMMY);
/* End SD initialization stream */
HWREG(hwAttrs->baseAddr + MMCHS_O_CON) &= ~SD_INIT_STREAM;
/* Reset clock cfg to initial cfg */
HWREG(ARCM_BASE + APPS_RCM_O_MMCHS_CLK_GEN) = clockcfg;
/*
* Configure the card clock to 400KHz for the card initialization and
* idenitification process. This is done to ensure compatibility with
* older SD cards. Once this is complete, the card clock will be
* reconfigured to the set operating value.
*/
MAP_SDHostSetExpClk(hwAttrs->baseAddr,
MAP_PRCMPeripheralClockGet(PRCM_SDHOST), SD_ID_FREQ_400KHZ);
MAP_SDHostIntClear(hwAttrs->baseAddr, SDHOST_INT_CC | SDHOST_INT_TC |
DATAERROR | CMDERROR | SDHOST_INT_DMAWR | SDHOST_INT_DMARD |
SDHOST_INT_BRR | SDHOST_INT_BWR);
And it works good when card is inserted, but what is happening with this code is that it hangs if we try to call SD_Open() without card in SD slot in following while loop
This is what part of the call stack looks like:

I am not sure why it is happening, but it seems to me like there is some sort of hardware issue within SD host driver silicon module.
Maybe TI experts could clarify what is going on and if we can somehow fix this state?



