cancel
Showing results for 
Search instead for 
Did you mean: 

FileX SD card using SPI

JeronymJ
Associate II

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: 

JeronymJ_0-1741946752464.png

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

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

7 REPLIES 7

@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.

http://elm-chan.org/fsw/ff/ 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
AScha.3
Chief III

I use H563 , has sd-mmc on board. Why not use H523 , H563 ...with SDIO ?

If you feel a post has answered your question, please click "Accept as Solution".

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.

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.

kenzop
Associate

Hello,

 

I am also trying to use FileX with SPI for an SD card interface. Were you able to figure out a solution?

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.

mattcrc_1-1743493753989.png

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

 

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