AnsweredAssumed Answered

SDIO Bit Start Error with STM32F407VGT6 and STM32CubeMX

Question asked by Silas on Jan 11, 2015
Latest reply on Jan 12, 2015 by g.daniel
I'm having problems with communication through SDIO. In the initialization process, where are only sent commands, everything works, but the function HAL_SD_SendSDStatus is returning SD_START_BIT_ERR.

Informations about the circuit and firmware:
-STM32CubeMX v4.5.0 and STM32F4 library v1.3.0
-Clock always 400kHz (to ensure that I will not have problems with the bus speed in the tests)
-It uses the internal pull-up of the microcontroller
-Several sd cards were tested, all of them >=4GB and >=class 4, with FAT32

After debugging, I found that the problem happens in the code snippet (below) of the file stm32f4xx_hal_sd.c within the HAL_SD_SendSDStatus function:

    /* Configure the SD DPSM (Data Path State Machine) */
    sdio_datainitstructure.DataTimeOut = SD_DATATIMEOUT;
    sdio_datainitstructure.DataLength = 64;
    sdio_datainitstructure.DataBlockSize = SDIO_DATABLOCK_SIZE_64B;
    sdio_datainitstructure.TransferDir = SDIO_TRANSFER_DIR_TO_SDIO;
    sdio_datainitstructure.TransferMode = SDIO_TRANSFER_MODE_BLOCK;
    sdio_datainitstructure.DPSM = SDIO_DPSM_ENABLE;
    SDIO_DataConfig(hsd->Instance, &sdio_datainitstructure);

    /* Send ACMD13 (SD_APP_STAUS)  with argument as card's RCA */
    sdio_cmdinitstructure.Argument = 0;
    sdio_cmdinitstructure.CmdIndex = SD_CMD_SD_APP_STAUS;
    SDIO_SendCommand(hsd->Instance, &sdio_cmdinitstructure);

Before call the SDIO_DataConfig function, the SDIO_STA register is 0, after call this function, the bits RXFIFOE and RXACT goes to 1, what is expected. After call the function SDIO_SendCommand with the command ACMD13, the bits RXFIFOE and RXACT goes to 0 and the bits STBITERR and CMDREND goes to 1. Here is where the problem happens.

Could anyone help me with this?