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

nrf51822 pstorage problem - no processing of enqueued calls

I would like to store some configuration data on non-volatile memory in nrf51822. I'm using pstorage library to access flash, but I have problem with api calls. What I am doing, is:

  1. pstorage_init()
  2. pstorage_register() (my callback function is almost empty, just some serial-debug - should it do some particular operations? )
  3. pstorage_load() - just some 0xff's loaded, so i think it works correctly
  4. Now i try to call pstorage_clear or pstorage_store/update (what's the difference?) - each call returns succesfully, but i think it is not executed - just enqueued. When i wait for them to finish, I got stuck in this loop.
do{
        pstorage_access_status_get(&ops_count);
    }
    while(ops_count!=0);

Any idea, what i have could missed? I am using SDK 5.2.2 and S110 ver 6.0.0 softdevice

Best regards,

Wojtek

edit. Also, I mixed some pstorage calls code with timers and NRF_ERROR_NO_MEM occured while scheduling timer stop function.

  • Did you also call pstorage_block_identifier_get() after pstorage_register()? This yields a block handle from the base handle. You want to use the base handle as a parameter when calling pstorage_clear() but the block handle in pstorage_store().

    Hope this helps you - Dan

  • Thank You Dan,

    Actually, I forgot about that function, BUT I am using only one block, so block handle i received is the same as base handle i was using before (block_id 0x0003F400 in both structures). It helped, but didn't solve the problem yet :/

    Edit. Ok, my problem is solved :)

    In SDK documentation there was annotation in pstorage_clear, that says:

    The size parameter of pstorage_clear is currently unused, any value provided will not have any impact on the behaviour of this API.

    But that actually is not 100% true - it has to be called properly.

    Now, everything works.

Related