不知道为啥,我的SD卡有FAT32的文件系统,SD卡初始化 读扇区,都是可以工作的,但是返回没有文件系统。不知道为啥检测不到...
int main(void)
{
FRESULT res;
Stm32_Clock_Init(9);
delay_init(72);
init_lcd();
SD_GetSectorCount();
//****************************注册工作区*************************
do
{
res=f_mount(DRIVE, &FileSystemSpace);
if (res == FR_INVALID_DRIVE)
{
dis_str(0, 0, 0xffff, 0x0000, "DRIVE is Invalidable");
}
}while(res == FR_INVALID_DRIVE);
//*****************************创建文件**************************
do
{
res=f_open(&FileObject, "0:test.txt", FA_CREATE_NEW);
if (res != FR_OK)
{
dis_str(0, 32, 0xffff, 0x0000, "Create False");
switch (res)
{
case FR_NO_FILE:
break;
case FR_NO_PATH:
break;
case FR_INVALID_NAME:
break;
case FR_INVALID_DRIVE:
break;
case FR_EXIST:
break;
case FR_DENIED:
break;
case FR_NOT_READY:
break;
case FR_DISK_ERR:
break;
case FR_INT_ERR:
break;
case FR_NOT_ENABLED:
break;
case FR_NO_FILESYSTEM:
break;
}
}
}while(res != FR_OK);
//******************************************************************
return 0;
}
|