Skip to main content
GreenGuy
Senior III
April 6, 2018
Question

f_print vs F_write in FatFs

  • April 6, 2018
  • 1 reply
  • 1901 views
Posted on April 06, 2018 at 07:04

I am working with F746G-Discovery board running the project application FatFs_uSD built in the repository.  The application runs using the code as is which writes the data to the uSD with the f_write function.  There is also a f_printf function in ff.c.  When I try to call it from main the compiler throws an error indicating the function is not defined.  This is odd since it is in the same ff.c file.  The function is declared in both the ff.h and ff.c and the function is not static.  I checked to see if possibly the directory where the ff.c and ff.h are contained are not in the includes directory list.  Sure enough the folder is not in the list.  So I added it but the same result occurs.  So why is the compiler giving the error?  And why is the f_write not coming up as undefined when the directory containing the files are not in the include list.  I even tried #include 'ff.h' in the top of main and still the errors occurs with f_printf. 

Comments?

PS. ff.c and ff.h are in the Middlewares>FatFs>Core folder in the repository.

    This topic has been closed for replies.

    1 reply

    Tilen MAJERLE
    ST Employee
    April 6, 2018
    Posted on April 06, 2018 at 07:10

    f_printf is 'extended string' function, available in FATFS at specific configuration:

    http://elm-chan.org/fsw/ff/doc/printf.html

    , check QuickInfo information.

    Keep in mind that f_printf calls write function for every character which may cause low-throughput. To keep good throughput, FATFS uses internal sector caches. Try to avoid using this function if possible.

    GreenGuy
    GreenGuyAuthor
    Senior III
    April 9, 2018
    Posted on April 09, 2018 at 16:09

    Great to know, but the original questions remain unanswered.

    Andrew Neil
    Super User
    April 9, 2018
    Posted on April 09, 2018 at 16:18

    Note that FatFs is an independent, 3rd-party product - nothing to do with ST.

    So specific question should really be directed to the FatFs forum - see:

    http://elm-chan.org/fsw/ff/00index_e.html

    But the key to your question is probably here:

    Majerle.Tilen

    wrote:

    ... available in FATFS at specific configuration

    .

    (my emphasis)

    So - do you have the correct configuration for f_printf to be available?

    See the link to the FatFs documentation which

    Majerle.Tilen

    ‌ provided.

    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.