Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF51822 SDK 12.3.0 SD 130 fstorage crashes after BLE disconnect

Hi,

I am trying to use the fstorage lib in SDK 12.3.0. My code is based on this example: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v12.3.0%2Flib_fstorage.html&cp=4_0_5_3_38 .

I am initializing fstorage in main() right before entering the main loop. If I write anything to flash in my main loop while the device is connected to another device, the application runs normally until the peer disconnects. Normally the device should start advertising again, but it seems to be stuck in a SD function and never returns. I am only trying to write one word of data at this point.

static void fs_evt_handler(fs_evt_t const * const evt, fs_ret_t result)

{

    if (result != FS_SUCCESS)

    {

        // An error occurred.

    }

}

FS_REGISTER_CFG(fs_config_t fs_config) =

{

    .callback  = fs_evt_handler, // Function for event callbacks.

    .num_pages = 1,       // Number of physical flash pages required.

    .priority  = 0xFE            // Priority for flash usage.

};

void flash_write() {

static uint32_t data = 0xAAAAAAAA;

fs_ret_t ret = fs_store(&fs_config, fs_config.p_start_addr, &data, 1, NULL);

if (ret != FS_SUCCESS)

{

    // An error occurred.

}

}

Thanks for your help,

   Thilo

Parents Reply Children
No Data
Related