Skip to main content
francescatodiego
Associate III
Feb 14, 2014 10:07 PM UTC
Question

Read SD card with fatfs and win7 files names

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
This topic has been closed for replies.

8 replies

Tesla DeLorean
Guru
Feb 15, 2014 2:37 AM UTC
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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Super User
Feb 15, 2014 1:29 PM UTC
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
francescatodiego
Associate III
Feb 16, 2014 8:45 AM UTC
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
Super User
Feb 16, 2014 2:33 PM UTC
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?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tesla DeLorean
Guru
Feb 16, 2014 2:59 PM UTC
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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
respected
Associate II
Apr 18, 2014 10:15 PM UTC
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 III
Apr 21, 2014 6:41 AM UTC
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
Apr 23, 2014 9:40 AM UTC
Posted on April 23, 2014 at 11:40

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

Thanks.