Enabling filesystem, disk and sdmmc makes system fail before any application code is called,

Hi,

I want to enabe filessytem, diskaccess and sdmmc on nrf5340 in order to save data on a SDCARD via SPI.

I have added the following to my proj.conf

CONFIG_DISK_ACCESS=y
CONFIG_DISK_DRIVERS=y
CONFIG_DISK_DRIVER_SDMMC=y

# Enable file system support (optional, if you want to use a file system)
CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y
CONFIG_FS_FATFS_MOUNT_MKFS=y

CONFIG_FS_FATFS_LFN=y
CONFIG_FS_FATFS_EXFAT=y
I have not added anything to the development tree, nor have i added any code using any of these interfaces. 
Nevertheless when i try to boot, both fs and bt_enable() fails and it is impossible to even get the debugger connected to step through the code. System is build with -Og.
[00:00:00.399,353] <err> fs: mount point not found!!
[00:00:00.399,475] <err> fs: mount point not found!!
[00:00:00.399,475] <err> bt_settings: settings_subsys_init failed (err -2)
[00:00:00.399,536] <err> Application: Bluetooth init failed (err -2)
I have tried to bump the stack to 64kB, just to see if that was the problem - no luck.
Can you please explain what the problem is?
br,brian

Top Replies

Parents Reply
  • As described, i already did that - encountered this problem and isolated it to just enabling the defines. I have retried and i can init SD card and mount FS. 

    However i debugged it a little further (in the scenario where my SDCARD is initialised and mounted)The problem arises when FS is enabled together with CONFIG_BT_SETTINGS

    So: 

    CONFIG_BT_SETTINGS=y
    CONFIG_SETTINGS=y
    and:
    CONFIG_DISK_ACCESS=y
    CONFIG_FILE_SYSTEM=y
    CONFIG_FAT_FILESYSTEM_ELM=y

    Then the following chain of events plays out:


    bt_settings_init() 
    settings_subssy_init()
    settings_store_init()
    settings_backend_init(void) (in zephyr/subsys/settings/src/settings_file.c)
    settings_mount_file_backend()
    mkdir_if_not_exists()
    fs_mkdir() returns -2

    This apparently works when FS configs are not set.

Children
Related