This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: RTOS/TM4C1294: Long file name

Part Number: TM4C1294NCPDT

Hi all,

I want to read long file name for USB flash drive using TM4C1294.

The sample codes show as below.

    DIR dirs;
    FILINFO finfo;
    char path[255] ;
    TCHAR lfname[_MAX_LFN];
    
    if (f_opendir(&dirs, path) == FR_OK)
    {

        finfo.lfname = lfname;
        finfo.lfsize = _MAX_LFN - 1;

         if(f_readdir(&dirs, &finfo) == FR_OK)
        {
            if(!finfo.fname[0])
            {
                    UartPrintf("No Data\n");
                    return;
            }
                UartPrintf("File fn: %s\n",finfo.fname);
                UartPrintf("File lfn: %s\n",finfo.lfname);
        }
        else
        {
            UartPrintf("EOF\n");
        }
    }

I can read the correct fname but the lfname is always show "???????" .

In the ffconf.h setting I modified some define value.

#define _USE_LFN 2

Should I set any other define value to let the lfname working?

Thanks for your help

Best Regards

Arthur

  • Hello Arthur,

    From what I see on the included documentation for the FatFs library used in TivaWare, LFN is not supported:

    Features of FatFs Module

    1. Separated buffer for FAT structure and each file, suitable for fast multiple file accsess.
    2. Supports multiple drives/partitions.
    3. Supports FAT12, FAT16(+FAT64) and FAT32. (FAT64: FAT16 in 64KB/cluster)
    4. Supports 8.3 format file name and NT lower case flag. (LFN is not supported)
    5. Supports two partitioning rules: FDISK and Super-floppy.
    6. Optimized for 8/16-bit microcontrollers.

    It may be possible to get this support with a newer version of FatFs but what comes with TivaWare would seem to be unable to support that feature.

    You can find this documentation at [Install Path]\TivaWare_C_Series-2.2.0.295\third_party\fatfs\doc\00index_e.html

    Best Regards,

    Ralph Jacobi