This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

FAT file error

Hi,

we are trying to use FAT file in nRF9160. Referring the test case in "ncs\zephyr\tests\subsys\fs\multi-fs\src" to mount the FAT file.

But getting an error like "ff.h" not found:

../src/main.c:24:10: fatal error: ff.h: No such file or directory
#include <ff.h>

Code tried:

#define FATFS_MNTP "/RAM:"
#define TEST_FILE FATFS_MNTP"/testfile.txt"
#define TEST_DIR FATFS_MNTP"/testdir"
#define TEST_DIR_FILE FATFS_MNTP"/testdir/testfile.txt"

static FATFS fat_fs;

static struct fs_mount_t fatfs_mnt = {
.type = FS_FATFS,
.mnt_point = FATFS_MNTP,
.fs_data = &fat_fs,
};

void main(void)
{
int res;
res = fs_mount(&fatfs_mnt);
if (res < 0) {
printk("Error mounting fs [%d]\n", res);
return 0;
}}

Help us to resolve the error or please point us to the sample code/application to store the content in file system.

And what all are ways to persist  the settings/content in nRF9160 ?

Thanks,
Bala

 

Parents
  • Hi  I'm having a similar issue.  I've opted to download the ELMFAT source myself and include it in the src and include directories in order to access a FAT32 filesystem on an SD card.  It appears through the zephyr/samples/subsys/fs example that the system should detect a SDHC card at boot, but I'm having trouble understanding how/where the subsystem does this automatically.  I understand that the system should understand through the device tree that the SDHC card is available on a SPI interface, but from there I am having difficulty understanding how to debug either the interface or system detection.

    Per the documentation, it appears by using the following configs and device overlay zephyr should be able to auto-register the SDHC:

    CONFIG_GPIO=y
    CONFIG_SPI=y
    CONFIG_SPI_1=y
    CONFIG_SPI_1_NRF_SPIM=y
    CONFIG_DISK_ACCESS=y
    CONFIG_DISK_ACCESS_SDHC=y
    CONFIG_DISK_ACCESS_SPI_SDHC=y
    CONFIG_DISK_SDHC_VOLUME_NAME="SD"
    CONFIG_LOG=y
    CONFIG_FILE_SYSTEM=y
    # CONFIG_FAT_FILESYSTEM_ELM=y
    CONFIG_PRINTK=y

    &spi1 {
    status = "ok";
    sck-pin = <13>;
    mosi-pin = <11>;
    miso-pin = <12>;
    ss-pin = <10>;
    };

    &spi1 {
    status = "ok";
    cs-gpios = <&gpio0 10 0>;

    sdhc0: sdhc@0 {
    compatible = "zephyr,mmc-spi-slot";
    reg = <0>;
    status = "ok";
    label = "SDHC0";
    spi-max-frequency = <1000000>;
    };
    };


Reply
  • Hi  I'm having a similar issue.  I've opted to download the ELMFAT source myself and include it in the src and include directories in order to access a FAT32 filesystem on an SD card.  It appears through the zephyr/samples/subsys/fs example that the system should detect a SDHC card at boot, but I'm having trouble understanding how/where the subsystem does this automatically.  I understand that the system should understand through the device tree that the SDHC card is available on a SPI interface, but from there I am having difficulty understanding how to debug either the interface or system detection.

    Per the documentation, it appears by using the following configs and device overlay zephyr should be able to auto-register the SDHC:

    CONFIG_GPIO=y
    CONFIG_SPI=y
    CONFIG_SPI_1=y
    CONFIG_SPI_1_NRF_SPIM=y
    CONFIG_DISK_ACCESS=y
    CONFIG_DISK_ACCESS_SDHC=y
    CONFIG_DISK_ACCESS_SPI_SDHC=y
    CONFIG_DISK_SDHC_VOLUME_NAME="SD"
    CONFIG_LOG=y
    CONFIG_FILE_SYSTEM=y
    # CONFIG_FAT_FILESYSTEM_ELM=y
    CONFIG_PRINTK=y

    &spi1 {
    status = "ok";
    sck-pin = <13>;
    mosi-pin = <11>;
    miso-pin = <12>;
    ss-pin = <10>;
    };

    &spi1 {
    status = "ok";
    cs-gpios = <&gpio0 10 0>;

    sdhc0: sdhc@0 {
    compatible = "zephyr,mmc-spi-slot";
    reg = <0>;
    status = "ok";
    label = "SDHC0";
    spi-max-frequency = <1000000>;
    };
    };


Children
Related