Hi Gent. men please i want to know if I have to do any thing to keep SD driver stable once i use some string functions or touch pointer struct program stop browsing files on sd and to make it work I have to use 1 byte bus mode what is deference between using 4B and 1B ?? and why that happen ?? please help I'm all the day working around this problem and could not find solution
down is open path function is there any fetal error??
FPath is extern array
/* load file list array with file info */ void MbFBrowser_OpenPath(char *MyPath) // return update for filelist array { FATFS FBFatfs; static DIR MyDir; // donot use pointer for all fatfs structs static FILINFO Finfo; uint8_t i,len; uint8_t Res; char Path[4]; // FOR DRIVE LINK AND MOUNT char CPath[PATHLEN]; // FOR DRIVE LINK AND MOUNT
/* clear filelist array */ for ( i=0 ; i< FILLIST_CNT;i++) { FileList[i].fname[0]=0; //clear all fname }
/* OPEN CPath and fill FILE LIST ARRAY */ sprintf(CPath,"%s",FPath); if (SD_Driver.disk_initialize(0)==0) { if(FATFS_LinkDriver(&SD_Driver, Path) == 0) { if(f_mount(&FBFatfs, (TCHAR const*)Path, 1) == FR_OK) // { if( f_opendir (&MyDir,CPath)== FR_OK) { i=0; Res=f_readdir ( &MyDir,&Finfo ); while (Finfo.fname[0]!=0) { FileList[i]= Finfo; Res=f_readdir ( &MyDir,&Finfo ); i++; }
} f_closedir (&MyDir); } } FATFS_UnLinkDriver(Path); } }
View all questions in Keil forum