2023-12-02 03:10 PM
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:
Kind regards
2023-12-02 04:17 PM
WL, but might have some commonality
2023-12-04 01:23 AM
Sorry, I think you misunderstood my question. I am not asking how to calibrate the HSE. I know how to calibrate it, but I am looking for a way, how I could avoid buying expensive measurement equipment to do so.
Thus, my questions, of which none have been answered.
2023-12-04 02:11 AM
>Does the MCO show the exact waveform of the input signal?
no. its sqw.
>more precise, does the NX2016SA generate a sinus signal?
no. generates nothing - its a crystal.
>Is it true, that an external clock for the HSE would have to be a sinus signal?
no. see ds ->
>Is it generally recommended to use an external clock instead of the oscillator
i use most times an ext. clock oszillator, nothing to worry about tuning caps etc. . ymmv.
>I did not order an external clock yet and thus, could not test it.
buy some and test. only way to know for sure.
i would try: (from mouser)
520-2520MVLC-320CNTR ; 32M, 1$ , 25ppm. drive at VCC about 1,6V , and cap + 75 r in series to cpu clk in.
2023-12-04 02:25 AM - edited 2023-12-04 02:28 AM
Thanks for the information! Yes, a crystal does not generate a signal by itself but is used as a part of the oscillation circuit and driven by the microcontroller to generate an oscillating signal . Is this signal square wave or sinus?
Regarding the requirement for the HSE signal: I was using an older revision of the datasheet. Interesting how things change. 1,6 V (max.) Vpp means a signal from 0 V to 3,2 V (max.) should suffice, right? I would probably go for 3 V as voltage, because this is the voltage I use for the microcontroller.
Ok, then I will give an external clock oscillator a try. Do you have any data on the actual (not datasheet) startup time of the 520-2520MVLC-320CNTR?
Thanks!
2023-12-04 02:40 AM - edited 2023-12-04 02:41 AM
>1,6 V (max.) Vpp means a signal from 0 V to 3,2 V (max.) should suffice, right?
no - is too much. give 1,6V vcc to the oszillator, then it will output 1,6vss sqw. , thats according to ds.
10nf + 75 ohm in series , so its AC coupled.
>Do you have any data on the actual (not datasheet) startup time
joking, eh ? to know this, you have to test yourself.
at start/powerup , first cpu reset needs some ms , so i never worried about the osc. starting in 1ms or 2.
2023-12-04 03:05 AM - edited 2023-12-04 03:06 AM
@AScha.3 wrote:>1,6 V (max.) Vpp means a signal from 0 V to 3,2 V (max.) should suffice, right?
no - is too much. give 1,6V vcc to the oszillator, then it will output 1,6vss sqw. , thats according to ds.
I am pretty sure Vpp should mean voltage peak to peak. If I run the microcontroller at 3 V (Vdd), I do not want to use an extra LDO or something just for the HSE.
@AScha.3 wrote:joking, eh ? to know this, you have to test yourself.
at start/powerup , first cpu reset needs some ms , so i never worried about the osc. starting in 1ms or 2.
I never joke about external clocks. I am still wondering how ST manages a startup time of only 120 us with their crystal. With BLE, wake up time is critical to power consumption. I just assumed that if you can get a startup time of 120 us with a crystal, then there should be a crystal oscillator or something available with about that startup time. 1 ms or 2 ms would be way to long. So I was hoping, as in the datasheet of the 520-2520MVLC-320CNTR only the max. startup time is specified, that the actual (typ.) startup time would be much lower. Thus the question.
2023-12-04 03:54 AM
>If I run the microcontroller at 3 V (Vdd), I do not want to use an extra LDO or something just for the HSE.
-- so use some 3 diodes series forward , to get the voltage down for 1,6v at the osz.
>I am pretty sure Vpp should mean voltage peak to peak.
and i am sure. at 3V the osz. will output 3Vss .
>only the max. startup time is specified
i think same. thats why i wrote 2 times: test it !
2023-12-04 04:00 AM
Would someone from ST please clarify, if 1,6 V Vpp means that the HSE oscillator input can be as high as 3,2 V or 1,6 V (DS11929)?
2023-12-04 07:20 AM
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.
Anyway, concerning power consumption, from the MHz-oscillators that I know (even the MEMS-types, which are surprisingly good these days) I cannot imagine that you can save power with these, even if they have a faster start-up time.