2015-06-19 03:28 PM
Hello,
i have a little problem with SDHC card via SDIO. I use 3 types of sd cards, all works but with one type i have problem. When i mount sd and immediately start write or read, all is ok, but when add some pause between reading or writing (cca > 50ms) i get from Fatfs DISK IO Error. Problem is in function HAL_SD_ReadBlocks: /* Set Block Size for Card */ sdio_cmdinitstructure.Argument = (uint32_t) BlockSize; sdio_cmdinitstructure.CmdIndex = SD_CMD_SET_BLOCKLEN; sdio_cmdinitstructure.Response = SDIO_RESPONSE_SHORT; sdio_cmdinitstructure.WaitForInterrupt = SDIO_WAIT_NO; sdio_cmdinitstructure.CPSM = SDIO_CPSM_ENABLE; SDIO_SendCommand(hsd->Instance, &sdio_cmdinitstructure); /* Check for error conditions */ errorstate = SD_CmdResp1Error(hsd, SD_CMD_SET_BLOCKLEN); if (errorstate != SD_OK) { return errorstate; //Here i get Timeout } Others Card works fine (different company) PS: i use HAL library with DMA transfer created in STM32CubeMx. Thank You #sd-card #sdio-sdhc-stm322015-06-19 04:35 PM
Card may have a low power mode, check SD/MMC specs to see if there is a magic sequence to awaken. Check the parameter blocks returned by the card, size, features, etc.
Does the command succeed if retried? or are you dead in the water?The stack implements no error recovery or retry strategy, if this is a commercial system consider robustness issues. The code examples are provided as is, for demonstrational purposes.Not a HAL/Cube user.2015-06-20 03:54 AM
Problem solved. It was error between chair and keyboard. If you have same problem, change GPIO settings for SDIO to GPIO_InitStruct.Pull = GPIO_PULLUP.
Thank you2015-06-20 06:52 AM
A lot of designs have external pull-ups.