cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f4xx_hal_sd. c error

gb
Associate
Posted on June 28, 2016 at 10:05

Hi! I have a problem with SD card

I write a file every second (30 byte added at the end of file) (SDcard @ 4MHz clock 4 wire) and sometimes, when firmware enters in HAL_SD_ReadBlocks function, it blocks  at this stage

/* Poll on SDIO flags */

#ifdef SDIO_STA_STBITERR

    while(!__HAL_SD_SDIO_GET_FLAG(hsd, SDIO_FLAG_RXOVERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_DATAEND | SDIO_FLAG_STBITERR))

#else /* SDIO_STA_STBITERR not defined */

    while(!__HAL_SD_SDIO_GET_FLAG(hsd, SDIO_FLAG_RXOVERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_DATAEND))

#endif /* SDIO_STA_STBITERR */

    {

      if (__HAL_SD_SDIO_GET_FLAG(hsd, SDIO_FLAG_RXFIFOHF))

      {

   

why this behaviour ? Why FLAG RXFIFOHF isn't update?

I have also another block at 

 

static HAL_SD_ErrorTypedef SD_CmdResp1Error(SD_HandleTypeDef *hsd, uint8_t SD_CMD)

{

  HAL_SD_ErrorTypedef errorstate = SD_OK;

  uint32_t response_r1;

 

  while(!__HAL_SD_SDIO_GET_FLAG(hsd, SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT))

 

  {

 

  }

 

 this flag aren't update and I remain here forever: how is it possible? Why in a library I have a blocking cycle?

 

 

Thank you very much

 

 

1 REPLY 1
Walid FTITI_O
Senior II
Posted on June 29, 2016 at 12:47

Hi rossi.giovanni,

Please give more details about : Hardware/device are you using and the Hal library / STM32Cube versions you have used ?

-Hannibal-