fs_open -12 error using littlefs on nrf5340 custom board with w25q128

I am getteing a -12 error when trying to access a open/create a file using littlefs and a fs_open command on a nrf5340 custom board.

The filesystem seems to be mounted fine using automount:

00> [00:00:07.480,468] <dbg> app: littlefs_test: Initializing filesystem
00> [00:00:07.480,529] <dbg> app: littlefs_test: Filesystem mount point: /lfs1
00> [00:00:07.480,529] <dbg> app: littlefs_mount: /lfs1 automounted
00> [00:00:07.480,560] <dbg> app: littlefs_test: Filesystem mounted
00> [00:00:07.483,459] <dbg> app: littlefs_test: /lfs1: bsize = 512 ; frsize = 4096 ; blocks = 3072 ; bfree = 3070
00> [00:00:07.485,748] <dbg> app: lsdir: Listing dir /lfs1 ...
00> [00:00:07.486,572] <err> fs: file open error (-12)

I am getting the error in littlefs_fs.c:

		fs_file_t_init(&file);
		rc = fs_open(&file, fname, FS_O_CREATE | FS_O_RDWR);
		if (rc < 0) {
			LOG_ERR("FAIL: open [%s]: %d", fname, rc);
			return rc;
		}

Call stack is:

  • fs_open (fs.c)
  • littlefs_open (littlefs_fs.c)
  • fc_allocate (littlefs_fs.c)
  • k_heap_alloc (kheap.c)
  • k_heap_aligned_alloc (kheap.c)

I've tried with heap changes to the prj.conf : 

  • CONFIG_HEAP_MEM_POOL_SIZE=8192
  • CONFIG_HEAP_MEM_POOL_SIZE=32000

but get the same error.

Related