cancel
Showing results for 
Search instead for 
Did you mean: 

f_mount always returning FR_NO_FILESYSTEM

Shane Gingell
Associate II
Posted on July 12, 2018 at 11:39

I am using system workbench (eclipse) as IDE and cubemx to provide setup code for both SDIO(1 bit mode) and FATFS middleware. I am using a STMF407VE and have double checked the SD adapter has correct pin-out.

FATFS myfats;

if(f_mount(&myfats, SDPath, 1)== FR_OK){

returns false

and

FATFS myfats;

if(f_mount(&myfats, SDPath, 1)== FR_NO_FILESYSTEM){

always returns true

6 REPLIES 6
Doug Kehn
Senior
Posted on July 12, 2018 at 14:43

FR_NO_FILESYSTEM is an indication that the media needs to be formatted with f_mkfs().

Posted on July 12, 2018 at 14:50

It might also indicate that you're reading junk from the media, or the block addresses are being shifted.

How large is the card in question? Is it EXFAT formatted? Have you enabled support for EXFAT?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Shane Gingell
Associate II
Posted on July 13, 2018 at 10:04

I have tried using an older version of cubemx as there is a number of posts about problems with latest version of cubemx generation of SD code. I have now gone to cubemx version 4.21.

Using this version of cubemx and system work bench as IDE on a STM32F$107VE I now have got it to mount and open but it won't write or close.

both

if(f_mount(&myfats, SD_Path, 1)== FR_OK)

and

if(f_open(&my__file, f_name, FA_WRITE | FA_CREATE_ALWAYS)== FR_OK)

return true

but both

if(f_write(&my__file, my_data, sizeof(my_data), &num_written) == FR_OK)

and

if(f_close(&my__file) == FR_OK)

return false.

Even if I just try to open then close a file without writing the close will return false.

Shane Gingell
Associate II
Posted on July 13, 2018 at 10:14

STM32F407VE is MCU use sorry for the typo

:)

Posted on July 13, 2018 at 10:06

I tried a fresh reformat using FAT32 and also tried a couple of different cards. Size of card is 16GB

Posted on July 13, 2018 at 12:56

This is all rather top-level stuff. The failure is occurring at the DISKIO layer, I don't use CubeMX, but there are an abundance over issues reported over the SDIO/SDMMC and FatFS code it outputs. Missing call-backs, and using polled mode are problems I've seen reported.

The current version of CubeMX is V4.26.0, the F4 library V1.21.0

The examples in the HAL code tree work a lot better

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