Bluetooth broadcast errors in low and high temperature conditions

Hi,

     SDK:ncs2.6.1. The main program runs in the app core, and the net core is included as a child image. The Bluetooth broadcast is normal when tested at room temperature, but after being tested in the high and low temperature box, it is found that the Bluetooth broadcast suddenly disappears when tested below -30℃ and 60℃. At present, it is suspected that it is because of the external high-speed crystal problem.

What I want to ask is that

① when do most of these problems appear, may be the hardware configuration, software configuration problems?

② How can I solve this problem?

The app core is configured as follows:

# External clock
CONFIG_SOC_ENABLE_LFXO=y
# CONFIG_SOC_LFXO_CAP_EXTERNAL=y
# CONFIG_SOC_LFXO_CAP_INT_6PF=y
# CONFIG_SOC_LFXO_CAP_INT_7PF=y
# CONFIG_SOC_LFXO_CAP_INT_9PF=y
# CONFIG_SOC_HFXO_CAP_DEFAULT=y
# CONFIG_SOC_HFXO_CAP_EXTERNAL=y
CONFIG_SOC_HFXO_CAP_INTERNAL=y
CONFIG_SOC_HFXO_CAP_INT_VALUE_X2=24
app.overlay:
&clock {
    status = "okay";	
	lfxo: lfxo {
		// source = "LFXO";
		compatible = "nordic,nrf-lfxo";
		#clock-cells = <0>;
		clock-frequency = <32768>;
		// zephyr,pm-device-runtime-auto;
		status = "okay";
	};

	hfxo: hfxo {
		// source = "HFXO";   
		compatible = "nordic,nrf-hfxo";
		#clock-cells = <0>;
		clock-frequency = <DT_FREQ_M(32)>;
		// zephyr,pm-device-runtime-auto;
		status = "okay";
	};	
};
net_core.overlay:
&gpiote {
	status = "disabled";
};

&gpio0 {
	status = "disabled";
};

&gpio1 {
	status = "disabled";
};

&uart0 {
	status = "disabled";
};

arduino_serial: &uart0{
	status = "disabled";
};


&ieee802154 {
	status = "disabled";
};

&wdt {
	status = "okay";
};

&rng {
	status = "okay";
};

&radio {
	status = "okay";
};

&temp {
	status = "disabled";
};
Parents
  • Hello,

    ''t is found that the Bluetooth broadcast suddenly disappears when tested below -30℃ and 60℃. At present, it is suspected that it is because of the external high-speed crystal problem.'' The reason could be related to both hardware and software probably. 

    Can you please send us the crystal datasheet? Does it support wider temperature range?

  • 306010055_FC-135_物料规格书-1.pdf306011503_惠伦_1S32000049_Datasheet.pdf

    306010055_FC-135_物料规格书-1.pdfI have uploaded the datasheet for the external high-speed/low-speed crystals we are currently using, and they should meet the requirements. From my testing, it seems that in my application, if I don't use the onoff_request to toggle the external high-speed clock, Bluetooth works fine and can broadcast normally even under high and low temperatures. Therefore, I would like to know if toggling the external high-speed clock in the application could conflict with the Bluetooth protocol stack.

  • Hello,

    The specification of crystal looks ok. 

    Usually, SoftDevice manages the HFCLK. Your application can request SoftDevice to set the clock source with the external crystal. you can read this documentation High-frequency clock configuration.

    If your application does not require any manual control of the HFCLK, its best to let the SoftDevice manage the clock. Did you try to set on off for HF crystal in following way?

    sdk-nrf/samples/peripheral/radio_test/src/main.c at e895510c7cad107d815070c02923e82564ed0337 · nrfconnect/sdk-nrf · GitHub

  • Our device needs to operate within a temperature range of -40°C to 60°C. However, during actual testing, we found that at low temperatures around -30°C, if the application does not use the external high-speed clock, the UART communication experiences significant frequency deviation, causing communication issues. To address this, I added the following code to the application to enable the use of the external high-speed clock when turning the UART on or off. This resolved the frequency deviation issue with the UART. However, during testing, we noticed an issue with Bluetooth advertising; the device's Bluetooth could no longer be scanned by a phone, although other functions appeared to be working normally.
    We suspect that application control of the external high-speed clock is in conflict with the SoftDevice. Is this possible?

    static struct onoff_client hfclk_cli;
    static bool hfclk_is_running = false;
    static int8_t hfclk_cnt = 0;
    
    static void clock_hfclk_start(void)
    {
    	int err;
    	int res;
    	struct onoff_manager *mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);
    
    	__ASSERT_NO_MSG(mgr != NULL);
    
    	sys_notify_init_spinwait(&hfclk_cli.notify);
    
    	err = onoff_request(mgr, &hfclk_cli);
    	if (err < 0) {
    		printk("Clock request failed: %d\n", err);
    		return;
    	}
    
    	do {
    		err = sys_notify_fetch_result(&hfclk_cli.notify, &res);
    		if (!err && res) {
    			printk("Clock could not be started: %d\n", res);
    			return;
    		}
    	} while (err);
    	// printk("----------------- Start clock success!\n");
    	hfclk_is_running = true;
    }
    
    static void clock_hfclk_stop(void)
    {
    	int ret;
    	struct onoff_manager *mgr =
    		z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);
    
    	__ASSERT_NO_MSG(mgr != NULL);
    
    	ret = onoff_cancel_or_release(mgr, &hfclk_cli);
    	__ASSERT_NO_MSG(ret >= 0);
    	hfclk_is_running = false;
    
    	// printk("----------------- Stop clock success!\n");
    
    }
    
    bool hfclk_running_status(void)
    {
    	return hfclk_is_running;
    }
    
    void hal_clock_hfclk_on( void )
    {
    	if( hfclk_running_status( ) == false )
    	{
    		clock_hfclk_start( );
    	}
    	hfclk_cnt ++;
    	// printk("----------------- hal_clock_hfclk_on:cnt:%d\n",hfclk_cnt);
    }
    
    void hal_clock_hfclk_off( void )
    {
    	if( hfclk_running_status( ) == true )
    	{
    		hfclk_cnt --;
        	if( hfclk_cnt <= 0 )
    		{
    			clock_hfclk_stop( );
    		}
    		
    	}
    	else
    	{
    
    	}
    	// printk("----------------- hal_clock_hfclk_off:cnt:%d\n",hfclk_cnt);
    }
    
    
    void pm_runtime_uart_enable( const struct device * uart_dev)
    {
        hal_clock_hfclk_off();  // Turn off the high-speed external clock when the serial port is not in use
        pm_device_runtime_enable(uart_dev);
    }
    
    void pm_runtime_uart_disable(const struct device * uart_dev)
    {
        hal_clock_hfclk_on();   // Turn on the high-speed external clock when the serial port is in use
        pm_device_runtime_disable(uart_dev);
    }

