2025-03-14 3:10 AM
Hello,
I need to connect SD card to STM32H5 device. CubeMX does not support fatfs I was using in the past, but only ThreadX and FileX. We decided to use this as STM32H5 seems like a good choice for many future projects.
So we connected the SD via SPI.
My understanding is that I need to enable Custom interface like this:
And than implement several low level functions in FileX/Targer/fx_stm32_custom_driver.c. This looks like this should be common task, but I could find no examples anywhere. Is there something I could use or at least some useful documentation regarding the custom driver?
Thank you Jeronym
Solved! Go to Solution.
2025-04-09 7:16 AM
Hello, yes. I implemented the functions myself. I use ram-disk example to know what should be done and combined it with low level function for fatfs available online.
However the project is not complete and fully tested yet. So lets take it as a starting point.
I currently struggle with file name encoding (or maybe long file name issue) with fileX.
Ragards Jeronym
2025-03-14 3:29 AM
@JeronymJ wrote:CubeMX does not support fatfs
That's not true.
While it might not have it built-in, it can certainly use it as 3rd-party source code - just as you'd use any other source code.
2025-03-14 6:51 AM
I use H563 , has sd-mmc on board. Why not use H523 , H563 ...with SDIO ?
2025-03-16 12:55 PM - edited 2025-03-17 5:29 AM
Hi,
thank you for the answer. Of course I know I can copy fatfs from my other applications, but that is beside the point. In this application I need to use FileX + SPI (on stm32H523), not fatfs.
2025-03-16 12:58 PM - edited 2025-03-17 5:29 AM
Hello, thank you for the reply. I forgot to specify that this device uses stm32h523. Also the interface has to be SPI for legacy reasons.
2025-03-31 4:15 PM
Hello,
I am also trying to use FileX with SPI for an SD card interface. Were you able to figure out a solution?
2025-04-01 12:51 AM
Hi @JeronymJ
I struggled with the custom interface for a while.. it never configured properly with CubeMx and I could never get it to work. I suggest you use the SD interface instead, and then modify the fx_stm_sd_driver_glue.c file to make it work with the spi device (or you can simply convert the SD device to a single bit.
Just be careful when re-configuring your system with CubeMX, because it will wipe out the changes you made in fx_stm32_sd_driver_glue.c
Good luck
2025-04-09 7:16 AM
Hello, yes. I implemented the functions myself. I use ram-disk example to know what should be done and combined it with low level function for fatfs available online.
However the project is not complete and fully tested yet. So lets take it as a starting point.
I currently struggle with file name encoding (or maybe long file name issue) with fileX.
Ragards Jeronym