2018-06-26 01:03 AM
Hi everyone,
I'm working on an STM32F1 platform. I have a problem with the LSE crystal. I'm using this one ABS07-120-32.768kHz-T by Abracon. The problem is with temperatures below 5�C. I made some calculations according to the Application Note AN2867:
According to the datasheet ABS07-120-32.768kHz-T:
C0=1.20pF, ESR=55kohm (Max 60kohm), CL= 6pF and F= 32.768KHz
And according to the datasheet (page 62/136) del STM32F103RF:
gm = 5uA/V
gmcrit = 4 * ESR * (2?F)^2 * (C0 + CL)^2 = 4 * 60000*(2 * pi * 32768)^2 * (1.2*10^(-12) + 6 *10^(-12) )^2 = 0.0000005273947973 A/V = 0.5273947973 uA/V
gain margin = gm/gmcrit = 5 / 0.5273947973 = 9.48 (60k)
So we meet that the gain margin = gm / gm_crit >= 5.
Considering Cin=Cout=3pF (STM32 processor), CSTRAY=1pF, C1=C2=x and CL=6pF, we get C1=C2:
CL = (Cin + C1)*(C2 + Cout)/(Cin + C1 + C2 + Cout) + CSTRAY
6 = (3 + x)*(3 + x)/(6 + 2*x) + 1x=7pFC1=C2=6.8pF
So I think that the selection of the crystal and C1/C2 is right, but when I tried to init the platform inside a thermal chamber the crystal it seems to be that it wasn't able to oscillate because I was checking this function and it's blocked in the while:
while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
Does anyone help me out?
Best regards.
#lse-startup #stm32f1-clock2018-06-26 01:19 AM
I'm not a hardware guy, but what temperatures are you talking about ?
Are they covered by the LSE crystal's datasheet, i.e. are you within guaranteed limits ?
I was checking this function and it's blocked in the while:
while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
You could consider a fall-back to LSI, perhaps checking the die temperature.
2018-06-26 03:33 AM
while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
It's startup of the LSE oscillator, right?
Try to use a longer timeout. It's not unusual for the LSE to start tens of seconds - I wouldn't shy to be use several minutes as timeout. The chamber might serve as a Faraday cage, screening off electromagnetic noise, which helps the oscillator startup.
JW
2018-06-26 03:51 AM
Hi AvaTar,
The problems began with temperatures below 5ºC.
I can't use the LSI because I need as much precision as possible. I'm using the RTC.
2018-06-26 03:56 AM
Hi waclawek.jan,
1. According to: ' It's startup of the LSE oscillator, right? Try to use a longer timeout. It's not unusual for the LSE to start tens of seconds - I wouldn't shy to be use several minutes as timeout.'
I dind't understand you. I'm waiting in the loop in an infinite way.
2.The chamber might serve as a Faraday cage, screening off electromagnetic noise, which helps the oscillator startup.
I've opened the chamber and take out the PCB to normal temperature environment and it took a long time to start working again
2018-06-26 04:03 AM
I can't use the LSI because I need as much precision as possible. I'm using the RTC.
I know.
But your firmware needs to deal with such issues, usually called 'rainy day scenarios'.
You can either:
- throw the game away
- run with reduced accuracy
- try to get a crystal / design that works at that temperatures
- the 'Radio oscillator' method
The latter is to put the device in a thermically isolated box, and heat it up to, say, 20°C. Better RF receivers and transmitters keep their oscillator frequency stable that way.
2018-06-26 04:33 AM
Hi AvaTar,
You're right. I only want to try to understand If I did all the calculations
in a proper way,
because I think that the fact to be up to 5ºC, it isn't too cold to don't work.2018-06-26 05:02 AM
And if the chamber is not cooled (i.e. it's room temperature inside), and you place the PCB inside it, will it start?
JW
[EDIT] Another thing to try is to start the oscillator at room temperature and then - while running - cool it down. Will it stop?
What I am trying to tell is that startup and stable run are two separate issues. Crystals are electromechanical and sure temperature influences their properties - and temperature influences also properties of capacitors, and also the gain of the amplifier in the STM32 - and this may not be captured by two or three parameters (numbers) completely. As Avatar said, you might want to experiment with different manufacturers/crystals.
2018-06-26 05:10 AM
As said, I am missing the experience to assess the issue, I am more of a software guy.
Might be the design, the quartz, or tolerances. Even ceramic caps have temperature drifts, perhaps other types help. I remember that RF oscillator design includes careful selection of NTC and PTC components, to avoid/minimize drift.
2018-06-26 12:43 PM
I typically guess 5 pF for the stray capacitance, even with a fairly tight pcb layout. Where did you get your 1 pF from? What is the total length of pcb trace from each processor pin to the crystal in mm?
I note AN2867 suggests calculating the correct stray-capacitance from the frequency-error when you put 'any-old-capacitor' in the circuit. I don't believe that works in practice because the crystal centre-frequency has a tolerance and the next crystal off the production-line might be out in the opposite direction!
AvaTar said:
I remember that RF oscillator design includes careful selection of NTC and PTC components, to avoid/minimize drift.
The cut of the crystal will be such as to minimise frequency drift over the rated frequency-range (when loaded with the right capacitance). And the capacitors of a few pF should be ceramic C0G / NP0 with little or no change in capacitance over temperature.
- Danish