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

only getting pstorage callbacks with read

Hello,

I have read through the pstorage documentation here: devzone.nordicsemi.com/.../a00018.html

and I followed the tutorial here: devzone.nordicsemi.com/.../

I have implemented pstorage with ble_app_template from SDK 0.9.2 and softdevice S132 (version 1.0.0.3). I am using the nRF52 dev board with the PCA10036. I am able to write and then read successfully if I do flash once, but if i change the data that I am trying to write (called dummy_data in the example from the devzone i referenced above), the data read back will be the data from the previous write, and the read won't change to the new data unless I erase the full chip in nRFgo studio. I figured this is because I need to clear the memory blocks before I use them. Eventually, I added the memory clear (for all blocks in the module) in the code before I perform pstorage operations, but it does not properly clear the memory (whenever I try to read a byte from a block, it comes back as 255).

Everytime I call pstorage load, clear, store, or register, I always get an NRF_SUCCESS error code back.

But my problem seems to be similar to the one shown here: devzone.nordicsemi.com/.../

I am getting an event callback for pstorage_load commands, but for pstorage_store and pstorage_clear, I am not getting an event callback.

I did do the following:

  1. set sys_evt_dispatch with softdevice_sys_evt_handler_set and added pstorage_sys_event_handler to sys_evt_dispatch.
  2. I have the softdevice_handler module and all its dependencies included
  3. The SD_EVT_IRQHandler is not being overwritten in main.c

So I am not sure why I do not get callbacks for store and clear, or why the blocks do not clear properly.

Thanks in advance.

  • When flash is cleared the bits will be 1, so 255 is correct. pstorage_load is just a memcpy, so it doesn't need to wait for the flash operation to finish, while pstorage_store and pstorage_clear will have to wait. I syuspect the system events from the SoftDevice is not forwared properly to the pstorage module. I'm not sure why. Would it be possible for you to upload your complete project so I can't have a look at it?

Related