cancel
Showing results for 
Search instead for 
Did you mean: 

HSE Crystal - choosing the right capacitor

SLasn.1
Associate II

Hi 🙂

I am doing a project where I need a (relatively) accurate crystal. I have never used special precision crystals but my guess is a normal crystal would do. I would like though to have the best accuracy possible by laying out the PCB and choosing the capacitors accordingly.

The project uses an STM8L151G6U6, and the datasheet shows an input capacitance of 2.6pF.

0693W000003PNknQAG.png

My crystal has a load capacitance of 9pF.

My crystal traces are 10mil thick and about 300mil each - see the picture below. If I assume a stray+pin capacitance of 5pF total, that means I should choose (2*9) - 5 = 13pF, so I would choose a 12pF cap.

0693W000003PNtQQAW.png

My questions:

1) Is this all wrong and the capacitance has nothing to do with precision? (I am sure I read that somewhere but I cannot find it anymore :\ )

2) Is my way of calculating correct?

3) Is there a way to guestimate a bit better the stray capacitance based on the length and thickness of the traces?

4) In the picture you can see I route the pin to the crystal, and then the crystal to the cap. Would it be better the other way around (first pin -> cap, then cap > crystal)?

Thank you!

Simon

4 REPLIES 4
Cristian Gyorgy
Senior III

Take a look at AN2867. It has good stuff in it. Now, you can take the easy way and just do what everybody does and experience shows good results, or you can dig in it to optimize your oscillator circuit.

https://www.st.com/resource/en/application_note/cd00221665-oscillator-design-guide-for-stm8af-al-s-stm32-mcus-and-mpus-stmicroelectronics.pdf

Amazing!! Thank you - I'll look into right now 😉

I saw that in the datasheet but I was not sure - now I read it again in the AN2867: the feedback resistor (R5 in my case) in not needed with STM8/32 MCUs.

Ok actually this is quite confusing. In the datasheet it says:

0693W000003PPcbQAG.png

But in the AN2867 it says:

0693W000003PPcgQAG.png

The values do not really match?! (for a 1 to 16 MHz the internal feedback resistor should be around 5M) I usually add an external feedback resistor of 1M which will be the equivalent of 167kOhm if I am not mistaken (with the 200k internal one)...