Just like title show.
I just want to use FATFS_0.09 run together with rl_usb (not RL_FLASHFS).
any ideas?
or RL_FLASHFS support chinese file names??
Thanks Tsuneo
I am sorry I did not say clearly.
my system working on usb host with SD card. RL_USB with RL_FLASHFS working well.
FATFS also working well.
Now just want to port FATFS into RL_USB. I just need to rewrite the diskio.c file?
use usbh_msc_*** or usbh_** function in diskio.c?
I will try again.
Another question, how do I know the current USB is busy in RL_USB?
BYTE USB_disk_read ( BYTE *buff, /* Data buffer to store read data */ DWORD sector, /* Sector address (LBA) */ BYTE count /* Number of sectors to read (1..128) */ ) { if(!count) { return RES_PARERR; } printf("secotor:%d\tcount:%d\r\n",sector,count); return (usbh_msc_read(0, 0, sector, buff, count)); }
When I try to read data (more than one time) error happening.
I think that is because USB in busying status. right?
> When I try to read data (more than one time) error happening. > I think that is because USB in busying status. right?
No, usbh_msc_read() is a synchronous function. It doesn't return until the read operation finishes, or until some "physical" error occurs. Sound like the cause lives in elsewhere.
Did you mount two drives simultaneously? Then, assign dedicated FATFS structure to each drive.
static FATFS sFatFs0, sFatFs1; f_mount( 0, &sFatFs0 ); f_mount( 1, &sFatFs1 );
If you would open two files together, assign dedicated FIL structure to each file.
static FIL fileObj0, fileObj1; f_open( &fileObj0, "src.txt", FA_READ ); f_open( &fileObj1, "dst.txt", FA_WRITE );
Tsuneo
Thanks Tsuneo!^_^
system work well now! As you said!
other question!
(my project is STM32F207 WITH RL_USB + FATFS)
can usb host (MSD project) read data from hard disk ( two or more logical partition)?
set _MULTI_PARTITION == 0, just can read data from hard disk in main partition.
set _MULTI_PARTITION == 1, use f_open to read a file, return error code
FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
my open file function is
res = f_open(&fsrc, "2:/STM32.TXT", FA_OPEN_EXISTING | FA_READ);
more ideas for _MULTI_PARTITION == 1??
You do know that FatFS has an online user manual, right? I used it extensively, and guess what I did not forget to mount my drives....
Is that means:
/*ps: 1:project use USB. 2:STM32.TXT in 2nd partition. 3:boot.TXT in main partition*/ /* Definitions of physical drive number for each media */ #define ATA 0 #define MMC 1 #define USB 2 #define _MULTI_PARTITION 1 /* 0:Single partition, 1/2:Enable multiple partition */ #if _MULTI_PARTITION == 1 PARTITION VolToPart[] = { {2, 1}, {2, 2}, {1,0} }; #endif /*in main function*/ /*USB == 2*/ res = f_mount(USB,&Fatfs[2]); /*can't mount volume, and return FR_NO_FILESYSTEM*/ if(res != FR_OK) { printf("2:mount fs error :%d \r\n",res); } ... f_mount(USB, NULL); res = f_mount(1,&Fatfs[1]); /*mount volume success*/ if(res != FR_OK) { printf("1:mount fs error :%d \r\n",res); } /*open file fail, return FR_NO_FILESYSTEM*/ res = f_open(&fsrc, "1:/STM32.TXT", FA_OPEN_EXISTING | FA_READ); if(res != FR_OK) { printf("open file error : %d\r\n",res); } else { printf("open file success...\r\n"); f_close(&fsrc); } f_mount(1, NULL); res = f_mount(0,&Fatfs[0]); /*mount volume success*/ if(res != FR_OK) { printf("0:mount fs error :%d \r\n",res); } /*open file success*/ res = f_open(&fsrc, "0:/boot.TXT", FA_OPEN_EXISTING | FA_READ); if(res != FR_OK) { printf("open file error : %d\r\n",res); } else { printf("open file success...\r\n"); f_close(&fsrc); } f_mount(0, NULL);
I read the user manua but did know why?
any ideas to mount partition?
How many logical "_VOLUMES" did you assign?
ffconf.h #define _VOLUMES 1 // <--- 3 /* Number of volumes (logical drives) to be used. */
I am sorry to tell you that i have defined _VOLUMES
#define _VOLUMES 3 /* Number of volumes (logical drives) to be used. */
hard disk has two logical partition.
i try to use _VOLUMES == 2
and
PARTITION VolToPart[] = { {2, 1}, {2, 2} };
the same error.
1. res = f_mount(USB,&Fatfs[2]); /*can't mount volume, and return FR_NO_FILESYSTEM*/
2. res = f_mount(1,&Fatfs[1]); /*mount volume success but open file fail, return FR_NO_FILESYSTEM*/ ... res = f_open(&fsrc, "1:/STM32.TXT", FA_OPEN_EXISTING | FA_READ);
3. res = f_mount(0,&Fatfs[0]); /*mount volume success and open file success*/ ... res = f_open(&fsrc, "0:/boot.TXT", FA_OPEN_EXISTING | FA_READ);