使用fatfs0.11版本的时候
FRESULT res;
LED_GPIO_Config();
/* 配置串口为:115200 8-N-1 */
USART_Config();
printf("\r\n 这是一个8Mbyte串行flash(W25Q64)实验 \r\n");
res=f_mount(&fsObject,"1:",1);
printf("res=%d\n",res);
if(res==FR_NO_FILESYSTEM)
{ res=f_mkfs("1:",0,0);
printf("res=%d\n",res);
res=f_mount(NULL,"1:",1);
res=f_mount(&fsObject,"1:",1);
printf("res=%d\n",res);
}
res=f_open(&fp,"1:stm.txt", FA_OPEN_ALWAYS |FA_READ|FA_WRITE);
printf("\r\nopen res=%d",res);
此段代码的输出结果
这是一个8Mbyte串行flash(W25Q64)实验
res=0
open res=0
而使用fatfs0.13版本,
FRESULT res;
LED_GPIO_Config();
/* 配置串口为:115200 8-N-1 */
USART_Config();
printf("\r\n 这是一个8Mbyte串行flash(W25Q64)实验 \r\n");
res=f_mount(&fsObject,"1:",1);
printf("res=%d\n",res);
if(res==FR_NO_FILESYSTEM)
{ res=f_mkfs ("1;", /* [IN] Logical drive number */
FM_ANY, /* [IN] Format options */
0, /* [IN] Size of the allocation unit */
work, /* [-] Working buffer */
sizeof(work) /* [IN] Size of working buffer */
);
printf("res=%d\n",res);
res=f_mount(NULL,"1:",1);
res=f_mount(&fsObject,"1:",1);
printf("res=%d\n",res);
}
res=f_open(&fp,"1:stm.txt", FA_OPEN_ALWAYS |FA_READ|FA_WRITE);
printf("\r\nopen res=%d",res);
该段代码输出结果
这是一个8Mbyte串行flash(W25Q64)实验
res=3
open res=3
这是什么原因呢? |