AnsweredAssumed Answered

CubeMX - FatFS - SDIO not working

Question asked by eigerMount on Jul 9, 2014
Latest reply on Mar 13, 2017 by Stephen.Ryan
Hello,

I'm trying to make working the fatFS thought SDIO-4bits but I have the same problem on 2 different boards (devkit and custom board with STM32F437).

All the code is generated by cubeMX (v4.3, firmware 1.3).

The MX_SDIO_SD_Init(); function executes with no errors. Before the init the clock is 400kHz and then 25MHz. I modified a #define to reduce the clock speed to 400kHz to remove potential signal integrity errors.

After the init the HAL_SD_GetStatus(&hsd); returns SD_TRANSFER_OK.

But all others functions (HAL_SD_GetCardStatus(), HAL_SD_ReadBlocks(), HAL_SD_WriteBlocks(), f_mount()) loop indefinitely in a while : 


HAL_SD_SendSDStatus(...)
{
...
  /* Get status data */
  while(!__HAL_SD_SDIO_GET_FLAG(hsd, SDIO_FLAG_RXOVERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_DBCKEND | SDIO_FLAG_STBITERR))
  {
    if (__HAL_SD_SDIO_GET_FLAG(hsd, SDIO_FLAG_RXFIFOHF))
    {
      for (count = 0; count < 8; count++)
      {
        *(pSDstatus + count) = SDIO_ReadFIFO(hsd->Instance);
      }
      
      pSDstatus += 8;
    }   
  }
  }
...
}


I have also tried to make the SDIO 1 bit wide only, the problem persist. Optimisations are desactivated.

Any ideas ?

Outcomes