Closed alexdevemb closed 10 months ago
Hi @AlexDoucette As stated in the README.md, this library is based on the https://github.com/STMicroelectronics/stm32_mw_fatfs we only adapt it as Arduino library, so far no change done here. So issue should be raised in the repo then it will be inherited here. Anyway, it seems the current code in this repo is not aligned :roll_eyes: and don't know why. I have to check that.
Hi @AlexDoucette I've updated the library to be inline with the FatFs modified by ST. Could you check if it is ok for you.
Anyway, as stated to get your proposal fix you should submit the issue to https://github.com/STMicroelectronics/stm32_mw_fatfs I close this one as it will be inherited and validate by official stm32_mw_fatfs maintainer.
The original source code this repository is based upon calls the lock function (the equivalent of ENTER_FF macro) prior to calling the disk_status function. The inverted sequencing in the current implementation may result in unsafe access to the driver layer when used in a multitasking environment.
This inverted sequencing was observed to cause an intermittent error at the driver layer, as the driver implementation in question assumed that it was being called from a task-safe context.
Rather than implementing an additional mutex at the driver layer, it would be preferable to address the issue with the existing sync object by restoring the previous sequencing.
Suggested Fix:
Note, from the original source which shows the preferable sequencing (lock called prior to the disk_status call):