1
\$\begingroup\$

I'm building an open source, commercially available eurorack module which is based on a stm32 chip. The problem I'm facing is that when the module boots up sometimes it is working as it should but most of the times, it seems to be working at a lower rate and it has unpredictable output.

I checked all the voltages from the regulators and I checked the soldering of all the parts and everything was right. After checking the 8Mz crystal I found that the one end oscillates as it should but the other does not. When the module works as intended, it oscillates nicely but after a while it goes berserk along with the module outputs.

Now, I double checked the values of the capacitors (20 pF) and the value of the resistors going to the stm pins (100 ohms). I replaced both the stm and the crystal with new ones. I reflowed with hot air the crystal and the stm but the behaviour is the same.

What strikes me as quite peculiar is the fact that sometimes the module works but after some seconds, of even minutes (after a reflow for example) the crystal stops oscillating as it should. Can anyone tell me what can cause such a behaviour?

Thank you!

The schematics are here: pdf link

The crystal part

Edit: Schematic of crystal oscillator section

enter image description here

\$\endgroup\$
12
  • 4
    \$\begingroup\$ 100R for R8 and R9 seems a bit excessive. The datasheet does not suggest two resistors for Rext. Make R8 and R9 0R and see if the situation improves. It is also advisable to surround the oscillator circuit with a 0V ring and ensure you have a ground plane below. Your placement of bypass caps looks suspect as well. \$\endgroup\$ – Kartman Apr 3 at 0:28
  • \$\begingroup\$ Exactly which crystal are you using? Datasheet link? \$\endgroup\$ – brhans Apr 3 at 2:02
  • 2
    \$\begingroup\$ Did you read AN2867? Also, unless you have a low-capacitance FET probe, your scope could have enough capacitance to kill the oscillations, don't rely to much on the scope measurements. \$\endgroup\$ – Mattman944 Apr 3 at 2:03
  • 1
    \$\begingroup\$ @Terumi that datasheet is for a wide range of crystals that are available or can be manufactured on request wih any parameters you want. Now, which exact crystal mode did you order to find out which parameters it has? Also we need to see more schematic an code to asses where the problem is, the crystal dropping out is only a symptom. \$\endgroup\$ – Justme Apr 3 at 8:58
  • 1
    \$\begingroup\$ The crystal should work fine. Just use 0R insted of 100R to see if it fixes it. But after spending few minutes, can't locate a place in the code where the crystal is enabled into use and what is the resulting MCU clock. But there are other issues in the hardware that are dangerous. Like using two separate regulators for MCU power. And the reset pin has a pull-up against all MCU datasheets and appnotes. \$\endgroup\$ – Justme Apr 3 at 9:31
0
\$\begingroup\$

The problem was on the capacitors of the crystal. I first replaced the resistors going to the mcu with jumpers but the problem persisted. Then I changed them with smaller (33Ohm) ones as suggested. Then I replaced the capacitors with 18pF ones and the problem was there but significantly reduced. Then I reflowed the capacitors and ended up using more solder than I usualy use (made small blobs at each capacitor end) and the problem disappeared. I suspected that something wrong was happening with the capacitors because I was able to measure capacitance with my multimeter on the first, but not one the second one. I hope that everything will be ok now.

Thank you all for your suggestions. :)

\$\endgroup\$
0
\$\begingroup\$

As Cartman mentioned in his comment, your resistor values are likely too high for your crystal. You'll also note from the reference circuit that the RExt is only applied to the OSCOUT pin (it is used purely to reduce the drive strength of the oscillator amplifier internal to the microcontroller to ensure that you do not exceed the rated Drive Level for the crystal).

A consequence of having RExt too high (or of otherwise dampening the feedback signal too much) is an inability of the circuit to oscillate. Depending on the particular crystal and cut in use, it might otherwise result in the wrong frequency mode of the crystal being selected.

schematic

simulate this circuit – Schematic created using CircuitLab

From AN2867 “Oscillator design guide for ST microcontrollers” https://www.st.com/resource/en/application_note/cd00221665-oscillator-design-guide-for-stm8afals-stm32-mcus-and-mpus-stmicroelectronics.pdf

You'd be better to look at the drive level from the microcontroller, compare this to the drive level allowed from the crystal, and only if they are not directly compatible, then applying RExt to reduce the drive level. AN2867 recommends a first pass estimate being to set RExt = 1 / (2Pif*CL2), which would have given RExt ~ 1kOhm. Then you need to run the numbers on the gain margin with this additional resistance..

Sometimes you may even find that the ESR of the crystal is too great, and it can't be used for a particular microcontroller/oscillator circuit (often the case with low power 32.768kHz RTC crystals with very high >90kOhm ESR).

\$\endgroup\$
1
  • \$\begingroup\$ Wow, thank you for the explanation! \$\endgroup\$ – Terumi Apr 5 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.