cubeide-sd-card icon indicating copy to clipboard operation
cubeide-sd-card copied to clipboard

f_write fails with error (1)

Open cmd05 opened this issue 5 months ago • 0 comments

I am interfacing an SD module with my STM32F401RE board. I followed your blog for the guide but I get the following error for f_write

~ SD card demo by kiwih ~

SD card stats:
  16764928 KiB total drive space.
  16764848 KiB available.
I was able to open 'test.txt' for reading!
Read string from 'test.txt' contents: microsd: hello!
I was able to open 'write.txt' for writing
f_write error (1)

I tried debugging the issue and it seems that USER_SPI_read fails because of the functions send_cmd and rcvr_datablock. In this screenshot the if condition should be executed, then the function will return RES_OK, however it fails because both the conditions are false.

Image

send_cmd returns res=0xFF at the end of the loop.

Image

I'd have to check the error for rcvr_datablock too.

How would I be able to fix this error? Thanks

cmd05 avatar Jul 08 '25 14:07 cmd05