Skip to main content
Associate III
February 2, 2026
Solved

FileX on QSPI files are not kept after reset

  • February 2, 2026
  • 2 replies
  • 251 views

Hi,

I’m working with a custom PCB based on an STM32H743BI and an external MT25TL01G memory device.

To manage the data I’m using FileX + LevelX. I’m able to create the media, create directories, create files, write to them, and read them without issues. However, I’m running into a problem when trying to read files after a reset.

After formatting the media with:

fx_media_format(&pFileManagerDesc->fxFileMedia, 
 fx_stm32_levelx_nor_driver, 
 (VOID *)LX_NOR_QSPI_DRIVER_ID, 
 (UCHAR *) mediaBuffer, 
 sizeof(mediaBuffer), 
 QSPI_VOLUME_NAME, 
 QSPI_NUMBER_OF_FATS, 
 32, 
 QSPI_HIDDEN_SECTORS, 
 ((LX_STM32_QSPI_FLASH_SIZE - LX_STM32_QSPI_SECTOR_SIZE) / QSPI_SECTOR_SIZE), 
 QSPI_SECTOR_SIZE, 
 8, 
 1, 
 1); 

I open the media and try to read from it, but I always the error FX_NO_FOUND trying to open the file.

This doesn’t happen if I create a file first. I’m not sure if I’m missing a step before reading the media after formatting.

I’m not performing any erase operation because I have: LX_STM32_QSPI_ERASE set to 0

 

I have followed the example from:

https://github.com/STMicroelectronics/x-cube-azrtos-h7/tree/main/Projects/STM32H747I-DISCO/Applications 

 

Thanks!

Best answer by Saket_Om

Hello @JonConesa 

After a reset, you must not call fx_media_format() again, because it recreates the FAT filesystem and effectively erases all existing files (their directory entries and allocation info are lost, so fx_file_open() returns FX_NOT_FOUND). The correct approach is to call fx_media_format() only once, then on every subsequent boot/reset simply call fx_media_open() to mount the existing volume and access your files.

2 replies

Saket_OmBest answer
Technical Moderator
February 4, 2026

Hello @JonConesa 

After a reset, you must not call fx_media_format() again, because it recreates the FAT filesystem and effectively erases all existing files (their directory entries and allocation info are lost, so fx_file_open() returns FX_NOT_FOUND). The correct approach is to call fx_media_format() only once, then on every subsequent boot/reset simply call fx_media_open() to mount the existing volume and access your files.

"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.Saket_Om"
JonConesaAuthor
Associate III
February 16, 2026

Hi @Saket_Om,

 
Thanks for your reply, and sorry for getting back to you late.
 
My code is now working, thank you so much!! :)
Andrew Neil
Super User
February 4, 2026

@JonConesa - what @Saket_Om said is described here.

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.