Skip to main content
Mateusz Mróz
Associate
February 21, 2018
Solved

F7 and FatFS with uSD card driver linking problem

  • February 21, 2018
  • 1 reply
  • 674 views
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
This topic has been closed for replies.
Best answer by Mateusz Mróz
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.

1 reply

Mateusz Mróz
Mateusz MrózAuthorBest answer
Associate
February 21, 2018
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.