cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate the oscillator limiting resistor

federico.massimi
Associate III

Hi, I need some help with designing an oscillator for an STM32, I have some questions:

1.      I use the 32KHz oscillator only for the watchdog, so I don't need much precision, but is it still necessary or advisable to use an external crystal or is there no big difference compared to the internal oscillator? If the answer is that it is necessary, the second question also covers this.

2.      As for the HSE oscillator, I think it makes sense to use an external oscillator, but I haven't figured out how to calculate the limiting resistor to put in series. This:

 0693W00000Y8PS7QAN.pngI've read the application note, but it talks about using probes to make measurements, I would like to understand how to calculate this resistance or if there are standard values to use. I have seen that often it is not put at all, other times a resistance in the order of 100 ohms is added.

For now I have select these two crystals: 830108288709 and an ECS-.327-12.5-34QS-TR, but I don't know if they are suitable for STM32 MCU.

Do you have any part number to recommend for which the value of the series resistor is well known.

PS: my micro is an STM32L476

10 REPLIES 10
Amel NASRI
ST Employee

Hi @federico.massimi​ ,

Could you please check AN2867: Oscillator design guide for STM8AF/AL/S, STM32 MCUs and MPUs?

Let me know in case you don't find the answer there.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

federico.massimi
Associate III

Yes, I read that document, but it says that to understand whether or not to insert that resistance, you need to make measurements with a current probe. I haven't created the board yet, so I can't make measurements, I was interested in an analytical solution.

Also in that document there is also a list of recommended crystals, but what resistance value to insert is not specified.

That document is good from a theoretical point of view, but practically does not say much.

Bouraoui Chemli
ST Employee

When selecting your crystal, be sure to follow the recommendations in section 3.4 of the AN2867. Also refer to section 3.3 to calculate external capacitors.

Regarding Rext, refer to this question: STM32L4R5 HSE Rext External Resistor

Thanks for the answer, but even in this discussion he says that to be 100% sure you need to take measurements.

But to be 100% sure, you should carry out the measurement according to section 3.5.1 (drive level).

From what I understand there is no analytical solution to understand if this resistance is needed or not.

AScha.3
Chief

>1.      I use the 32KHz oscillator only for the watchdog, so

forget LSE , use internal LSI and you are more safe.

>2.      As for the HSE oscillator, I think it makes sense to use an external oscillator

no, only if you need <1% frequ.tolerance , maybe for serial/USB/CAN ; but i would recommend an oszillator module then, have about same price as crystal+caps - and nothing to worry about.

if no precision serial timing needed, use internal clock.

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

1 - OK, so I will use the internal oscillator.

2 - I have a couple of UART and also some timers to generate PWMs, for these I prefer to have a crystal.

AScha.3
Chief

no crystal, use crystal oszillator. no headache.

like this: 16M , about 1 eu.

https://www.mouser.de/ProductDetail/ECS/ECS-3225MVLC-160-BN-TR?qs=Znm5pLBrcAL4nJMogCPInw%3D%3D

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

I don't know this type of component, it has only one output pin, how should I connect it to the microcontroller?

Just connect the output to the HSE in ?

It need other components (series or parallel capacitors, resistors, ...)?

Should I leave the HSE Out pin floating or connected to ground?

AScha.3
Chief

come on - read the data sheet. this is a chip + crystal, get 3.3v , output xx MHz square wave.

expensive , many y ago - now better than using crystal and caps and worry about resonance ...

🙂

set Cube -> HSE to bypass clock . (is for osz. ) only input for clock. 1 pin. out is free to your use .

0693W00000Y8TNzQAN.png+

0693W00000Y8TOJQA3.pngpin 1 to VDD (enable)

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