Skip to main content
Visitor II
September 28, 2025
Question

STM32F4 + SDIO + FATFS

  • September 28, 2025
  • 1 reply
  • 305 views

Hello,

I am trying to get f_mount() to work with the SDIO peripheral.

 

Currently, the f_mount() reaches the first disk_read() function, where it hangs in the osMessageQueueGet() call. 

 

Stuff I already tried:

- increase min & max heap to 0x400, 0x800

- increase default static rtos task stack size to 8000

- call f_mount in the default task

- have delay before f_mount

- pullup on all IO pins except the CLK

- the hsd.Instance has recognized card type and class

- the NVIC prio is 5 for SDIO and DMA stream

- tried SDIO_RX/SDIO_TX combo and just SDIO

- tried setting GPIO pins to lower speeds

- tried SD bit 1 mode and then switching to 4bit mode

- tried SD bit 1 mode and keeping 1 bit mode

- SDIO_IRQ interrupt hits, but does not put anything in the SDQueueID queue.

 

i would prefer to use the cubemx generated drivers and not write one myself. is this configuration (RTOS+SDIO+FATFS) not possible/bugged?

 

thanks.

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    September 29, 2025

    Hello @ayhamxyz 

    Please refer to the example below as starting point.

    STM32CubeF4/Projects/STM324x9I_EVAL/Applications/FatFs/FatFs_uSD_RTOS at master · STMicroelectronics/STM32CubeF4 · GitHub


    @ayhamxyz wrote:

    - the NVIC prio is 5 for SDIO and DMA stream

     


    The interrupt priority is too high (must be lower than the RTOS kernel interrupt priority which is 5).

    ayhamxyzAuthor
    Visitor II
    September 30, 2025

    I tried that with no avail,

     

    I am using the automatically generated SDIO dma template driver from stm32cubemx/ide, which follows closely the project @Saket_Om linked, except that I am using CMSISv2, so it is using the newer osQueue* functions.

     

    I tried to use f_mount() with a new project, no rtos, no dma, and that did not work. I used 2 different SDcards, both are SanDisk, one is a newer 128gb and another is 32gb (older HD version). The SDIOCLK divisor is 4, so that should work.

     

    I am starting to suspect that it is a PCB issue.

     

    Thanks for your reply anyhow.