cancel
Showing results for 
Search instead for 
Did you mean: 

External clock instead of oscillator

RWeil.2
Associate III

Hi,

currently, I am using an NX2016SA (as recommended by ST) to generate the HSE (32 MHz) for an STM32WB55RGV6 microcontroller.

I did not calibrate it, but so far everything works and I have a BLE range of up to 25 meters.

Now I am planning to getting my device certified for BLE, but I worry, because I did not calibrate the HSE. I don´t think I have equipment available to calibrate a signal to +- 25 ppm. Sounds a bit insane to me.

I did some measurements first: I switch between HSI and HSE and measure a current consumption of 3,36 mA for the HSE crystal at 3 V (1,13 mA / V is specified in the datasheet). I get a startup time of just 120 us from HSI to HSE. In the datasheet, a typical time for the XOREADY signal is specified as 250 us. How can it be that fast?

To switch between HSE and HSI, I use the following code:

 

void Turn_On_HSI(void)
{
  LL_RCC_HSI_Enable();
  while(!LL_RCC_HSI_IsReady())
  {
  }
  LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSI);
  while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSI)
  {
  }
  SystemCoreClockUpdate();
  LL_RCC_HSE_Disable();
  return;
}

void Turn_On_HSE(void)
{
	LL_RCC_HSE_Enable( );
	__HAL_FLASH_SET_LATENCY(FLASH_LATENCY_1);
	while(!LL_RCC_HSE_IsReady( ))
	{
	}
	LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE);
	while (LL_RCC_GetSysClkSource( ) != LL_RCC_SYS_CLKSOURCE_STATUS_HSE)
		{
		}
	SystemCoreClockUpdate();
	LL_RCC_HSI_Disable();
}​

 

Now, in order to avoid the manual calibration, I am thinking about switching to an external clock, with its own oscillation circuit (e.g. SiT1533). There are external clocks available for 32 Mhz with a current consumption of approx. 3 mA. BUT: I have not found a single external clock, that has a startup time of less than 1 ms (max.). Why? Does anybody else use an external clock or does everyone use external oscillators? Especially in regard to BLE advertising, I see it as problematic, that the clock would have a startup time of 1 ms. This would drive up the current consumption by a lot.

Another question: In the reference manual RM0434, it is specified, that an external clock has to have a sinus signal. I haven´t found many external clocks with a sinus. 99 % of them have a rectangle. If I use the MCO (master clock output) to output the clock of the external crystal, I also see a rectangle in the oscilloscope.

So, to sum up my questions:

  • Does the MCO show the exact waveform of the input signal? Or to be more precise, does the NX2016SA generate a sinus signal?
  • Is it true, that an external clock for the HSE would have to be a sinus signal? That would limit the available products to ~1 %.
  • Is it generally recommended to use an external clock instead of the oscillator or are the downsides so bad, that nobody does it?
  • I did not order an external clock yet and thus, could not test it. Is the typical specified startup time generally much less than the max. specified startup time? If it really is 1 ms for most external clocks, I see that as a total deal breaker.

Kind regards

13 REPLIES 13
RWeil.2
Associate III

@LCE wrote:

Interestingly, the WB series doesn't seem to support active oscillators. AFAIU it's because of the trimming which only works if the STM controls the complete feedback loop.


Why do you think that?

 

RWeil2_1-1702469592939.png

 

 

 

RWeil.2
Associate III

I did some more digging here https://community.st.com/t5/stm32-mcus-wireless/ble-sleep-mode-and-hse/m-p/615804#M17134

 

Unfortunately, ST has not responded yet. It seems that CPU2 also manages an external crystal and turns it on for advertising and off for sleep. But you cannot use an external clock when you want to advertise and benefit from the low power features. So regular advertising in low power mode only works with a crystal, as far as I understand it.

You can however, use an external clock during advertising, but then you have instead of ~300 uA average current the external clock current as well (which is about 3 mA with most clocks), because CPU2 cannot turn off your external clock. You could turn it off "manually" when you stop advertising e.g. for deep sleep mode or something, but there is no callback to do so during the advertising intervals.

so: end of the long story: use the crystal , as the chip is designed to use a crystal. :)

 

+

about calibration: you have no access to a SA ?

then i would try with a "certified" part : the max. distance, when connection is possible ;

when your crystal tuned some steps up or down, you should get a optimum max. distance - this should be the best fit to the "correct" frequency. 

If you feel a post has answered your question, please click "Accept as Solution".

@AScha.3 wrote:

about calibration: you have no access to a SA ?

then i would try with a "certified" part : the max. distance, when connection is possible ;

when your crystal tuned some steps up or down, you should get a optimum max. distance - this should be the best fit to the "correct" frequency. 


I bought a PFM3000. Well it´s not the most accurate one (+-8 ppm), but an affordable one. I output MCO on a pin and  tuned the HSE from 24,001000 MHz (HSECR = 00) to 24,000010 (HSECR = 48). SA will be purchased later.

I hoped I could avoid buying all that measurement equipment but a crystal really seems to be the better choice for now.