2022-04-28 4:47 AM
I am able to read the fixed length fname.
But the pointer to the long filename is always 0.
 
this is how im reading trough the list of files
FRESULT detect_binariesFolder(){
	fresult=f_opendir(&dir, "lu");
	fresult=f_readdir(&dir, &filinfo);
	fresult=f_findfirst(&dir, &filinfo, "lu", "*.bin");//http://elm-chan.org/fsw/ff/doc/findfirst.html
 
	   while (fresult == FR_OK && filinfo.fname[0]) {         /* Repeat while an item is found */
			fresult=f_findnext (&dir, &filinfo);
	   }
 
	fresult=f_closedir(&dir);
	return fresult;
}I tried the three different cubeMx options for long filenames :
None of them works.
 
My setup:
Solved! Go to Solution.
2022-04-28 5:09 AM
Okay that wasnt so hard, i just needed to find up to date documentation.
(C:\Users\**your user**\STM32Cube\Repository\STM32Cube_FW_F1_V1.8.4\Middlewares\Third_Party\FatFs\doc)
 
Apparently the pointer needs to be initialiced by you first.
adding this three lines fixes the code:
FRESULT detect_binariesFolder(){
    char lfn[_MAX_LFN + 1];
    filinfo.lfname = lfn;
    filinfo.lfsize = sizeof lfn;
 
    	fresult=f_opendir(&dir, "lu");
    	fresult=f_readdir(&dir, &filinfo);
    	fresult=f_findfirst(&dir, &filinfo, "lu", "*.bin");//http://elm-chan.org/fsw/ff/doc/findfirst.html
     
    	   while (fresult == FR_OK && filinfo.fname[0]) {         /* Repeat while an item is found */
    			fresult=f_findnext (&dir, &filinfo);
    	   }
     
    	fresult=f_closedir(&dir);
    	return fresult;
    }2022-04-28 5:09 AM
Okay that wasnt so hard, i just needed to find up to date documentation.
(C:\Users\**your user**\STM32Cube\Repository\STM32Cube_FW_F1_V1.8.4\Middlewares\Third_Party\FatFs\doc)
 
Apparently the pointer needs to be initialiced by you first.
adding this three lines fixes the code:
FRESULT detect_binariesFolder(){
    char lfn[_MAX_LFN + 1];
    filinfo.lfname = lfn;
    filinfo.lfsize = sizeof lfn;
 
    	fresult=f_opendir(&dir, "lu");
    	fresult=f_readdir(&dir, &filinfo);
    	fresult=f_findfirst(&dir, &filinfo, "lu", "*.bin");//http://elm-chan.org/fsw/ff/doc/findfirst.html
     
    	   while (fresult == FR_OK && filinfo.fname[0]) {         /* Repeat while an item is found */
    			fresult=f_findnext (&dir, &filinfo);
    	   }
     
    	fresult=f_closedir(&dir);
    	return fresult;
    }