2017-12-02 07:56 AM
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 ?
Solved! Go to Solution.
2017-12-07 06:34 PM
[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);}2017-12-02 10:22 AM
Well DMA is highly desirable if you want to hit 10MBps numbers AND do useful work
2017-12-02 11:50 AM
The problem is that DMA is mandatoty if freeRTOS is enable, if I disable the DMA stm32cube launch a error
2017-12-02 12:20 PM
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.
2017-12-02 09:52 PM
Create message queue before using FATFs driver, CubeMX won't do everything for you. It will work if you understand how the driver works.
2017-12-03 10:53 AM
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.
2017-12-03 01:00 PM
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.
2017-12-03 02:05 PM
Do you want to use DMA or no ? What platform are you using ?
2017-12-03 02:26 PM
with DMA, Keil or SW4STM32 ( I prefer ), I have stm32f4 discovery board and stm32f429 DISCO
2017-12-04 11:09 AM
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:)