Skip to main content
Associate II
September 28, 2026
Solved

SDMMC/FileX sample code needed for nucleo_c5a3zg.

I am working on stm32 C5A3ZG platform for one of my projects. I want to use SD card for data logging. I have working SD card module. I tried to use it with nucleo_c5a3zg board using zephyr RTOS and there infrastructure of file management that code is not working on this C5 controller which uses HAL2 driver. It works on other STM32 controllers which use HAL driver.

I tried to create a project in STM32CubeMX2 but couldn’t find configuration for SDMMC over SPI which would be required to interface SD card.

I checked in STM example library https://dev.st.com/stm32-example-library/result?filters=N4IgpgHghgtgDgGzAOVmEAuA2gXQDQgwDGArpliAMoAqAsgMwBMAwgKwj4gBGA9lAE4ATcpxgBLQYKQB3AemyjSAEX5iAbmH4iCvAYIAKUIgGsoAc3m4Cg1Rv7UAnnEs4AvkA but was not able to find any sample or SD card.
Can someone provide a sample code to me otherwise i have to look for potentially changing the platform and move to some other controller.

MFARH.1
MFARH.1Best answer
ST Employee
October 20, 2026

Hello ​@Abhishek_Babhulkar ,

 

The STM32C5A3ZG does not include an SDMMC peripheral. To use an SD card with this device, you will need an SD card module(shield) that supports SPI.

In STM32CubeMX2, configure the SPI peripheral connected to the module. If you are using FileX, add interface and select Custom.

CubeMX will generate a driver template, which you will need to adapt to implement the required SD card operations over SPI.

 

BR,

Maher

6 replies

ST Technical Moderator
September 28, 2026

Hello ​@Abhishek_Babhulkar 

Unfortunately, there is no example for interfacing SDMMC card over SPI in STM32CubeC5 package. 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
Associate II
October 4, 2026

Hi ​@Saket_Om 

Is there some plan to have such example soon? or is there some other tutorials for cubemx2 to make such configuration so I can make my own application example where i get generated code from filex and sdmmc interfacing.

ST Technical Moderator
October 5, 2026

Hello ​@Abhishek_Babhulkar 

I would like to note that the STM32C5 MCU does not support SDMMC peripheral. 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
ST Technical Moderator
October 13, 2026

Hello ​@Abhishek_Babhulkar 

The issue has been fixed on the link below:

subsys: crc: fix crc7_be hardware result by gautierg-st · Pull Request #121925 · zephyrproject-rtos/zephyr

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
Associate II
October 13, 2026

​@Saket_Om 

This issue is not fixed. In zephyr we use zephyrs own file handling implementation. Filex is stm middleware which according to my knowledge suppose to allow user have lightweight file handling middleware which can be used without OS. 

If this understanding is incorrect please correct me. The link mentioned there is of zephyr so can't be used without OS.

MFARH.1
MFARH.1Best answer
ST Employee
October 20, 2026

Hello ​@Abhishek_Babhulkar ,

 

The STM32C5A3ZG does not include an SDMMC peripheral. To use an SD card with this device, you will need an SD card module(shield) that supports SPI.

In STM32CubeMX2, configure the SPI peripheral connected to the module. If you are using FileX, add interface and select Custom.

CubeMX will generate a driver template, which you will need to adapt to implement the required SD card operations over SPI.

 

BR,

Maher