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.

PROCESSOR-SDK-AM64X: Using FreeRTOS API, created filename was broken.

Genius 3186 points
Part Number: PROCESSOR-SDK-AM64X
Other Parts Discussed in Thread: AM6442, SK-AM64B, TMDS64EVM

Hi

I am developing AM6442(SK-AM64B boad) R5F core with FreeRTOS API in SDK.

In mmcsd_file_io_am64x-sk_r5fss0-0_nortos_ti-arm-clang, if set over 9 letters for filename, filename was broken.

I am testing in this setting,

//in FreeRTOSFATConfig.h


#define ffconfigBYTE_ORDER                   (pdFREERTOS_LITTLE_ENDIAN)
#define ffconfigHAS_CWD                      (0U) /* Use only absolute paths */
#define ffconfigCWD_THREAD_LOCAL_INDEX       (4U)
#define ffconfigLFN_SUPPORT                  (1U)
#define ffconfigINCLUDE_SHORT_NAME           (1U)
#define ffconfigSHORTNAME_CASE               (0U)
#define ffconfigUNICODE_UTF8_SUPPORT         (1U)
#define ffconfigFAT12_SUPPORT                (0U)
#define ffconfigOPTIMISE_UNALIGNED_ACCESS    (1U)
#define ffconfigCACHE_WRITE_THROUGH          (0U)
#define ffconfigWRITE_BOTH_FATS              (1U)
#define ffconfigWRITE_FREE_COUNT             (1U)
#define ffconfigTIME_SUPPORT                 (1U)
#define ffconfigREMOVABLE_MEDIA              (1U) /* Assume media is always removable */
#define ffconfigMOUNT_FIND_FREE              (1U)
#define ffconfigFSINFO_TRUSTED               (1U)
#define ffconfigPATH_CACHE                   (0U)
#define ffconfigPATH_CACHE_DEPTH             (0U) /* Only used if ffconfigPATH_CACHE is 1 */
#define ffconfigHASH_CACHE                   (0U)
#define ffconfigHASH_FUNCTION                (0U) /* Only used if ffconfigHASH_CACHE is 1 */
#define ffconfig64_NUM_SUPPORT               (1U)
#define ffconfigDRIVER_BUSY_SLEEP_MS         (40)
#define ffconfigMALLOC( size )               malloc( size )
#define ffconfigFREE( ptr )                  free( ptr )

//in FreeRTOSFATConfigDeafaults.h

#define ffconfigMAX_FILENAME    129
#define ffconfigFAT_CHECK    0

    
// in main code (in sample i added this)

    char filename2[] = "/sd0/filename2_nametest.txt";
    char data2[] = "test2 file create sucsess!!!";

    /* Create file */
    fp = ff_fopen(filename2, "w+");

    /* Write file data */
    ff_fwrite(data2, strlen(data2)+1, 1, fp);
   // ff_fwrite(data2, strlen(data2)+1, 1, fp);

    /* Close file */
    ff_fclose(fp);

Result,Filename is broken.

I think this setting supports over 8.3 filename, but not.

I'm glad if you let me anything information.

Thanks,

