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 ?

34 REPLIES 34
Posted on December 07, 2017 at 22:31

Thx.

Ill take a look at your config and see if it differs for the cube defaults.

I agree i need to walk all the code up to the first read failure.

I get back to you shortly.

Posted on December 08, 2017 at 00:30

fatfs has built in routine to test it: test_diskio

Posted on December 08, 2017 at 01:34

I was thinking of something a bit more rigorous.

That test would be better if it used different data patterns on each run, and tagged each sector uniquely.

I would test FatFs in READONLY mode first with large files containing LFSR data streams, a few dozen lines of code good of megabytes of unique data.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
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);

}
Posted on December 08, 2017 at 03:35

Please check my suggestion 

Posted on December 08, 2017 at 17:15

Work fine, many thanks !!

Posted on January 29, 2018 at 07:39

Roberto's fix to rename the call back functions, along with the fix in the note below got it working for me.

https://community.st.com/0D50X00009bMM8bSAG

 
Posted on January 29, 2018 at 16:50

Hi,

Could you please make a check using last CubeMX version (4.24) and last STM32CubeF4 package version (1.19).

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on January 30, 2018 at 22:16

Hi Amel,

Will I be able to roll back to CubeMX 4.23 if I do so? I'm in the middle of a project and don't want to have to solve other problems if they come up.

Cheers,

Daniel
Posted on January 31, 2018 at 14:34

Hello Atmel, I was testing the new release (1.19), but i discovered new issues, If I try to generate a new project with FreeRTOS some files aren't installed and the project doesn't build