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

Advertising won't start when using Pstorage

Hi,

Before starting advertising using advertising_start() function, if pstorage function is used to write data, then it gets stuck at that point as no pstorage handler callback is received and BLE advertising mode never starts. The code is similar to what is mentioned on this thread. devzone.nordicsemi.com/.../

Please let me know the reason why this is happening. I am using S130 and SDK 11.

Parents
  • Hi,

    Issuing a softdevice flash operation should always lead to a system event that tells the application whether the operation succeeded or not. This " system" event is reported to the registered system event handler (softdevice_sys_evt_handler_set()), which should forward it to the pstorage_sys_event_handler(), and then forward it to the pstorage callback you have declared.

    One possible reasons for it the event to not be reported is if the pstorage_sys_event_handler() is not called upon system events. E.g., forgetting to add pstorage_sys_event_handler() here:

    static void sys_evt_dispatch(uint32_t sys_evt)
    {
        pstorage_sys_event_handler(sys_evt);
    }
    

    Another possibility is that if you are using a blocking function like 'while(pstorage_wait_flag)' from an interrupt context. That would stop any new system events from being serviced (flash events has the lowest interrupt priority). In other words, the event will never get through in such case.

  • Okay thanx. Also the Load callback is not showing the correct data which is being stored. What could be the reason for that.

Reply Children
No Data
Related