cancel
Showing results for 
Search instead for 
Did you mean: 

PATH and File Name Length Limitation while using FATFS Middleware

Utkarash Patil
Associate III

Hello All,

I am using Cube MX (4.24) and Atollic truestudio (9.2.0) and want to implement a USB based boot loader part for my application .

Where i use STM32F777IITx MCU with "STM32Cube FW_F7 V1.9.0" firmware package.

Currently i was implementing USB binary file reading part,

However when i try the below given API's i am facing some issues which i have mentioned below

Issue 1.

If i use "f_open(&myFile, "OPENBLINKYFILE.TXT", FA_READ);" api i get error saying "FR_INVALID_NAME".

whereas, If i Use same api as follows "f_open(&SDFile, "BLINKY.TXT", FA_READ);"

I do not get any error it works i am able to open file and read data.

Issue 2.

If i use "f_stat("/TEST/BIN.TXT", &myFileinfo);" api i get error saying "FR_INVALID_NAME" also if i am not able to read file status.

whereas, If i Use same api as follows "f_open("/TEST/BLINKYOPEN.TXT", &myFileinfo);"

I do not get any error it works i am able to open file and read data.

I face such issue for many more api's whenever i want to access files with Long path name or long file name

I might be wrong but i think this is due to the small size of array declaration in FF.h which i have mentioned in bold

typedef struct {

   _FDID   obj;         /* Object identifier */

   DWORD   dptr;         /* Current read/write offset */

   DWORD   clust;         /* Current cluster */

   DWORD   sect;         /* Current sector (0:Read operation has terminated) */

   BYTE*   dir;         /* Pointer to the directory item in the win[] */

   BYTE   fn[12];         /* SFN (in/out) {body[8],ext[3],status[1]} */

#if _USE_LFN != 0

   DWORD   blk_ofs;      /* Offset of current entry block being processed (0xFFFFFFFF:Invalid) */

#endif

#if _USE_FIND

   const TCHAR* pat;      /* Pointer to the name matching pattern */

#endif

} DIR;

/* File information structure (FILINFO) */

typedef struct {

   FSIZE_t   fsize;         /* File size */

   WORD   fdate;         /* Modified date */

   WORD   ftime;         /* Modified time */

   BYTE   fattrib;      /* File attribute */

#if _USE_LFN != 0

   TCHAR   altname[13];         /* Alternative file name */

   TCHAR   fname[_MAX_LFN + 1];   /* Primary file name */

#else

   TCHAR   fname[13];      /* File name */

#endif

} FILINFO;

I request to please help me at the earliest at the earliest.

Also please help me with best firmware package version if i am using wrong.

Thanks and regards

Utkarsh

13 REPLIES 13

Hello All,

Thank You for your response and suggestions

I made the required changes and now i am able build the code without errors,

However still not able to use long file names

Thanks and regards

Utkarsh

dbgarasiya
Senior II

you have to change in .ioc file also below

_USE_LFN is enabled

Thank you for your response

dbgarasiya
Senior II

you are welcome