cancel
Showing results for 
Search instead for 
Did you mean: 

SDIO FatFs sometimes returns FR_DISK_ERR

jiri
Associate II
Posted on June 18, 2015 at 21:36

Hi. I used HAL drive and example from STM32Cube_FW_F4_V1.6.0 on Open429I HW. 

FatFs reading file from SD card via SDIO sometimes returns FR_DISK_ERR. After the reset program reads four files. Usually it finish OK. Sometimes first or second or third ... returns error. The MCU is to 168MHz clocked. PullUp rezistor 10k are connect on all lines. I tried SDIO_TRANSFER_CLK_DIV set from 0x00 to 0x01 or 0x02. Without result. I use 4GB or 16GB microSD card. When I set 1 bit transfer, program works 100% correctly. Thank you for all stimulating ideas.

(For interest reading 4 files from SD card to SDRAM with the total size 1 105 kB persist 0.451s (1 wire) or 0.162s (4 wire).) JS

#stm32 #fatfs #sdio #sd
4 REPLIES 4
kpavlata9
Associate II
Posted on June 19, 2015 at 11:02

Hi, similar problem here but regarding write operation. I'm using one bit mode and the problem manifest itself as well. At first I thought it's too high freq over long connection cables so I lowered it to 1MHz but still the problem persisted. In my case it all comes down to CRC error on data and the condition not being handled properly in the driver. The card stays in the receiving mode, the current transfer is not aborted properly and the subsequent write attempts fail with the error you mention (sd status is not OK but BUSY, but the driver makes no distinction between BUSY and ERROR). Try to look if similar thing does not happen for your read operation. My cabling is a bit crappy, so I suppose on the PCB this should not happen but I don't want to rely on that and try to figure out the solution.

br

karel

petr
Associate II
Posted on June 20, 2015 at 14:08

Dobrý den pánové,

i had different problem with SD but if i change GPIO settings for SDIO to GPIO_InitStruct.Pull = GPIO_PULLUP than all problem solved

jiri
Associate II
Posted on June 22, 2015 at 09:35

Zdrav�ko, ve spolek. ;)

Hi, i have set SDIO outputs as PullUp & lines are short:

  GPIO_Init_Structure.Mode      = GPIO_MODE_AF_PP;

  GPIO_Init_Structure.Pull      = GPIO_PULLUP;

  GPIO_Init_Structure.Speed     = GPIO_SPEED_HIGH;

  GPIO_Init_Structure.Alternate = GPIO_AF12_SDIO;

...and what problem you had with SD? JS