This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

disable SD

Hello, I use nrf51422 for my project. I have to collect data via BLE nus from phone, but after that i don't need SD anymore. Can i use blocked hardware, like RTC0, after disable sd? I try to do that, but i get Hard Fault.

Regards Michał,

  • Yes, you can use blocked hardware after disabling the SoftDevice. Using blocked hardware while SoftDevice is enabled will lead to hardfault.

    You are sure you are not calling any SoftDevice functions? A common mistake is to call power_manage(), which will call sd_app_evt_wait(). This have to be changed to this if the SoftDevice is disabled:

    __SEV();
    __WFE();
    __WFE();
    
  • Thank you for answer. But its still not work. After collect my data i use function sd_ble_gap_disconnect and softdevice_handler_sd_disable. When i want to take another step in debug after this function, its going to hardfault. its look like this:

    	test=sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION );
    	
    	test=softdevice_handler_sd_disable();
    	
    	ppi_init();
    	rtc_config();
    	timer1_init();
    

    Do i need call other function before sd disable?

    Regrads Michal,

  • You should wait for BLE_GAP_EVT_DISCONNECT after calling disconnect before disabling the SoftDevice, and not go into advertising which is the default behaviour of the SDK examples, see ble_advertising_on_ble_evt(...) in ble_advertising.c.

  • I did like you said, I wait for BLE_GAP_EVT_DISCONNECT, but still after sd_disable next step in debugger is going to hardfault. What i need to do before i use softdevice_handler_sd_disable()?

    1. disconect
    2. wait for BLE_GAP_EVT_DISCONNECT
    3. and not go into advertising. some thing more? I will be grateful for your response. Regards
  • That should be all yes. Does the device hardfault if you don't step through the code in debug? Debug stepping the SoftDevice functions may lead to a hardfault sometimes.

Related