FATFS0.12c到f_mount()卡死,求助
本帖最后由 dabendan001 于 2019-5-26 12:18 编辑STM32F105RC,使用FATFS 0.12正常。尝试将FATFS换成0.12C,每到 f_mount()时卡死,跟踪调试时,运行到 ff.c文件中 res = find_volume(&path, &fs, 0); /* Force mounted the volume */,停止不前。卡在这里。再往下一步跟踪,死在这里:fmt = check_fs(fs, bsect); /* Load sector 0 and check if it is an FAT-VBR as SFD */
不知道如何下手处理了,请哪位来指点一下,谢谢。
res_flash = f_mount(&fs1_flash,"1:",1); //fs1_flash为全局变量,需要固定内存空间。
若将最后一个参数改为0,非即时挂载,到后面文件 f_open() 时卡死。
-------------------------------------
res_flash = f_mount(&fs1_flash,"1:",0);//系统挂载
HAL_Delay(200);
printf("\r\n FlashDisk mount completd...f_mount:%d.\r\n",res_flash);
#if(1)//仅用于测试
if(flash_format)
{
flash_format = false;
printf("\r\n FlashDisk will format...\r\n");
res_flash = f_mkfs("1:",FM_FAT, 0, work, sizeof work);
printf("\r\n FlashDisk format completed...f_mkfs:%d.\r\n",res_flash);
/* 格式化后,先取消挂载 */
res_flash = f_mount(NULL,"1:",1);
printf("\r\n FlashDisk umount completed...\r\n");
/* 重新挂载 */
res_flash = f_mount(&fs1_flash,"1:",1); //第3个参数为1时卡死
printf("\r\n FlashDisk re-mount completed..%d.\r\n",res_flash);
//HAL_Delay(200);
}
#endif
困扰我许久了,今天终于解决了。感谢论坛里诸位大神的回贴帮助。
解决办法:
ffconf.h文件中,我将 _MAX_SS 和 _MIN_SS均置为512了……问题所在。
改为:
#define _MIN_SS 512
#define _MAX_SS 4096
即可。
页:
[1]