本帖最后由 benclee 于 2020-4-24 10:06 编辑
用的正点原子的代码
执行f_mount(fs[0],"0:",1)时返回FR_DISK_ERR
跟进去,res = find_volume(&fs, &path, 0),这里返回1
再跟进去fmt = check_fs(fs, bsect);/* 加载0扇区并检查fat是否是 sfd 引导扇区 */这里返回3
static
BYTE check_fs ( /* 0:FAT boor sector, 1:Valid boor sector but not FAT, 2:Not a boot sector, 3:Disk error */
FATFS* fs, /* File system object */
DWORD sect /* Sector# (lba) to check if it is an FAT boot record or not */
)
{
fs->wflag = 0; fs->winsect = 0xFFFFFFFF; /* Invaidate window */
if (move_window(fs, sect) != FR_OK) /* Load boot record */
printf("move_win%d\r\n",(move_window(fs,sect)));//******************************************
return 3;
if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) /* Check boot record signature (always placed at offset 510 even if the sector size is >512) */
return 2;
if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146) /* Check "FAT" string */
return 0;
if ((LD_DWORD(&fs->win[BS_FilSysType32])