1
\$\begingroup\$

I am doing a project to record and log the voltages of an 8 cell lithium battery. The project is based on an STM32 microcontroller, and logging is done on an SD card. I have made the first version of the PCB, and have spent a lot of time testing the board, including tuning the digital filter.

Everything was working correctly, until I moved on to calibrating the RTC. I have discovered that it is out of spec by 200ppm. This measurement was made by using the calibration output on the micro controller. Using a logic analyzer, I can see the output frequency varies between 499 and 524Hz, when it should be 512Hz. Is this indicating some type of interference?

On closer examination, I can hear the crystal audibly whining when I put my ear close to it. As the input voltage changes (the design range is from 4.5V to 32V), the whine changes too. Also, when I am connected to the board using USB, the whine changes again to a different type.

I use a MAX15062A buck converter in PFM mode to power all active components on the PCB. The current draw from this buck converter is about 20mA (measured). I think that the output noise from this SMPS is what is causing my problem with the RTC, and the crystal whining.

  • The crystal is mounted on a local ground plane, which is stitched using vias to the global ground plane. X2 is not mounted, while X1 is the RTC crystal.

    enter image description here

  • I took the buck converter out of the circuit and supplied 3.3V directly from STLINK (which is the output of a linear regulator). The crystal whine went away, and now the RTC output is between 511.8 and 512Hz. (I should say I am using a clone Saleae logic analyzer from eBay which may not be completely precise).

  • I took the buck converter out of the circuit and supplied 3.3V directly from 2 different bench top power supplies set to 3.3V output. Again the crystal whine went away.

  • I have a second identical PCB of my project where just the buck converter part of the circuit is assembled. I take the output of this buck converter and feed it directly to the 3.3V plane on the other PCB where everything is mounted, and the crystal whine comes back, with the same characteristics. So is it fair to say, that my problem is directly being caused by the output voltage ripple of my buck converter?

So leading on from this, could people please help me verify what the cause of my problem is and how I may solve it? I was thinking I would need an LC/RC filter, or some ferrite bead just after the output of the buck converter?

The output voltage frequency of this buck converter is about 10kHz in the mode I am using it (PFM) and the current draw of my application. The voltage ripple 3.32V and 3.39V (according to the Maxim simulation). I see a stable output voltage of 3.35V on my multimeter.

Layout SMPS:

PCB layout image 1

PCB layout image 2

Note C15, C16 output caps are 10uF 16V X7R.

Edit: Pin 7 of MAX15062 unconnected to force PFM mode in low loads (like my application. From datasheet:

Mode selection information from MAX15062 datasheet

Edit: Possible source of RTC issue: no return path for SD CLK and SD CMD lines..

enter image description here enter image description here

\$\endgroup\$
12
  • 5
    \$\begingroup\$ Somehow I don't believe it is the crystal who is making the noise. I would suspect the buck converter (specifically the inductor). The fact the noise is going away when you take it out is an extra evidence for that. \$\endgroup\$
    – Eugene Sh.
    Feb 21, 2019 at 19:49
  • 1
    \$\begingroup\$ what frequency is the whining? (use an online tone generator to try and match it). 10kHz? Lower? From the sounds of it, you don't have a scope, I assume? \$\endgroup\$
    – DKNguyen
    Feb 21, 2019 at 19:53
  • 2
    \$\begingroup\$ @Toor I used an online tone generator. It sounds like when the tone generator is between 8 and 10kHz. No I don't have a scope at the moment, but one is on its way. \$\endgroup\$
    – Russell
    Feb 21, 2019 at 20:07
  • 2
    \$\begingroup\$ @EugeneSh. I don't have a scope at the moment. But can confirm using a tone generator online, that the noise sounds like that between 8 and 10kHz. \$\endgroup\$
    – Russell
    Feb 21, 2019 at 20:08
  • 2
    \$\begingroup\$ You can't hear a 32kHz crystal vibrating. Even if it were loud enough, you'd have to have the hearing range of a bat to hear something that high. And, it won't be loud enough. \$\endgroup\$
    – JRE
    Feb 21, 2019 at 21:06

3 Answers 3

2
\$\begingroup\$

I think you mixed up pin 5 and 7. Pin 5 (right upper corner of the IC in your PCB layout) select modes, pin 7 is GND which is obviously needed :)
I would suggest connecting pin 7 to the upper (w.r.t your layout) terminal of C13, but am missing that connection as well. Or is it a via within the pad?

