This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Please Help / SD Driver go stuck stm32f746 disc

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); }
}

  • Please learn to use PRE tags when posting source code..

    Do you need to initialize the SD_Driver multiple times? Look at what interactions you are having with the card, and how/why it fails. The FATFS level likely isn't going to give much insight. If 1-bit works and 4-bit doesn't, look at command interaction and bus signalling.

    Make sure your data structures and stack are sufficiently large, and that you don't index beyond the scope of the array. Make sure you aren't trashing your memory space.

    Not sure anyone is going to be able to divine why some part of your system fails by showing one subroutine without adequate context, with code that is unreadable and uncompilable.

    If you're not finding the problem assume you're looking in the wrong place, and at the wrong things, and learn to debug more effectively. Think harder and present your problems better.