Skip to main content
lorant124
Associate II
January 3, 2021
Question

STM32L4 RTOS SDCard doesn`t work

  • January 3, 2021
  • 1 reply
  • 579 views

Hi, I have custom HW with STM32L496RGTx. On board I have SD card slot.

I tried HW with CubeMX. Setted SDMMC1 to Mode: SD 1, SD DMA - SDMMC1 and divider to 24. In code I wroted:

FATFS SDFatFs; /* File system object for SD card logical drive */
char SDPath[4]; /* SD card logical drive path */
FIL Test_File; /* File object */
char SD_File_name[22];
uint8_t res = 0;
...
 
void main(void) {
...
res = f_mount(&SDFatFs, (TCHAR const*)SDPath, 0);
sprintf(SD_File_name, "Test.txt");
res = f_open(&Test_File, SD_File_name, FA_WRITE | FA_CREATE_ALWAYS);

It is work good.

But if I enable FreeRTOS CMSIS V2, function f_open(...) always return

FR_NOT_READY,	/* (3) The physical drive cannot work */

I use CubeMX 6.1.1 and STM32L4 v1.16.0 package.

Please help what am I doing wrong.

Thank you

This topic has been closed for replies.

1 reply

Vangelis Fortounas
Associate II
January 3, 2021

Hello,

A divider of 24 is not a good idea, Freq requirement is <=24 MHZ for this device and the ideal=max=24MHZ. 24=SDMMC_CKLK / divider or divider=SDMMC_CLK/24

To use DMA template in LWIP (diskio.c) requires the SDMMC peripheral to have the DMA already enabled.