This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NRF52833 issue with BLE and corrupted internal Flash with littleFS

Hello,

I am struggle with an issue. When I enable the BLE on an nrf52833 and try to write on the internal flash with LittleFS, my flash get corrupted. I try without enable the BLE and LittfleFS worked without issue.  Also BLE is worked well.

Do you have any solutions for this problem ?

Thanks.

Best Regards,

Yoann Zamaron

  • Hi Yoann

    Which version of the nRF Connect SDK are you using?

    Are you able to provide code and configuration to replicate this behavior?

    Regards,
    Sigurd Hellesvik

  • hello,

    I am using the version 1.6.0.

    I am using this example for littlefs : https://docs.zephyrproject.org/latest/samples/subsys/fs/littlefs/README.html

    here is my prj file (not all) :

    # BLE
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="ISP308x"
    CONFIG_BT_DEVICE_APPEARANCE=833
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_MAX_PAIRED=1
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    
    #module flash
    CONFIG_FILE_SYSTEM=y
    CONFIG_FILE_SYSTEM_LITTLEFS=y

    I cannot share the ble code.

    Best Regards,

    Yoann

  • Hi

    The reason for this error is that NVS and littlefs both use "storage".

    One solution for this is to use the Partition Manager to create littlefs_storage.

    This is done by the following:

    CONFIG_PM_SINGLE_IMAGE=y
    CONFIG_PM_PARTITION_SIZE_LITTLEFS=0x6000
    

    and

    FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(littlefs_storage);
    static struct fs_mount_t lfs_storage_mnt = {
        .type = FS_LITTLEFS,
        .fs_data = &littlefs_storage,
        .storage_dev = (void *)FLASH_AREA_ID(littlefs_storage),
        .mnt_point = "/lfs",
    };

    Now you will not be able to compile due to an error in "nrf/include/flash_map_pm.h".
    To remove this error, comment away the following lines in "nrf/include/flash_map_pm.h":

     28 //#if (CONFIG_SETTINGS_FCB || CONFIG_SETTINGS_NVS) && CONFIG_FILE_SYSTEM_LITTLEFS
     29 //#error "Not supported"
     30 //#endif

    (See this similar case. for the flash_map_pm.h edit)

    Does this fix your issue?

    Regards,
    Sigurd Hellesvik

  • Hello

    sorry for my last reply, now it's WORKING well thank you very much.

    (I didn' change  storage by littlefs_storage)

    Best Regards

    Yoann

Related