Reply
  • Our device needs to operate within a temperature range of -40°C to 60°C. However, during actual testing, we found that at low temperatures around -30°C, if the application does not use the external high-speed clock, the UART communication experiences significant frequency deviation, causing communication issues. To address this, I added the following code to the application to enable the use of the external high-speed clock when turning the UART on or off. This resolved the frequency deviation issue with the UART. However, during testing, we noticed an issue with Bluetooth advertising; the device's Bluetooth could no longer be scanned by a phone, although other functions appeared to be working normally.
    We suspect that application control of the external high-speed clock is in conflict with the SoftDevice. Is this possible?

    static struct onoff_client hfclk_cli;
    static bool hfclk_is_running = false;
    static int8_t hfclk_cnt = 0;
    
    static void clock_hfclk_start(void)
    {
    	int err;
    	int res;
    	struct onoff_manager *mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);
    
    	__ASSERT_NO_MSG(mgr != NULL);
    
    	sys_notify_init_spinwait(&hfclk_cli.notify);
    
    	err = onoff_request(mgr, &hfclk_cli);
    	if (err < 0) {
    		printk("Clock request failed: %d\n", err);
    		return;
    	}
    
    	do {
    		err = sys_notify_fetch_result(&hfclk_cli.notify, &res);
    		if (!err && res) {
    			printk("Clock could not be started: %d\n", res);
    			return;
    		}
    	} while (err);
    	// printk("----------------- Start clock success!\n");
    	hfclk_is_running = true;
    }
    
    static void clock_hfclk_stop(void)
    {
    	int ret;
    	struct onoff_manager *mgr =
    		z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);
    
    	__ASSERT_NO_MSG(mgr != NULL);
    
    	ret = onoff_cancel_or_release(mgr, &hfclk_cli);
    	__ASSERT_NO_MSG(ret >= 0);
    	hfclk_is_running = false;
    
    	// printk("----------------- Stop clock success!\n");
    
    }
    
    bool hfclk_running_status(void)
    {
    	return hfclk_is_running;
    }
    
    void hal_clock_hfclk_on( void )
    {
    	if( hfclk_running_status( ) == false )
    	{
    		clock_hfclk_start( );
    	}
    	hfclk_cnt ++;
    	// printk("----------------- hal_clock_hfclk_on:cnt:%d\n",hfclk_cnt);
    }
    
    void hal_clock_hfclk_off( void )
    {
    	if( hfclk_running_status( ) == true )
    	{
    		hfclk_cnt --;
        	if( hfclk_cnt <= 0 )
    		{
    			clock_hfclk_stop( );
    		}
    		
    	}
    	else
    	{
    
    	}
    	// printk("----------------- hal_clock_hfclk_off:cnt:%d\n",hfclk_cnt);
    }
    
    
    void pm_runtime_uart_enable( const struct device * uart_dev)
    {
        hal_clock_hfclk_off();  // Turn off the high-speed external clock when the serial port is not in use
        pm_device_runtime_enable(uart_dev);
    }
    
    void pm_runtime_uart_disable(const struct device * uart_dev)
    {
        hal_clock_hfclk_on();   // Turn on the high-speed external clock when the serial port is in use
        pm_device_runtime_disable(uart_dev);
    }

Children
No Data
Related