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 for more than a single page, registered blocks must be page aligned.

E.g. registering 16 blocks each with 128 bytes is registering two whole pages since 128 * 16=2048. It is also page aligned since each page is 1024 bytes and 8*128=1024.

To clear the two pages you must issue two 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 that 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 hardware. For further compatibility of different SDKs and softdevices, and to see the nRF51 hardware revision of the chip/board you have, 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 result on 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

posted on 2016-04-14 17:01  陌鉎こ城sHi  阅读(1881)  评论(0编辑  收藏  举报