AnsweredAssumed Answered

sd card init problem

Question asked by Tamas Novak on Jan 2, 2015
Latest reply on Jan 4, 2015 by Tamas Novak
My STM32F429 board uses Kingston 4GB uSDHC card. CubeF4v1.3.0 HAL init fails in
SD_PowerON() function in stm32f4xx_hal_sd.c


/* Send CMD55 */
  sdio_cmdinitstructure.Argument         = 0;
  sdio_cmdinitstructure.CmdIndex         = SD_CMD_APP_CMD;
  SDIO_SendCommand(hsd->Instance, &sdio_cmdinitstructure);
 
  /* Check for error conditions */
  errorstate = SD_CmdResp1Error(hsd, SD_CMD_APP_CMD);
 
  /* If errorstate is Command TimeOut, it is a MMC card */
  /* If errorstate is SD_OK it is a SD card: SD card 2.0 (voltage range mismatch)
     or SD card 1.x */
  if(errorstate == SD_OK)
  {
    /* SD CARD */
    /* Send ACMD41 SD_APP_OP_COND with Argument 0x80100000 */
    while((!validvoltage) && (count < SD_MAX_VOLT_TRIAL))
    {
      
      /* SEND CMD55 APP_CMD with RCA as 0 */
      sdio_cmdinitstructure.Argument         = 0;
      sdio_cmdinitstructure.CmdIndex         = SD_CMD_APP_CMD;
      sdio_cmdinitstructure.Response         = SDIO_RESPONSE_SHORT;
      sdio_cmdinitstructure.WaitForInterrupt = SDIO_WAIT_NO;
      sdio_cmdinitstructure.CPSM             = SDIO_CPSM_ENABLE;
      SDIO_SendCommand(hsd->Instance, &sdio_cmdinitstructure);
 

I check SD_CMD and SD_CLK with oscilloscope:

1) 400kHz clock starts,
2) CMD0 then CMD8 sent
3) 200usec no response
4) CMD55 send (payload 0)
5) response after 4 clk cycles:  0x 37 00 80 01 20  04
which is CMD55 response, CRC is x04

If I stop at the breakpoint (red line in code), errorstate variable contains 15: SD_COM_CRC_FAILED.

For me CRC 0000100 seems to be fine for that message, I don't know why "errorstate" fails, but init won't continue with AMCD41...
I've tried it with other 8GB Kingston microSD HD...same thing.
Any idea what can cause this?

Outcomes