cancel
Showing results for 
Search instead for 
Did you mean: 

F7 and FatFS with uSD card driver linking problem

Mateusz Mróz
Associate II
Posted on February 21, 2018 at 23:29

Hi.

I've been struggling for couple days to implement micro SD card into my project. I click everything through CubeMX 4.24 with CubeF7 v 1.9.0. 4-bits SDIO, SDIO global interrupt and 2 DMA Channels for RX and TX. FatFS default.

I moved to F746G discovery board to eliminate possible hardware problems but still couldn't manage to get the FatFS working.

When i manually BSP_SD_init(); i get correct cardinfo, capacity and things...

I also did testing procedure:

BSP_SD_WriteBlocks_DMA(..)

BSP_SD_ReadBlocks_DMA(..)

BSP_SD_Erase(..)

BSP_SD_ReadBlocks_DMA(..)

with a success.

But when i run project almost straight from the CubeMX i get empty cardinfo as probably fatfs does not init the sdcard. f_mounts doesn't return errors. It hangs/timouts on f_mkfs or f_open if i omit mkfs and format the card externally (FAT32). I've tried many various fatfs examples with the same results.

Any known problems or possible configuration advices?

#sdcard #stm32-f7 #sdio #fatfs
1 ACCEPTED SOLUTION

Accepted Solutions
Mateusz Mróz
Associate II
Posted on February 22, 2018 at 00:52

Ok. I've overcome this problem:

I did define:

void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd){ BSP_SD_ReadCpltCallback(); }

void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd){ BSP_SD_WriteCpltCallback(); }

ofc, with additional BSP Callbacks declarations.

and added:

BSP_SD_Init();

before MX_FATFS_Init();

And that should be all.

View solution in original post

1 REPLY 1
Mateusz Mróz
Associate II
Posted on February 22, 2018 at 00:52

Ok. I've overcome this problem:

I did define:

void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd){ BSP_SD_ReadCpltCallback(); }

void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd){ BSP_SD_WriteCpltCallback(); }

ofc, with additional BSP Callbacks declarations.

and added:

BSP_SD_Init();

before MX_FATFS_Init();

And that should be all.