\$\endgroup\$
3
  • \$\begingroup\$ Pin 7 is connected to GND. It is not easily visible in the picture. Please see edited picture \$\endgroup\$
    – Russell
    Feb 21, 2019 at 20:55
  • \$\begingroup\$ Is C17 also grounded decently? No weird diverted return current path? The ground trace of C17 goes to the blue (ground?) layer, but that layer is partially cut by a which trace from C of C17 to the 4 of U4. It looks like the blue plane has no further interruptions, so probably it will be no issue... \$\endgroup\$
    – Huisman
    Feb 21, 2019 at 21:14
  • \$\begingroup\$ Yes the it is grounded. The layout of the converter is pretty much copied directly from the Maxim evalulation board and the layout recommended in the datasheet. This has a single trace on the ground plane too. \$\endgroup\$
    – Russell
    Feb 21, 2019 at 23:46
2
\$\begingroup\$

I have had this problem and it was caused by the switching noise from the converter. The crystal oscillator is an analog circuit with your crystal in the feedback loop, so if there are noise spikes of sufficeint amlitude the oscillator can either miss or add extra pulses, throwing off the frequency. Here are things to try. Make sure that there is no current path under the oscillator section running to your converter (power) or returning through the ground plane. Tying your crystal load capacitors (C21 and C22) to a ground plane is not always the best approach; instead, try providing a separate path back to the processor ground. Keep the crystal and capacitors clear of the ground plane if there is a current path. Also, the fact that you can hear the converter at 8 Khz means that in PFM mode you are "skipping" two out of three buck pulses. You have sized the converter's inductor for larger loads than you are running. In PFM mode, the current spike is always the same high amplitude that would be needed for maximum load; in other words, you are getting a current spike three times larger than it needs to be one-third of the time. If you don't need the headroom for higher power, try changing the buck components for lower power. Finally, check the value of the crystal load capacitors. Remember that the capacitors are in series as far as the crystal is concerned, so you need two capacitors, each about twice the value of the crystal's specified load capacitor.

\$\endgroup\$
5
  • \$\begingroup\$ This makes sense, thank you for the answer. It is clear from this i will have to spin the PCB. The thing is I have removed the OPAMPs from the circuit so really there are no active components requiring 3.3V above the crystal circuit. The pour on the top layer is 3.3V from the buck converter, while the bottom plane is full ground. Could return currents from my RC filters above the crystal cause the problem? \$\endgroup\$
    – Russell
    Feb 21, 2019 at 23:44
  • \$\begingroup\$ Also, I am not confident in changing buck converter components, as this is actually the first time I have designed a PCB. The values of the components have been determined from the datasheet. e.g. for the size of L, use L = 9.3 X Vout, so this gives 30.69uH = 33uH. Is there a way to instead filter/suppress the noise at the output? \$\endgroup\$
    – Russell
    Feb 21, 2019 at 23:51
  • 1
    \$\begingroup\$ Possible but not too likely - think in terms of the ground on the processor being some number of millivolts different from the ground on the load capacitors, or the traces to the crystal being capacitively or inductively coupled to another trace. \$\endgroup\$ Feb 21, 2019 at 23:52
  • \$\begingroup\$ You're right - they recommend a fixed value and I would stick with it. They also give you a nice layout example. Put the converter near the Vin connection, with the circuitry on the other side so that power supply currents are localized \$\endgroup\$ Feb 22, 2019 at 0:07
  • \$\begingroup\$ The thing is, the Vin for the buck converter is also being measured and I was not sure that if putting the converter right near all of the cell inputs would cause noise coupling in all of the readings. Also I may have found the possible source of my problem. Please see the added pictures. I have found that there are no paths for the return current for the SD CMD, and SD CLK lines. Could this be the cause of my issue? \$\endgroup\$
    – Russell
    Feb 22, 2019 at 0:12
1
\$\begingroup\$

On closer examination, I can hear the crystal audibly whining when I put my ear close to it. As the input voltage changes (the design range is from 4.5V to 32V), the whine changes too.

From the datasheet figure "SWITCHING WAVEFORMS (PFM MODE)" the burst of pulses is every 40 us, so at 25kHz. At lighter loads (than 20mA) the time between the burst becomes larger, so the frequency lower. The time also changes with input voltage (which you were describing).

This bursting inductor current causes the inductor to 'tremble', so that's what you're hearing. (Like @EugeneSh. was already suggesting).

I am not sure if the burst go as low as 8 kHz. But maybe you hear 16kHz and it sounds like 8kHz? I have trouble when comparing tones whether i hear 8kHz or an octave higher: 16kHz.

Anyway: this doesn't solve your issue regarding the RTC

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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