NRF51822之pstorage使用摘要

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

转载于:https://www.cnblogs.com/libra13179/p/5391784.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值