meta data for this page
  •  

SD Disable crash

When FDS write operation is pending.

During SD disable, SD informs observers about changing state. Observer callback can return false to prevent SD to be disabled. In this case component who prevents is responsible for call nrf_sdh_request_continue() to resume SD shutdown.

FDS implementation calls nrf_sdh_request_continue from SD event, causing SD do be disabled when SD is handling event.

Similar issue: Disable Softdevice from observer crashes; "don't do that" should be documented?

Code flow:

  • nrf_sdh_disable_request
    • sdh_request_observer_notify()
      • nrf_fstorage_sdh_req_handler(1) - disallows SD state change
      • nrf_sdh: Notify observer 0x0005F398 ⇒ blocking

And SD disable was stopped due to block from FDS. FDS operation finishes, event is generated:

  • SD_EVT soft IRQ
    • nrf_sdh: nrf_sdh_evts_poll() - while loop is polling are pending SD events:
      • nrf_sdh_soc: ===nrf_sdh_soc_evts_poll()===
      • nrf_sdh_soc: —sd_evt_get:
      • nrf_sdh_soc: SoC event: 0x2.
        • nrf_fstorage_sys_evt_handler
        • (void) nrf_sdh_request_continue(); ←- here FDS resumes SD disable
          • nrf_sdh_disable_request()
            • nrf_fstorage_sdh_req_handler(1) ←- allows SD state change
            • nrf_sdh: Notify observer 0x0005F3F8 ⇒ ready
    • NOW SD was disabled from SD handler - but we are still inside while loop which polls for SD events:
      • nrf_sdh_soc: —sd_evt_get: 2
      • nrf_sdh_soc: !!!! ret_code: 48 ←- APP ERROR