cancel
Showing results for 
Search instead for 
Did you mean: 

FX_FILE_CORRUPT when accessing eMMC file on STM32U5G9J-DK1 after reprogramming

Gowri_M
Associate

Hi,
I’m using the STM32U5G9J-DK1 board and working on implementing a FileX-based filesystem on the onboard eMMC. 

On the first run, I format the eMMC using fx_media_format(), open the media, create a file (e.g., file1.txt), write data to it, and read it back — all of which works correctly. However, in the second run, I flash new firmware that skips the formatting step and attempts to open and read from file1.txt. In this case, although the media opens successfully and checks for the file’s existence, it returns FX_ALREADY_CREATED, but trying to open the file results in an FX_FILE_CORRUPT error.

If I do only the formatting in the first run and perform the file creation and access in the second run, everything works fine.

I’m unsure why the file becomes unreadable across firmware flashes unless the file is created again after formatting. 

Thanks!

1 REPLY 1
Saket_Om
ST Employee

Hello @Gowri_M 

Did you close the media in the first run?

Could you please share your code?

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