GR

  • GR,

    Result,Filename is broken.

    can you please elaborate this, Please specify what errors are you getting or how do you come to this conclusion that filename is broken.

    Regards

    Anshu

  • Hi Anshu-san,

    I am colleague with GR and he is facing trouble not to access E2E now.
    I put his reply instead of him.
    ----------------------------------
    I'm using ff_open() and ff_write() to create file and write in micro SD card.
    In debugging, it seems success.
    But if the SD card connect my PC, the created filename that if over 8.3 letter is not correct.
    In my FreeRTOS Filesystem setting,  I set ffconfigLFN_SUPPORT to 1U and ffconfigFPRINTF_BUFFER_LENGTH  to  128.
    I think this setting is support up to 128 byte long filename, but in debugging it seems not supporting.

    I'm glad if you let me anything information.
    ----------------------------------
    Best Regards,
    Yaita

  • Yaita-san

    GR and he is facing trouble not to access E2E now.

    Please let me know what error is he facing, we will try to investigate.

    on the Filename Broken issue, do you have a sample application where you are seeing the error. it will help us debug the issue faster.

    also please mention the make and model of SD Card being used.

    Regards

    Anshu

  • Hi Anshu-san,

    I put the information as the following.

    [sample project]
    I tested both SK-AM64B and TMDS64EVM.
    ti/mcu_plus_sdk_am64x_08_06_00_43/examples/drivers/mmcsd/mmcsd_file_io/am64x-evm/r5fss0-0_nortos
    ti/mcu_plus_sdk_am64x_08_06_00_43/examples/drivers/mmcsd/mmcsd_file_io/am64x-sk/r5fss0-0_nortos

    [micro SD card]
    I used the micro SD card that is included with EVM.
    SanDisk EDGE 16GB

    Best Regards,
    Yaita

  • Thanks yaita san,

    we will run the example at our end and get back to you.

    Regards

    Anshu

  • Hello GR,

    The issue is coming because of the character encodings. I think the FreeRTOS_FAT encodes the given filenames in such an UTF encoding which Windows or Linux also has trouble decoding. Since, we are only using ASCII characters in the filename, it is best to tell the FreeRTOS_FAT to use ASCII character set only. I have attached below the changes for the same.

    diff --git a/source/fs/freertos_fat/config/FreeRTOSFATConfig.h b/source/fs/freertos_fat/config/FreeRTOSFATConfig.h
    index 8f3e5bdb7..23dbb71f9 100644
    --- a/source/fs/freertos_fat/config/FreeRTOSFATConfig.h
    +++ b/source/fs/freertos_fat/config/FreeRTOSFATConfig.h
    @@ -39,7 +39,7 @@ extern "C"
     #define ffconfigLFN_SUPPORT                  (1U)
     #define ffconfigINCLUDE_SHORT_NAME           (1U)
     #define ffconfigSHORTNAME_CASE               (0U)
    -#define ffconfigUNICODE_UTF8_SUPPORT         (1U)
    +#define ffconfigUNICODE_UTF8_SUPPORT         (0U)
     #define ffconfigFAT12_SUPPORT                (0U)
     #define ffconfigOPTIMISE_UNALIGNED_ACCESS    (1U)
     #define ffconfigCACHE_WRITE_THROUGH          (0U)
    

    After doing these changes and rebuilding the FreeRTOS_FAT library and MMCSD example, the MMCSD example runs successfully. And the Windows correctly displays the names as shown

    Regards,

    Prashant

  • Prashant san

    Thank you for your update.

    Yaita san is one of my colleague.
    We works with this together.

    On your reply and your test environment, it might operate normally.
    However, it occurs garbled text on our environment with the same setting which you shared.

    We would like to check that the problem is caused by AM64 program issue or test(operation) environment(your side : English Windows, our side : Japanese
    Windows).

    Therefore, could you evaluate the our program?
    We sent you following two files as followings ; 

    mmcsd_file_io_am64x-sk_r5fss0-0_nortos_ti-arm-clang.appimage.zip : Image file after build(we can send with ".hs_fs", so we change it .zip file)
    mmcsd_file_io_debug.zip : Exported CCS project

    mmcsd_file_io_debug.zip
    mmcsd_file_io_am64x-sk_r5fss0-0_nortos_ti-arm-clang.appimage.zip


    Kind regartds,

    Hirotaka Matsumoto

  • Hello Hirotaka-san,

    I see the same issue on my side with your shared images but do not see the issue with my built images. Could you please once test the below attached MMCSD example built on my side and let me know if this works.

    mmcsd_file_io.zip

    Regards,

    Prashant

  • Hi Prashant san

    Due to TI account trouble at Japanese distributor, Matsumoto san had been posting on our behalf,

    but now that my account is available, I am posting from my own account.

    --

    Thank you to testing my project.

    In my enviroment, Your example doesnot works right.

    The filename was broken.

    Could you let me your CCS setting(e.g. FreeRTOS version, SDK version, CCS version,..)?

    My enviroment is this,(I tested both FreeRTOS 202312.00, 202212.01 )

    Best regards,

    GR

  • Hello GR san,

    Could you please confirm if you are rebuilding the example on your side and then using the built appimage to test the example?

    If yes, please note I shared the already built example and so it contains the built appimage. This is shown below

    I would like you to test this "mmcsd_file_io.debug.appimage.hs_fs" since you are using HS-FS board. For convenience, I have now attached the image itself to test.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/mmcsd_5F00_file_5F00_io.debug.appimage.hs_5F00_fs

    Regards,

    Prashant

  • Hi Prashant san,

    I'm sorry to I tested your project after re-built in my envirment.

    And thanks to send your .appimage.

    I tested your .appimage on my SK-AM64 EVM. As a result, program was works good!
    --

    In this stuation, I think the probrem cause my build envirment.

    Could you let me your CCS setting?

    Thanks,

    GR

  • Hello GR san,

    I tested your .appimage on my SK-AM64 EVM. As a result, program was works good!

    This is good news. We can now work on what's going wrong in your build environment.

    Could you let me your CCS setting?

    I think this should not be causing the problem here. My guess is the problem is with the incorrect build of the freertos_fat library. Let us first make sure that the freertos_fat library is built correctly on your side. If this then does not work, we can look at other things like CCS settings.

    Rebuilding the freertos_fat library

    The important step in rebuilding the freertos_fat library is to make sure we are building it for the right profile.

    If let's say we are building the MMCSD example for debug profile which is the default in CCS unless changed. In that case, we have to rebuild the freertos_fat library for the debug profile too by passing PROFILE=debug argument to the build command. In case we are building for release profile, we pass PROFILE=release argument to the build command.

    For example, with the freertos_fat library makefile located at <MCU+ PATH>/source/fs/freertos_fat/makefile.am64x.r5f.ti-arm-clang, the build command for debug profile would be:

    cd ${MCU+ SDK Path}
    gmake -s -C source\fs\freertos_fat -f makefile.am64x.r5f.ti-arm-clang PROFILE=debug all

    Let me know if even after the suggested changes & rebuilding the freertos_fat library for the right profile, the issue persists.

    Regards,

    Prashant

  • Hello Preshant san,

    Thank you to your support.

    I could build image that output correct filename by rebuild the library!

    supplement:

    I had use "make" command to rebuilt the librarys.

    Best regards,

    GR

  • Hello GR san,

    It's good to know that it worked on your side now. I am glad that I could be of help!