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

Completely disabling bluetooth.

Hey!

I'm working on a device which requires Bluetooth to be completely disabled for short periods of time. It's got a sensor in it that's sensitive to 2.4 GHz radiation. Chip is nRF51822, SoftDevice is S110 v6.0.0.

I disable Bluetooth using the following code snippet:

	// If connected, disconnect
	if (m_conn_handle != BLE_CONN_HANDLE_INVALID)
	{
		err_code = sd_ble_gap_disconnect(m_conn_handle,  BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
		if (err_code != NRF_SUCCESS) return err_code;
	}

	// Stop advertising
	err_code = sd_ble_gap_adv_stop();
	if (err_code != NRF_SUCCESS) return err_code;

And reenable later by calling advertising start.

Does disconnecting and stopping advertising completely shut down the radio or do I need to do something more low-level? I want to be as certain as possible that Bluetooth isn't interfering with the sensor.

Cheers,

Anne.

Parents
  • I reopened this case because the answers are not totally correct.

    First: The radio peripheral is blocked by the SoftDevice, so the call NRF_RADIO->TASK_DISABLE = 1 will not have any effect if the SoftDevice is enabled. Worst case it will lead to a hardfault. The peripherals that are used by the SoftDevice and either blocked or restricted can be seen here.

    Second: When the SoftDevice is done sending or receiving packets on the radio, it will call NRF_RADIO->TASK_DISABLE = 1, probably this is done automatically with PPI. It will also turn off the radio peripheral with NRF_RADIO->POWER = 0 to additionally save power. When it is going to send a packet it will turn the radio peripheral on and call NRF_RADIO->TASK_ENABLE = 1. Calling NRF_RADIO->TASK_DISABLE = 1in the meantime will not change this.

    To know that the radio is off, you have to make sure that you are not in a connection and not advertising. You can disable the SoftDevice also, but this is not necessary.

Reply
  • I reopened this case because the answers are not totally correct.

    First: The radio peripheral is blocked by the SoftDevice, so the call NRF_RADIO->TASK_DISABLE = 1 will not have any effect if the SoftDevice is enabled. Worst case it will lead to a hardfault. The peripherals that are used by the SoftDevice and either blocked or restricted can be seen here.

    Second: When the SoftDevice is done sending or receiving packets on the radio, it will call NRF_RADIO->TASK_DISABLE = 1, probably this is done automatically with PPI. It will also turn off the radio peripheral with NRF_RADIO->POWER = 0 to additionally save power. When it is going to send a packet it will turn the radio peripheral on and call NRF_RADIO->TASK_ENABLE = 1. Calling NRF_RADIO->TASK_DISABLE = 1in the meantime will not change this.

    To know that the radio is off, you have to make sure that you are not in a connection and not advertising. You can disable the SoftDevice also, but this is not necessary.

Children
Related