This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

pstorage_store vs pstorage_update

Hi.

I have been trying to store data in flash by using pstorage. What's the difference between pstorage_store and pstorage_update?

At the first time, I can save data by pstorage_store without error at the callback function. But if I try to save data again at the same block, the data is not saved even though there is no error at the callback function.

And when I use pstorage_update instead of pstorage_store, I get 0x11(Edited : NRF_ERROR_BUSY) error even though I don't get any error when I use the same data for pstorage_store.

Any idea on what is happenning here?

My development environment:

・nRF51822 Developer Kit

・iOS 7.1 iPhone5s

・nRF6310 Rev 1.4

・S110-SD-v6

  • Do you mean 0x11 is the error code? That's NRF_ERROR_BUSY (17) not NRF_ERROR_INVALID_DATA (11). The documentation says that NRF SoC flash errors can be returned and indeed sd_flash_write can return NRF_ERROR_BUSY if the previous operation hasn't completed.

  • Hi, RK. Thank you for your reply. You are right. That was a quite silly mistake.... The error means actually NRF_ERROR_BUSY as you mentioned.

    But still I don't understand why I keep getting NRF_ERROR_BUSY error. I tried using nrf_delay_us and/or timer but still I get NRF_ERROR_BUSY error.

    I also tried like this :

    uint32_t    count  = 1; 
    while(count > 0){
    	pstorage_access_status_get(&count);
    }
    

    But this loop won't finish....

    Do you know how to handle this issue?

    Edit : It turns out that this is a bug of SDK(pstorage.c). Just add

    retval = NRF_SUCCESS;

    to line 379 of pstorage.c. It should look like this :

    if (retval != NRF_ERROR_BUSY) {
         app_notify (retval); 
    } else  {   
         // In case of busy next trigger will be a success or a failure event.           
         retval = NRF_SUCCESS;
    }
    
  • I don't know what the problem is, just noticed the error message was possibly wrong and thought that might help someone else figure out what the issue was.

    I assume you have the softdevice enabled and you have registered for events and you are calling the pstorage event handler as you're required to do. I'm sure you are, again just asking questions to see if anything obvious comes up.

  • Is this an official bug? thx for sharing

  • You are welcome :) This is an official bug and the way to kill the bug was given by Nordic.

Related