cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube_FW_F4_V1.18.0 + SDIO + FATFS R0.12c doesn't work

Roberto Roman
Associate II
Posted on December 02, 2017 at 16:56

I tried to use the FAT file system with a SD card and the SDIO protocol, but with the v1.18.00 of stm32Cube for F4 MCU's doesn't work correctly, I discovered the next issues.

1.-  Inside of the FATFS configuration if the DMA tamplate is enable this module doesn't work

2.-   BSP_SD_Init() isn't called nowhere endded I need to call manually after  MX_FATFS_Init().

3.- DMA template is mandatory if FreeRTOS is enable.

Now, this issues didn't watch in the version v1.17.00 of 

stm32Cube for F4. The same programe is funcional in this version but not in the v1.18.00. 

Any idea regarding this topic? Is necessary to enable the DMA module to work with the protocol SDIO ?

1 ACCEPTED SOLUTION

Accepted Solutions
Roberto Roman
Associate II
Posted on December 08, 2017 at 03:34

[Solution]

-----------------------------------------------------------   main

.c     

-----------------------------------------------------------

Call this function before  MX_FATFS_Init

 

BSP_SD_Init();

>>>>>>>>>>>>

This part if just if you want to use FATfs + FreeRtos

Create a queue with the name of

SDQueueID

example:

osMessageQDef(SDQueueID_, 16, uint32_t);

SDQueueID = osMessageCreate(osMessageQ(SDQueueID_), NULL);

-----------------------------------------------------------

sd_diskio.c 

-----------------------------------------------------------

put the SD QueueID declaration how to extern:   

extern

osMessageQId SDQueueID;

-----------------------------------------------------------sd_diskio.c 

-----------------------------------------------------------

Delete the static in the 

SDQueueID declaration;  

static

 osMessageQId SDQueueID;

>>>>>>>>>>>> 

//void BSP_SD_WriteCpltCallback()

void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)

{

osMessagePut(SDQueueID, WRITE_CPLT_MSG, osWaitForever);

}

//void BSP_SD_ReadCpltCallback()

void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)

{

osMessagePut(SDQueueID, READ_CPLT_MSG, osWaitForever);

}

View solution in original post

34 REPLIES 34
Posted on December 02, 2017 at 19:22

Well DMA is highly desirable if you want to hit 10MBps numbers AND do useful work

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on December 02, 2017 at 19:50

The problem is that DMA is mandatoty if freeRTOS is enable, if I disable the DMA stm32cube launch a error 

Posted on December 02, 2017 at 20:20

I've got a number of successful projects on the F4 series parts using SDIO+DMA, so it's not inherently a problem, but rather a software choice issue.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on December 03, 2017 at 05:52

Create message queue before using FATFs driver, CubeMX won't do everything for you. It will work if you understand how the driver works. 

Posted on December 03, 2017 at 18:53

Hello ChrisH, I tried to creating a 

queue before 

FATFs driver but, this isn't the problem. The problem is that the callbacks of :

BSP_SD_WriteCpltCallback()

BSP_SD_ReadCpltCallback()

isn't called nowhere, thus I register this callbacks before using a FATFs. Let me make any tests more and shared with the community my solution after that.

smeric
Associate II
Posted on December 03, 2017 at 22:00

I have also has same problem. when I try with with STM32Cube_FW_F4_V1.18.0 + SDIO + FATFS R0.12c SDID 1bit is not work but 1.12 is working so I did not understand why ? anyone can do and share a base project ? my proect is giving hadware error when f_open function calling. 

best regards.

Posted on December 03, 2017 at 22:05

Do you want to use DMA or no ? What platform are you using ?

Posted on December 03, 2017 at 22:26

with DMA, Keil or SW4STM32 ( I prefer ), I have stm32f4 discovery board and stm32f429 DISCO 

Posted on December 04, 2017 at 19:09

Try to comment out those callbacks in bsp_driver_sd.c, even though they are decleared __weak sometimes in my case compiler wouldn't link proper functions from the driver don't know why. Do you have correct configuration of NVIC priorities(SDIO IRQn with higher priority than DMA IRQn)? Also remember to set DMA properly (change DMA direction before initiating transfer), lastly use only one DMA channel/stream since you can't have concurrent read and write operations:)