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.

Compiler/CC3220SF-LAUNCHXL: File-system fragmentation for the debug trace logging

Part Number: CC3220SF-LAUNCHXL

Tool/software: TI C/C++ Compiler

Hi,


Please help me out to resolve the blocking issue with the file system.


1.  I am trying to implement Debug trace (device diagnostics) system to publish the device trace information to the cloud. (Lets say every 24 hours).

2. As application is using Hibernate feature, every 30 mins wakes up and goes back to hibernate mode.

I understood that, CC32xx/CC31xx file-system does not support fragmentation feature to append the each trace in a single file. How can i achieve this feature with / without the file-system fragmentation?

Is there anyway i can store the data to external / internal flash system which won't erase after the hibernate, or any alternate way is possible? 


Regards,
Suresh

  • Hi Suresh,

    You have options:

    With sl_ filesystem:

    • you need to read all data from log file and write them back with last record
    • you can create new file for each record

    With internal XIP flash:

    • in case of your firmware image is not bigger than 512kB, you can write some user content into XIP flash (2nd part of flash). Retention of XIP flash content is not guaranteed at all cases (it can be erased by ROM bootloader form some reasons). But for your purpose it could work. Here is described how you can write into XIP flash.

    Use additional storage:

    • connect small EEPROM or SD card to your CC32xx and use them as a storage

    Jan

  • Hi Jan,

    Thanks for your response and suggestions.

    With sl_ filesystem:

    This solution may effect the battery life as this is power constrained device.

    Is there any way without the file-system,i can access External flash? If yes please suggest any example. 

    Regards,

    Suresh

  • Hi Suresh,

    Direct access from application processor into sFlash is not supported, even it may be technically possible.

    Jan

  • Hi Jan,

    1. I am trying to implement With sl_ filesystem from your suggestions.

    My file is opened with following options:

        OpenFlags = SL_FS_CREATE;
        OpenFlags |= SL_FS_OVERWRITE;
        OpenFlags |= SL_FS_CREATE_FAILSAFE;
        OpenFlags |= SL_FS_WRITE_BUNDLE_FILE;

     

    2. Application init time, i am opening the file and writing the data, without closing the file i am resetting the device.

    3. My understanding from SL_FS_CREATE_FAILSAFE  flag is to prevent the data loss during unexpected restart of the device, but in my case its not working as expected.

    4. After reset the device,  read file causing the following issue SL_ERROR_FS_FILE_HAS_NOT_BEEN_CLOSE_CORRECTLY.

     

    Note: My intention is to prevent the data loss during unexpected reset also. Please suggest if i am missing anything.

  • Hi,

    Fail-safe feature revert to previous content of file in case of power lost during write. But if you not have saved any previous content, there is nothing to revert.

    Jan

  • Hi Jan,

    I understood, one time file close will create valid file. In my scenario it is happening , please find below code snippet

    At last read (without ) closing the file I am expecting 8 writes data, instead of i am getting only 5 writes data. What will be the expected scenario??

     

    sl_FsOpen()
    
    (lets say 5 times write )
    
    sl_FsWrite()
    sl_FsWrite()
    sl_FsWrite()
    sl_FsWrite()
    sl_FsWrite()
    
    sl_FsClose() // Have valid file + valid data
    
    sl_FsRead() // take old file buffer (5 writes data)
    
    sl_FsOpen()// open new file and 
    add 5 writes data + 3 following writes
    
    sl_FsWrite()
    sl_FsWrite()
    sl_FsWrite()
    
    reset the device ->>>>>
    
    sl_FsRead()
  • Hi,

    At your scenario it should revert content of file into state after 5x write. Content written by 3x write will be lost.

    At the 2nd open you should not use create flag just only overwrite.

    Jan

  • Hi Jan,

    sorry still i am missing something,

    So you mean to say 8x writes of data retrieving is not possible in any case even if i use fail-safe? 

  • Hi,

    Yes, that is correct.

    Content of file will be returned into state lass successful close of file.

    Jan