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

write flash in ble_central\ble_app_uart_c

chip: 52832   .   sdk 12.3\examples\ble_central\ble_app_uart_c\pca10040\s132,    

i use this example to scan ble advistisment,  i want to write some date to flash,  i use flash_word_write , the mcu would restart,  i use sd_flash_write,  the mcu not restart, but seems the data havn't wroten in flash.

i just want to save some data to flash after scaned the BLE,  Can i disable the softdevie before write flash and enable softdevice after write flash?  if can how to disable?  or other methord to write data to flash after scaned ble advtisement?

Parents Reply Children
  • Hi Carey, 

    Please let me correct that:

    In the SDK 12.3.0, we use the Softdevice dispatcher for fetching the event instead of sd_evt_get().

    From ble_app_hrs example in 12.3.0:

    /**@brief Function for dispatching a system event to interested modules.
     *
     * @details This function is called from the System event interrupt handler after a system
     *          event has been received.
     *
     * @param[in] sys_evt  System stack event.
     */
    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 the dispatcher for SoC events is set up in ble_stack_init():

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

    Notice that all SoC events are forwarded to the fs_sys_event_handler(sys_evt);

    Event forwarding from the SoftDevice is done via softdevice_handler.c (under nRF5_SDK_12.3\components\softdevice\common\softdevice_handler).

    -Amanda H.

Related