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

Problems with using Flash and fstorage

I am playing with flash and fstorage lib. I finally got it up and running - I can write and read to flash without having fatal errors. But it's not working as expected. I write "hello world" to 0x3E000 and right after I read some crappy string from that address.

So I tried the flash_fstorage example, compiled and run and I can see the same behaviour. See the output from the logs:

What is going wrong? Do I have my flash somehow corrupted?

Thank you.

EDIT 1:

I tested with another board. I erased the memory (make erase) and then flashed and run the flash_fstorage. The result is the same, only the string that I read back is different: "hL(o world".

EDIT 2:

nrf_fstorage_write() fires a NRF_FSTORAGE_EVT_WRITE_RESULT event which I can handle with evt_handler() from NRF_STORAGE_DEF. But nrf_fstorage_read() DOES NOT fire any event of this type - the evt_handler is not called. Why?

This is my evt_handler implementation:

Parents
  • FormerMember
    0 FormerMember

    If it is okay to use FDS (recommended), this thread contains a simple read/write example.

Reply
  • FormerMember
    0 FormerMember

    If it is okay to use FDS (recommended), this thread contains a simple read/write example.

Children
  • I understood it so that FDS is an abstraction library based on fstorage. And currently I can't get correct results even with fstorage. Using FDS should not answer my question, hm?