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

Pstorage operation guild

I develop my BLE with SDK 8.1 and softdevice 8.0, and I want to restore some data(about 50 bytes) to flash, can anyone please help to provide me an example for the entire process of pstorage ?

Best regards, Billy Hu

  • Hi BillyHu

    There is a pstorage example on this thread. Should be useful even though it is made for an older softdevice.

    Update 18.8.2015 I have updated the pstorage thread with pstorage example for SDK 8.1.0 and softdevice S110 8.0.0. Try to test that instead by setting a breakpoint in line 669 after loading blocks 0,1 and 2, in order to see the values of the blocks. The dest_data variables should contain the stored 16 bytes even though you set block_count = 4

  • Now I can do pstorage store ,load and update ... But When I do pstorage store and update, each time i can only store of update 4 bytes data ? pstorage_handle_t handle; pstorage_module_param_t param; uint8_t source_data[4] = {0x00, 0x01, 0x02, 0x03}; uint8_t dest_data[4];

    retval = pstorage_init(); param.block_size = 16; //Select block size of 16 bytes param.block_count = 4; //Select 10 blocks, total of 160 bytes param.cb = example_cb_handler; //Set the pstorage callback handler

    retval = pstorage_register(&param, &handle);

    Only if when i set the source_data size to 4 bytes then i can restore it, and when i set it to 8 bytes or others, the pstorage_storage function will return NRF_ERROR_INVALID_ADDR.

Related