https://devzone.nordicsemi.com/question/15271/how-can-i-write-10kb-of-data-to-internal-flash/?answer=17300#post-id-17300
Hi
You can register for more than one page with a single pstorage_register command. Then you can write to more than one page, but the following rules apply:
- One pstorage_clear command can only clear data within the same page
- One pstorage_update command can only update data within the same page
- One Pstorage_store command can only write data to a single block
- One pstorage_load command can only read data from a single block
Also, when registering-than a single page, registered blocks must is page aligned.
e.g. registering blocks each with the bytes is registering the whole pages since 128 * 16=2048. It is also page aligned since each page is a bytes and 8*128=1024.
To clear the both pages you must issue and clear commands:
pstorage_clear(&block_0_handle, 1024); pstorage_clear(&block_8_handle, 1024);
Update 28.10.2014 I include a pstorage sample code below. Hopefully you can use this code to overcome your issues. Report back with any complications.
Ble_app_template_with_flash_operations.zip
Update 27.3.2015 The example above is tested with SDK 6.1, Softdevice 7.0.0/7.1.0 and second revision nRF51 harware. It should also work with SDK 6.1, Softdevice 7.1.0, and third revision nRF51. For further compatibility of different SDKs and softdevices, and to see the nRF51 hardware revision of the Chip/board has, see nRF51 compatibility matrix
Update 18.8.2015 Below is a similar pstorage example made for SDK 8.1 and Softdevice S110 8.0.0
Ble_app_template_with_pstorage_operations_nrf51dk.zip
Update 22.1.2016 Below is another pstorage example for SDK 8.1 and Softdevice S110 8.0.0. Tested on NRF51-DK board. This example writes pstorage The result on the UART (instead of Segger RTT as in example from 18.8.2015). You can see the result in a UART terminal as e.g. Realterm (38,400 BAUD; no parity; 1 stop bit; flow control enabled).
Ble_app_template_with_pstorage_sdk_8_1_0.zip
Summary of the use of NRF51822 pstorage