cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32H573IT] I can't FATFS in CubeMX.

kadekade
Associate II

Hi Everyone,

I need your help.

I use STM32H573VIT but I can't FATFS in CUBEMX.

I checked FILEX, SD interface. But CUBEIDE say fatfs.h : No such file or directory.

 

Please help me out..

Thanks,

kadekade

 

스크린샷 2026-04-02 190445.png스크린샷 2026-04-02 190521.png스크린샷 2026-04-02 190559.png스크린샷 2026-04-02 190628.png

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @kadekade 

Further to your comment, I tested again with the Ioc.File provided through the attachment and the build was finished without any errors.

I will be waiting for your feedback.

Thanks.

Mahmoud

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

8 REPLIES 8
Mahmoud Ben Romdhane
ST Employee

Hello @kadekade 

Let me thank you for your posting.

I created a project with STM32CubeMX 6.17 [STM32H573VIT6], and the issue was not reproduced by my side.

The compilation completed without any errors.

For more investigation, I suggest please that you provide your Ioc.File.

Thanks.

Mahmoud

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

AScha.3
Super User

Hi,

>but I can't FATFS

Right, here no fatfs , you have to use filex , as you selected in Cube.

mount drive ->

/* Open the SD disk driver */
  sd_status =  fx_media_open(&sdio_disk, FX_SD_VOLUME_NAME, fx_stm32_sd_driver, (VOID *)FX_NULL, (VOID *) fx_sd_media_memory, sizeof(fx_sd_media_memory));

 

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

Dear Mahmoud,

I appreciate your help. I'm sorry to reply late.

I attatched my ioc file. My settings is slightly defferent with your settings(SDMMC1_D0)

yours : SDMMC1_D0 PB13

me : SDMMC1_D0 PC8

 

I going to try testing with your ioc file.

Thanks,

kade

 

Thank, I'm trying it again.

kade

Hello @kadekade 

Further to your comment, I tested again with the Ioc.File provided through the attachment and the build was finished without any errors.

I will be waiting for your feedback.

Thanks.

Mahmoud

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thank you so much.

Yes...Right

I figured out what my mistake was. 

To do microSD, I tried to merge OLD FATFS source codes. so I want to see FATFS in CUBEMX.

But FATFS is replaced by FILEX.

Finally, I made new codes with FILEX below, ( I need your help once more..)

 

(example codes from somewhere on web.)

MX_GPIO_Init();
MX_SDMMC1_SD_Init();
MX_FileX_Init();

 FX_MEDIA   sd_disk;
 
  UINT   status;
  CHAR   *write_buffer = "Hello STM32 FileX!";
 
  unsigned char media_memory[256];
 
  status = fx_media_open(&sd_disk, "SD_CARD", fx_stm32_sd_driver,  0, media_memory, sizeof(media_memory));
 
      /* 2. 占쏙옙占쏙옙 占쏙옙占쏙옙 占쏙옙 占쏙옙占쏙옙 占쏙옙占쏙옙  (in korean)*/
    FX_FILE my_file;
    fx_file_create(&sd_disk, "test.txt");
    fx_file_open(&sd_disk, &my_file, "test.txt", FX_OPEN_FOR_WRITE);
    fx_file_write(&my_file, "Hello FileX!", 12);
    fx_file_close(&my_file);
 
    /* 3. 占쏙옙占쏙옙占쏙옙占?占쏙옙占쏙옙 占쏙옙체占쏙옙 占쏙옙占쏙옙 */
    fx_media_flush(&sd_disk);

 

Unfortunately, I could't write [test.txt] in microSD and went to HARD FAULTS.

I would appreciate your help once more...

 

Thanks,

BR 

kade

 

 

I found out why it doesn't work.

I should setting memory bigger than sector sizes(ex:4096).

So. Not unsigned char media_memory[256]

is "unsigned char media_memory[4096 or more]"

 

Thanks,

BR

kade

 

 

스크린샷 2026-04-08 142416.png