2018-05-17 09:45 AM
Hi, I am a bit stumped at the moment. I attached the files that use the main code.
In usbh_usr.c, the function 'USBH_USR_ReadWriteFirmware(void)' is the ffucntion that attempts to open the file.
The line 'if(f_open(&file, '0:g4_firmware.bin',FA_READ) == FR_OK)' is not returning true even though I have a bin file with that name.
f_open is in ff.c
It looks good to me? Does anyone see something wrong?
I am using Keil 5.18, and an STM32F2.
Thanks for you help,
Daniel
2018-05-17 10:18 AM
But what error specifically is it returning?
Are long file names supported?
Is this an EXFAT volume?
Is the volume mounted?
2018-05-17 10:40 AM
Good question.
When entering f_open, this is the order of events.
After chk_mounted, res = 0.
After follow_path, res = 0x4 --> FR_NO_FILE
But I have a file there.
I believe this is FAT32.
2018-05-17 10:49 AM
It returns that value from the function static FRESULT dir_next(DIR *pDir, BOOL bStreach)
At this point:
wi = pDir->index + 1;
if((wi == 0) || (pDir->sect == 0)){ //Report EOT when index has reached 65535 return FR_NO_FILE; //Hitting here }This is pDire when I hit the
FR_NO_FILE in the code shown above.
2018-05-17 12:56 PM
,
,
Probably should review setting in ffconf.h, these would be controlling.
Would expect the FatFs code to be fine, issues going to be with other code and settings.
♯ if 1 // DIR-CONSOLE
,
, puts('Display Directory'),, {
,
, , , FRESULT res,,
, , , DIR dir,,
, , , char *path,,
, , , UINT BytesWritten,, , , path = '',
, , , res = f_opendir(&,dir, path),
♯ ifdef DBG
,
, , , if (res != FR_OK),
, , , , , printf('res = %d f_opendir\n', res),,
♯ endif, , , if (res == FR_OK)
,
, , , {,
, , , , , while(1),
, , , , , {,
, , , , , , , FILINFO fno,,
, , , , , , , char str[256],,
, , , , , , , char *s = str,, , , , , , , res = f_readdir(&,dir, &,fno),
♯ ifdef DBG
,
, , , , , , , if (res != FR_OK),
, , , , , , , , , printf('res = %d f_readdir\n', res),,
♯ endif, , , , , , , if ((res != FR_OK) || (fno.fname[0] == 0))
,
, , , , , , , , , break,, , , , , , , printf('%c%c%c%c ',
,
, , , , , , , , , ((fno.fattrib &, AM_DIR) ? 'D' : '-'),,
, , , , , , , , , ((fno.fattrib &, AM_RDO) ? 'R' : '-'),,
, , , , , , , , , ((fno.fattrib &, AM_SYS) ? 'S' : '-'),,
, , , , , , , , , ((fno.fattrib &, AM_HID) ? 'H' : '-') ),, , , , , , , printf('%10d ', (int)fno.fsize),
, , , , , , , printf('%s/%s\n', path, fno.fname),
,
, , , , , },
, , , },
, },
♯ endif // DIR-CONSOLE