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
  • Hi, Anne,

    I investigated the code for BLE serialization and found no clue of turning off Bluetooth completely.

    However, I tried another solution:

    NRF_RADIO->TASKS_DISABLE = 1;
    

    It works! See the Fig.23 in NRF51822 reference manual v2.1, it says "No operations are going on inside the radio and the power consumption is at a minimum." I think this is what you need.

    I tried this code,

    advertising_start();
    nrf_delay_ms(2000);
    
    NRF_RADIO->TASKS_DISABLE = 1;
    
    nrf_delay_ms(2000);
    advertising_start();
    

    Then the BLE resumes advertising without any problem.

  • I'm using the application timer module. I'm not sure, but I think disabling and reenabling the SD would mess them up. I've also got a critical region which uses sd_critical_region_enter which is called when Bluetooth needs to be active as well as when it needs to be disabled. I could manage these, of course, but it would be nice to know if there's any alternative.

Reply
  • I'm using the application timer module. I'm not sure, but I think disabling and reenabling the SD would mess them up. I've also got a critical region which uses sd_critical_region_enter which is called when Bluetooth needs to be active as well as when it needs to be disabled. I could manage these, of course, but it would be nice to know if there's any alternative.

Children
No Data
Related