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

pstorage with bootloader issue

hi guys im using nrf51822 board sdk10 s130. i want to use pstorage to store some data that could be preserved even after resetting the chip or after dfu. I have gone through the infocenter page for 'Persistent storage Manager' for sdk10 and followed the api as mentioned there. Also, i have made #define DFU_APP_DATA_RESERVED 0x0800 to reserve 2 pages for the app data in the dual bank dfu project and in my project in pstorage_platform.h, I have made PSTORAGE_NUM_OF_PAGES as 2. The debugger gets stuck at pstorage_store(). I am new to pstorage and trying to wrap my head around it. I am attaching the partial code here .Kindly help me find the error in this.

code1.c

Parents
  • Hi,

    The blocking while() statements need to be removed from pstorage_store_clear_update() if you want to be able to call this function from an interrupt context. Otherwise the pstorage callback will not get through. Thus, the wait flag will not be cleared and it will become stuck in that interrupt.

    You don't need the wait statements between calls to pstorage as it's automatically added to the scheduler queue, and dequeued once the flash success event is received from the softdevice stack.

    Update:

    Attached a very simple (didn't have much time) example where pstorage is used to store some dummy data @ 0x3F800 on startup. Replace the attached file with "\nRF51_SDK_10.0.0\examples\ble_peripheral\ble_app_hrs\main.c" and make sure that PSTORAGE_NUM_OF_PAGES is set to '2'.

    main.c

  • Ok, the code size is limited to 32K for the eval version of Keil. But the return value is typically loaded into R0

Reply Children
No Data
Related