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

fstorage not initializing properly in my app

I want to store two floats and one 8 character string in fstorage.

I solved it by using 4 uint32 types stored in flash, I got it working in the ble_app_template example, but when I try to implement the same in my own app, the callback is not run, leaving my app to wait for event forever..

I noticed that the address is different in the two, in the ble_app_template it's stored in 0x79000, while in my app it's stored in 0x7C000. My app is built on ble_peripheral/ble_app_uart

SDK: 12.2

Any insight?

Parents Reply Children
  • Nope!

    Added

    static void sys_evt_dispatch(uint32_t sys_evt)
    {
        // Dispatch the system event to the fstorage module, where it will be
        // dispatched to the Flash Data Storage (FDS) module.
        fs_sys_event_handler(sys_evt);
    
        // Dispatch to the Advertising module last, since it will check if there are any
        // pending flash operations in fstorage. Let fstorage process system events first,
        // so that it can report correctly to the Advertising module.
        ble_advertising_on_sys_evt(sys_evt);
    }
    

    and

    static void ble_stack_init(void){
    .....
    // Register with the SoftDevice handler module for BLE events.
    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
    APP_ERROR_CHECK(err_code);
    }
    

    Now it seems to work :) Thank you

  • FormerMember
    0 FormerMember in reply to FormerMember

    Good that it is working :) This answer explains why fs_sys_event_handler() should be added to sys_evt_dispatch().

Related