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

can I count number of flash access command according to the amount of rquested flash data?

I want to store the max possible data on flash using pstorage, but I noticed that I have to increase the number of Maximum number of flash access commands PSTORAGE_CMD_QUEUE_SIZE to make it work (the following configuration didn't work with PSTORAGE_CMD_QUEUE_SIZE= 10). I noticed from the map file that psorage take 620 byte on RAM with PSTORAGE_CMD_QUEUE_SIZE = 30

param.block_size = 512;
param.block_count = 10;
param.cb = flash_callback_handler;

what's exactly the meaning of Maximum number of flash access commands that can be maintained by the module for all applications (why an access command is stored in RAM), and can I calculate this number according to my configuration above to reduce RAM allocation?

  • It means exactly what it says. It means how many ongoing pstorage commands can be queued up waiting for execution at any one time. If you only have one module accessing the pstorage, then you can just use '1' because you, as the only user, can wait for one to be finished and send another one. If however you have 4 separate libraries all potentially using pstorage at the same time, then you would make it '4' so they can each have one pending because none of them could know if another library is also accessing the pstorage system at the same time, so the pstorage library needs a place to keep pending entries until it's processed the previous one.

    Why is it in RAM? Where else would it be? Where do you normally put queues of things waiting to happen, you put them in RAM. Obviously you're not going to write a queue entry that you need to write something to flash, to flash.

  • when I write two sequential blocks (two consecutives store calls), does it mean I have two commands (one on going and one pending)

  • if you don't wait for the first one to finish before you write the second one then yes obviously you have to commands ongoing

Related