cancel
Showing results for 
Search instead for 
Did you mean: 

Read SD card with fatfs and win7 files names

francescatodiego
Associate II
Posted on February 14, 2014 at 23:07

I was trying to read a file stored on a SD card with the fatfs library

but the f_open return always FR_NO_FILE.

The file is present and it was loaded on the SD using a PC with Win7.

I tried to figure out what  is the problem and I found that inside the procedure dir_find, called from f_open,  the mem_cmp between two strings return an error.

the first string is the name of the file that I pass as a parameter in f_open

the second string is the name of the file in the directory entry.

Name of my file ''f1.pdf''

f_open string parameter = ''f1    pdf'' (insert 6 spaces between f1 and pdf (modified 8 +3) )

directory entry name = ''f1pdf ~ 1 pdf''

Obviously the two strings are the different, mem_cmp fails and the file is not found.

How can I configure fatfs for read the filename format used by Win7 for storing files?

Thanks

#lfn #fat #fatfs-filename #long-file-name
8 REPLIES 8
Posted on February 15, 2014 at 03:37

How have you set up _USE_LFN and _LFN_UNICODE ?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Evangelist
francescatodiego
Associate II
Posted on February 16, 2014 at 09:45

Uhm

....

Thanks guys for

the help

, but I'm

an idiot

I am a

Win

XP

user

....

Win7

don't show me

the file extension

The correct name of the

file

with

I was working

was ''

f1.pdf.pdf''

It's the first time I work with  FATFS and I was thinking to a configuration problem

Now works

...

I ma sorry for

the stupid

mistake

Andrew Neil
Evangelist
Posted on February 16, 2014 at 15:33

''Win7

don't show me

the file extension''

That's nothing to do with Win7; it's an Explorer  configuration option - and exactly the same behaviour can be configured on XP (in fact, I think it's the default?)

IIRC, this first appeared in Win98?

Posted on February 16, 2014 at 15:59

At a command line try also DIR /x

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
respected
Associate II
Posted on April 19, 2014 at 00:15

Hi francescato.diego

have you ever tried to change the pdf file inside?

or have you ever created a new pdf file? Is it posible? (create pdf file)

Thanks a lot

francescatodiego
Associate II
Posted on April 21, 2014 at 08:41

Hi asik

No I used a

large

pdf file

only

for testing

rd/wr on my

 

SD

+

FATFS

driver

respected
Associate II
Posted on April 23, 2014 at 11:40

If you don't mind, Can you share your code? or how is it?

Thanks.