STMicroelectronics / stm32-mw-filex

Provides the FileX library part of the STM32Cube MCU Component "middleware" for all STM32xx series.
Other
0 stars 1 forks source link

exFAT takes really long to mount/open for large sizes (2TB) #1

Open pchwalek opened 1 month ago

pchwalek commented 1 month ago

We've recently got our hands on 2TB SD Cards and discovered limitations with the FileX library provided through Cube. When mounting systems with exFAT using the provided FileX library, the bitmap is initialized by opening the volume and then calling _fx_utility_exFAT_bitmap_initialize within the _fx_media_open function. However, _fx_utility_exFAT_bitmap_initialize takes a significant amount of time for a large SD card since it checks all the cluster states (15,000,000+ on a 2TB card!). As a reference, a 10MHz clock for an SDIO peripheral takes 10+ minutes to initialize the bitmap.

After reading the exFAT spec, I'm not entirely sure why we need to initialize the bitmap in the way it is currently implemented in this FileX exFAT library. Windows and macOS don't do this given how quickly you can mount an exFAT drive to those operating systems.

ASEHSTM commented 1 month ago

Hello @pchwalek,

Thank you for your contribution. To better understand and resolve the issue, could you please let us know which version of the FileX library you are currently using, which board you are employing, and in what context you are initializing the bitmap? Does the bitmap initialization occur during system startup or in another context?

With Regards,

pchwalek commented 1 month ago

Hi @ASEHSTM,

I am using FileX 6.2.0 that is included when generating a project with CubeMX for STM32U595. The bitmap initializing is automatically triggered when using exFAT and calling _fx_mediaopen which will always call __fx_utility_exFAT_bitmapinitialize, leading to the time-consuming search through the clusters. The initialization occurs on startup when opening the volume.

ASEHSTM commented 1 month ago

ST Internal Reference: 189156

ASEHSTM commented 1 month ago

Hello @pchwalek,

Unfortunately, we don't have this card. Could you please specify the model of the 2TB SD card you are using and where you ordered it from?

With Regards,

ASEHSTM commented 3 weeks ago

Hello @pchwalek,

Any update, please?