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

Fstorage queue

nRF52832 SDK14.0

Hi,

I had two questions regarding Fstorage:

  1. The Fstorage module works by having a queue of NVM operations. This queue only holds two types of operations: Erase and Write operations. It doesn’t hold any read operations in the queue. Is this correct? If it is, what happens if there are multiple read requests at the same time?

  2. When using the Fstorage module using the NVMC backend, it doesn’t seem like it has a queue of operations. What happens if there are multiple write requests from multiple clients?

Thank you.

  • Hi,

    1. Read operations are always blocking function calls when using Fstorage, regardless of backend. Multiple reads from the same address should not be an issue if using threading.
    2. Write and Erase operations are blocking when using the NVMC backend with Fstorage. The function calls will not return until the operations are completed. Note that the event is still passed to the event handler when operation is completed. The write/erase operations are protected by the flash_operation_ongoing flag, to prevent multiple users to perform flash operations simultaneously.

    Best regards,

    Jørgen

  • Thanks for getting back so quickly, Jørgen.

    1. So if I am reading lots of data from flash, let's say a page or 2 pages worth of data, I would be blocked for that amount of time and the CPU cannot do anything?

    2. Thanks. For the SD backend, does it mean that if I send in multiple write and/or erase requests, they will be added to a queue and serviced in a FIFO manner? Also, the event handler doesn't notify when there is a succesful read operation. It only sends events for writes and erase operations. Is that correct?

    Thank you, Jørgen, for all of your help.

    1. Yes, this is correct. Read operations are implemented using memcpy function, and will block until read is completed.
    2. The write/erase operations will be executed using the Softdevice Flash API for safe writing. If multiple operations are scheduled, they will be executed in FIFO order. Read operations were previously not part of Fstorage, as it is a trivial operation to read from flash. No events have been added at this point, as it does not take the same amount of time to read as it does to write/erase flash.
Related