2023-04-25 02:33 AM
I'm using FATFS with DMA to read/write a SD card. Everything works fine until I introduced low power mode to my code.
Currently, I just run the init function generated with cubemx and mount again after waking up. After the first wakeup, everything still works, mount, open, write, close all return success, but after the second wakeup, mount returns FR_NO_FILESYSTEM. As far as I can tell, the filesystem collapsed as soon as write operation after the first wakeup before entering stop mode the second time, despite it returns success.
It's the first time I ever come across low power mode so it may be just some basic problem but I really have no idea. What do I need to do with FATFS/SDIO before entering and after exiting stop mode to make it work properly?
2023-04-25 02:50 AM
Post edited to adhere community guidelines.
2023-04-25 08:30 AM
Thanks for replying.
I took a look into all auto generated init functions when program start and found corresponding deinit functions.
I now deinit sdio before entering stop mode, using HAL_SD_DeInit function, as DMA deinit is included in HAL_SD_MspDeInit called in that function, I also use FATFS_UnLinkDriver function as the FATFS_LinkDriver function is called in MX_FATFS_Init. Still the problem occurs, what am I missing.