I worked on a board including a NRF52 and use the file system with NFFS but I never succeed in using it correctly.
I have a lot of errors depending on the configuration parameters that I set.
I reduce my problem to a little test that only writes in a loop 12 bytes in a single file. It fails very quickly.
Sometimes the operation seems good when checking the return value. However the file became a file of size null and a new file with another name appears with the previous file. Then some loops later, there is an error
in a return value of the write function.
I tried to modify NFFS configuration.
In the two cases when the CONFIG_NFFS_FILESYSTEM_MAX_BLOCK_SIZE is higher and when
the global size of the file system is higher ; the test is good during a longer time before failing.
If I write 24 instead of 12 bytes or if I write in two files instead of one, the issue comes sooner.
I think something in my configuration (or in my software) is wrong. If someone can help me it would be very helpful.
Attached is the little test and the conf file. To reduce the time before failing, I change the file system size to 0x2000.
Here is my configuration (I don't use MCU_BOOT) :
In the dts file :
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0xc000>;
};
slot0_partition: partition@c000 {
label = "image-0";
reg = <0x0000C000 0x32000>;
};
slot1_partition: partition@3e000 {
label = "image-1";
reg = <0x0003E000 0x32000>;
};
scratch_partition: partition@70000 {
label = "image-scratch";
reg = <0x00070000 0xa000>;
};
#if defined(CONFIG_FS_FLASH_STORAGE_PARTITION)
storage_partition: partition@7a000 {
label = "storage";
reg = <0x0007a000 0x00002000>;
};
#endif
};
In the conf file :
CONFIG_SOC_FLASH_NRF=y
CONFIG_FS_NFFS_NUM_BLOCKS=1024
CONFIG_FS_NFFS_NUM_INODES=1024
CONFIG_FS_NFFS_NUM_CACHE_BLOCKS=1
CONFIG_FS_NFFS_NUM_CACHE_INODES=1
CONFIG_FS_NFFS_NUM_DIRS=4
CONFIG_FS_NFFS_NUM_FILES=4
CONFIG_FS_NFFS_NUM_INODES=64
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_NFFS_FILESYSTEM_MAX_AREAS=12
CONFIG_NFFS_FILESYSTEM_MAX_BLOCK_SIZE=128
CONFIG_FS_FLASH_STORAGE_PARTITION=y
CONFIG_SOC_FLASH_NRF_RADIO_SYNC=y
In the CMakeLists.txt :
set(BOARD nrf52_pca10040)
target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/ext/fs/nffs/include)
target_link_libraries(app NFFS)
Thanks in advance for any help.
Regards,
Laurence