NRF_EVT_FLASH_OPERATION_SUCCESS event never fired

I am using the following code to enable the softdevice s130, which seems to run successfully:

    err_code = softdevice_enable(&ble_enable_params);
    APP_ERROR_CHECK(err_code);

    // Subscribe for BLE events.
    err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
    APP_ERROR_CHECK(err_code);

    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
    APP_ERROR_CHECK(err_code);

My sys_evt_dispatch then tries to filter out FLASH events, but never gets called:

void sys_evt_dispatch(uint32_t sys_evt) {
    NRF_LOG_WARNING("evt is flash: %d\n", sys_evt == NRF_EVT_FLASH_OPERATION_SUCCESS || sys_evt == NRF_EVT_FLASH_OPERATION_ERROR);
    storage_on_sys_evt(sys_evt);
    ble_advertising_on_sys_evt(sys_evt);
}

So, I never receive the 

NRF_EVT_FLASH_OPERATION_SUCCESS event, although something is being written onto the flash.
Is there any need to enable specific events for this? Do I need to do any additional setup to receive NRF_EVT_FLASH_OPERATION_SUCCESS and NRF_EVT_FLASH_OPERATION_ERROR?
Kind regards,
Daniel
Parents
  • Hi Daniel,

    Your sys_evt_dispatch() function that was registered with softdevice_sys_evt_handler_set() will be called for any system events, so if there is  a NRF_EVT_FLASH_OPERATION_SUCCESS or NRF_EVT_FLASH_OPERATION_ERROR it will be called (unless there is another issue somewhere that prevents the code from ever running).

    I do not see a filter in you rcode snippets, but I see that you print "evt is flash: " and will get 0 printed for most events for most events and 1 for the two you have specified. Is the issue here that you don't get any events, or do you always see "evt is flash: 0"? What do you do when you would have expected the event? Perhaps you can share a bit more of your code and how you test and what you see so that i get a full(er) picture of what you are doing?

    Einar

Reply
  • Hi Daniel,

    Your sys_evt_dispatch() function that was registered with softdevice_sys_evt_handler_set() will be called for any system events, so if there is  a NRF_EVT_FLASH_OPERATION_SUCCESS or NRF_EVT_FLASH_OPERATION_ERROR it will be called (unless there is another issue somewhere that prevents the code from ever running).

    I do not see a filter in you rcode snippets, but I see that you print "evt is flash: " and will get 0 printed for most events for most events and 1 for the two you have specified. Is the issue here that you don't get any events, or do you always see "evt is flash: 0"? What do you do when you would have expected the event? Perhaps you can share a bit more of your code and how you test and what you see so that i get a full(er) picture of what you are doing?

    Einar

Children
Related