AnsweredAssumed Answered

STM32CubeMX FATFS SD card re-insert

Question asked by Kolomaznik.Petr.001 on May 11, 2016
Latest reply on May 13, 2016 by Kolomaznik.Petr.001
Does anybody know how to solve the re-inserting the SD card ? I have a project generated by STM32CubeMX. I have used it for re-inserting the SD card this function:

if (CD_CARD == b_cd)
{
  if (CD_NO_CARD == b_cd_last)
  {                               /* insert */
    res = f_mount(&SDFatFs, (TCHAR const*)SD_Path, 0);
    if (res == FR_OK)
    {
      App_Clear_Error(ERR_SD_INIT);
    }
    else
    {
      App_Set_Error(ERR_SD_INIT);
    }
  }
}
else
{
  if (CD_CARD == b_cd_last)
  {                               /* eject */
     res = f_mount(NULL, (TCHAR const*)SD_Path, 0);
     App_Set_Error(ERR_SD_INIT);
  }
}
b_cd_last = b_cd;

Card operations as f_open after re-inserting the sd card do not work.

Outcomes