2025-03-19 1:24 AM
2025-03-19 3:48 AM
Hello @MauFanGilaMedical
Yes, it is possible to open multiple files simultaneously using FATFS. The number of files can be set via the FS_LOCK parameter in STM32CubeMX.
2025-03-19 5:18 AM - last edited on 2025-03-19 5:52 AM by Andrew Neil
so I can open one file in uSD and copy its content to another on uSD ?
I have to do this copy to change some content.
I did a first try but processor goes into Hard_Fault ... I supposed that I cannot open two files.
I will investigate and Accept as Solution if I see that I can.
Thankyou for the advice
2025-03-19 5:37 AM
I would think separate FIL objects for both files should suffice.
Otherwise, I would try to call f_sync() whenever you change the file you currently access.
2025-03-19 5:52 AM
The FatFs documentation is here: http://elm-chan.org/fsw/ff/
Here is the documentation of the FS_LOCK setting: http://elm-chan.org/fsw/ff/doc/config.html#fs_lock
@MauFanGilaMedical wrote:I did a first try but processor goes into Hard_Fault ... I supposed that I cannot open two files.
Did you make the configuration change as @Saket_Om showed?
Did you regenerate & rebuild the code?
Are you checking for the FR_LOCKED error mentioned in the FatFs documentation?
How to debug Hard Faults: