I am trying to mimic the "hello world" example on the "Using Spiffs" wiki page, but I don't get far:
In a separate test program, I erase the flash. Then...
Mount fails as expected
Unmount is ok
Format is ok
Trying to mount again fails with the error SPIFFS_NOT_A_FS
If I set SPIFFS_USE_MAGIC to 0 (to see what will happen), I get farther:
In a separate test program, I erase the flash again. Then...
Mount fails as expected
Unmount is ok
Format is ok
Re-mount is ok
I can open my_file (with flags SPIFFS_CREAT | SPIFFS_TRUNC | SPIFFS_RDWR)
I can write to and close "my_file" with "Hello world" in it
I can re-open the file (with flags SPIFFS_RDWR), but...
I cannot re-read from the file: SPIFFS_read fails with SPIFFS_ERR_DELETED
If I try to run the test program again (withOUT erasing flash, just running the program again), it fails at the first SPIFFS_open call (with the flags SPIFFS_CREAT | SPIFFS_TRUNC | SPIFFS_RDWR), again with the SPIFFS_ERR_DELETED error.
FWIW, I have tried that test program both with and without calling SPIFFS_fflush before calling SPIFFS_close, and it did not help.
So, I am hoping someone has a suggestion about what might be wrong.
Full disclosure -- I've also been working with littlefs and have had problems there, too, so that tells me something very basic is wrong, but I can't figure it out. I can run a test program where I erase/write/re-read the flash directly through our flash driver, and that works.
Any help is appreciated! I am new to firmware development and have not worked with flash before, so no suggestion is too simple. For example, at the flash driver level, I do check the Write In Progress bit before returning to the caller, but I did not at first, so asking me if I had would have been reasonable!
Hi, we've been having same issues like you've reported. Getting SPIFFS_NOT_A_FS after mounting, getting SPIFFS_ERR_DELETED when opening a file.
Were u able to solve this, and how?
Hi spiffs, I'm having trouble with my spiffs test program, and I'm hoping someone can help.
Here's my configuration:
define SPIFFS_USE_MAGIC (1)
define SPIFFS_USE_MAGIC_LENGTH (1)
define SPIFFS_SINGLETON 1
define SPIFFS_CFG_PHYS_SZ(ignore) (2 1024 1024) // only using 2MB of 8MB for my test
define SPIFFS_CFG_PHYS_ERASE_SZ(ignore) (4*1024) // the flash supports 32k and 64k erase commands, but we want to use 4k
define SPIFFS_CFG_PHYS_ADDR(ignore) (0)
define SPIFFS_CFG_LOG_PAGE_SZ(ignore) (256) // Flash page size
define SPIFFS_CFG_LOG_BLOCK_SZ(ignore) (4*1024)
I am trying to mimic the "hello world" example on the "Using Spiffs" wiki page, but I don't get far:
If I set SPIFFS_USE_MAGIC to 0 (to see what will happen), I get farther:
If I try to run the test program again (withOUT erasing flash, just running the program again), it fails at the first SPIFFS_open call (with the flags SPIFFS_CREAT | SPIFFS_TRUNC | SPIFFS_RDWR), again with the SPIFFS_ERR_DELETED error.
FWIW, I have tried that test program both with and without calling SPIFFS_fflush before calling SPIFFS_close, and it did not help.
So, I am hoping someone has a suggestion about what might be wrong.
Full disclosure -- I've also been working with littlefs and have had problems there, too, so that tells me something very basic is wrong, but I can't figure it out. I can run a test program where I erase/write/re-read the flash directly through our flash driver, and that works.
Any help is appreciated! I am new to firmware development and have not worked with flash before, so no suggestion is too simple. For example, at the flash driver level, I do check the Write In Progress bit before returning to the caller, but I did not at first, so asking me if I had would have been reasonable!