cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5 File system with FreeRTOS

M326.1
Associate II

Hello,

I'm using NucleoU575 with CubeMx and I want to make a file system on my SD card.

I want to use FreeRtos but there are no Fatfs in CubeMx and the FileX cannot work with FreeRtos (image). Is there anyway i can use Fatfs with STM32U5 ?

Thank you.


_legacyfs_online_stmicro_images_0693W00000bk2bEQAQ.png 

1 ACCEPTED SOLUTION

Accepted Solutions
coppercrimp
Associate III

I had this same problem. Luckily I found it pretty easy to port FatFS over the the STM32U5. Just create a a new project in CubeMX using a microcontroller that *does* support FatFS. In my case I created a project using the STM32L4R9ZG. Then I copied all the FATFS files and directories over to my STM32U5 project. From there its pretty much a simple matter of changing all the header file references from STM32L4R9 device to STM32U5.

For my project I'm using a STM32U575RIT6 with a SD card interface. I was able to get everything working with FatFS and the SDMMC bus in 4 bit mode

View solution in original post

5 REPLIES 5
coppercrimp
Associate III

I had this same problem. Luckily I found it pretty easy to port FatFS over the the STM32U5. Just create a a new project in CubeMX using a microcontroller that *does* support FatFS. In my case I created a project using the STM32L4R9ZG. Then I copied all the FATFS files and directories over to my STM32U5 project. From there its pretty much a simple matter of changing all the header file references from STM32L4R9 device to STM32U5.

For my project I'm using a STM32U575RIT6 with a SD card interface. I was able to get everything working with FatFS and the SDMMC bus in 4 bit mode

M326.1
Associate II

Thank you very much, @Community member​ 

M326.1
Associate II

I added STM32F4 Fatfs files and It can work.

I share my code for the NUCLEO-U575 to everyone who needs in the file attached here.

1/ I used this SPI driver for the sd card : https://www.micropeta.com/video29

2/ I copied the FATFS files from a CubeMX project for STM32F4 then modify to the U5


_legacyfs_online_stmicro_images_0693W00000bkUWCQA2.pngI also need these two files from F4:


_legacyfs_online_stmicro_images_0693W00000bkUjGQAU.png3/ You need to add some path to your project (see image)


_legacyfs_online_stmicro_images_0693W00000bkUVnQAM.png
_legacyfs_online_stmicro_images_0693W00000bkUVsQAM.png4/ Don't forget to add this if you use the same SPI driver as mine. You also need the change SPI_FLAG_TXE to SPI_FLAG_TXP in "fatfs_sd.c"


_legacyfs_online_stmicro_images_0693W00000bkUWRQA2.png

M326.1
Associate II

A update of my code

ibrahimmd
Associate

Use ThreadX RTOS instead. You can then enable FileX normally.