This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

FATFS additional functions undefined reference

I am trying to use other functions within FATFS per example f_findfirst file on the flash and keep getting undefined reference.

I used the example application usbdc_msc which is able to list the directory and read open a file but for some reason the other functions are not working.

void fatfs_find_image_file (void)
{
FRESULT fr; /* Return value */
DIR dj; /* Directory search object */
FILINFO fno; /* File information */

fr = f_findfirst(&dj, &fno, "", "*.jpg"); /* Start to search for photo files */

NRF_LOG_ERROR("%s\n", fno.fname);

// while (fr == FR_OK && fno.fname[0]) { /* Repeat while an item is found */
// printf("%s\n", fno.fname); /* Display the object name */
// fr = f_findnext(&dj, &fno); /* Search for next item */
// }

f_closedir(&dj);
}

Parents
  • Hi,

    Is the nRF USB connected ?

    As mentioned in the example description:

    "This example allows you to manipulate the file system (on QSPI memory) only while USB is not connected. If USB is connected, access to the file system from a user application is not possible because MSC is not designed to allow access to the file system from multiple sources. To disable FatFS capabilities, set USE_FATFS_QSPI to 0."

  • USB is not connected when i am trying to use that function. it should not be connected as I am trying to locate the next file on the drive and open it for reading.

  • What did the function f_findfirst() return ?

  • It's above in the original message function can't be used cause its undefined. 

  • Ok, I see.

    You need to set the config _USE_FIND to 1 in ffconf.h to use that function.

    You can find the file ffconf.h in the folder SDK_folder\external\fatfs\src

Reply
  • Ok, I see.

    You need to set the config _USE_FIND to 1 in ffconf.h to use that function.

    You can find the file ffconf.h in the folder SDK_folder\external\fatfs\src

Children