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

How can i write 10kB of data to internal flash?

Hi,

I use nRF51822 with 256k flash and external sensor, and i want to write the data i receive from it via SPI to internal flash?

After the data received i want to send it to iOS application with s110 uart_app.

How can i do it?

P.S. I tried pstorage option but it always give me one page of 0x400 bytes. How to move to next page?

Thanks

intFlash - Copy.c intFlash - Copy.h

Parents
  • 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

    Update 1.9.2016 Here is the same pstorage example for nRF5 SDK 11

    ble_app_template_with_pstorage_operations.zip

  • hi,Stefan: how to call pstorage operation from an app timer interrupt handler without blocking.

Reply Children
No Data
Related