cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f4 discovery SDIO write block got cry failed

sprhawk
Associate II
Posted on October 15, 2015 at 16:34

I'm porting SDcard code from FatFS_uSD_FreeRTOS for stm32446_eval in STM32Cube to stm32f4-discovery.

Reading blocks seems fine, but writing blocks failed.

I debugged with GDB. 

when write it returned crc failed.

here is the backtrace:

#0  HAL_SD_WriteBlocks (hsd=0x20001288, pWriteBuffer=0x20000e24, WriteAddr=16384, BlockSize=512,

    NumberOfBlocks=1) at ./st_hal/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c:810

#1  0x0800529c in BSP_SD_WriteBlocks (pData=0x20000e24, WriteAddr=8388608, BlockSize=512,

    NumOfBlocks=1) at bsp/bsp_sd.c:301

#2  0x08017d1a in SD_write (lun=0 '\000', buff=0x20000e24 ''A.'', sector=16384, count=1)

    at ./st_hal/Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:139

#3  0x08011d4a in disk_write (pdrv=0 '\000', buff=0x20000e24 ''A.'', sector=16384, count=1)

    at ./st_hal/Middlewares/Third_Party/FatFs/src/diskio.c:123

#4  0x08012292 in sync_window (fs=0x20000e24) at ./st_hal/Middlewares/Third_Party/FatFs/src/ff.c:784

#5  0x0801231c in move_window (fs=0x20000e24, sector=12596)

    at ./st_hal/Middlewares/Third_Party/FatFs/src/ff.c:812

#6  0x08012618 in get_fat (fs=0x20000e24, clst=88)

    at ./st_hal/Middlewares/Third_Party/FatFs/src/ff.c:924

#7  0x080129b6 in create_chain (fs=0x20000e24, clst=0)

    at ./st_hal/Middlewares/Third_Party/FatFs/src/ff.c:1091

#8  0x08014f98 in f_write (fp=0x20001058, buff=0x20001efc, btw=15, bw=0x20001f10)

    at ./st_hal/Middlewares/Third_Party/FatFs/src/ff.c:2791

#9  0x08005094 in uSD_Thread (argument=0x0) at tasks/mytasks.c:65

1 REPLY 1
sprhawk
Associate II
Posted on October 16, 2015 at 04:57

fixed. I have set a wrong transfer freq