cancel
Showing results for 
Search instead for 
Did you mean: 

f_mount always return FR_DISK_ERR when using 4 bit wide SDIO bus but works perfectly with 1 bit SDIO bus

Karan Kolhe
Associate III

I have NUCLEO-F767ZI 216Mhz and a SD card breakout board. I am using cube mx 5.2.0 and FW_F7_V1.15.0 for code generation. I want to read/write in a file on a sd card. I have enabled SDMMC1 (SD 4 bit wide bus) in cube mx and also enabled FATFS middleware for sd card. 

SDIO CLK divide factor 3

MAX_SS 4096

and all other parameters are default

I have connected SDIO pin correctly (double checked) .

When I use 1 bit SDIO bus it works perfectly for same code.

Code:

FATFS SDFatFS ;

FIL SDFile ;

res =f_mount ( &SDFatFS , SDPath,1);

char myFileName[]= "abc.txt"; // create new file

if (res == FR_OK){

res=f_open ( &SDFile , myFileName, FA_WRITE | FA_CREATE_ALWAYS); // open in write mode

}

char myData[] = "xyx,ghj,acceleration,target position\n 1000,231.25,10,500.5";

if (res == FR_OK){

res=f_write ( &SDFile, myData , sizeof(myData), &myBytes);

}

f_close(&SDFile);

6 REPLIES 6

Likely unrelated to code shown.

Could be SW, could be how you have your card wired.

4-bit test code for NUCLEO-F7xx posted here, review output to VCP

https://community.st.com/s/question/0D50X0000BOtWr8SQF/fatfs-sdio-4-bit-mode-stm32f746zg-nucleo

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Karan Kolhe
Associate III

I have wired the card correctly. I saw your link and downloaded your demo. I don't know what to do with your hex file

Program with STM32 Cube Programmer, observe via Terminal app.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Karan Kolhe
Associate III

 I tried. It is just Printing 0,13 % every second

Karan Kolhe
Associate III

Solved! It was't related to software.

May I know how did you resolve it in your case?
I had the same problem.