I have an issue with a PCB design where the HSE and LSE oscillators are not working correctly on an STM32F107VCT6 MCU. Before I start, this code has been running flawlessly on a couple of different dev boards including the Waveshare Open107V.

The HSE appears to start up, however I believe it is running slower than the dev boards when I look at the HTTP page response for an onboard webserver running on the unit. In addition, the DS2502E48+ 1-wire device does not initialize due to the pulse width of the data, see below.

enter image description here

compared to 1-wire device working on the dev board below.

enter image description here

In addition, the dev board outputs a steady 25MHz signal on PA8 (RCC_MCO) pin whereas I see nothing but noise on the new PCB.

I can however run the program, and I have a couple of PWM pins outputting an accurate 10 kHz PWM signal.

The above leads me to believe there is an issue with the hardware, I guess most likely the configuration of the oscillator or layout.

After a suggestion on a previous post, I modified the PCB layout to include a ground plane, separate grounds under the oscillator circuit and vias connecting the two together with a single connection back to the common ground plane.

PCB top layer

PCB bottom layer

enter image description here

For the HSE I am using a 25 MHz 7pF 40R ESR (Seiko Epson X1E0000210621) to match what my dev boards are running. The load capacitors are both 6pF C0G ceramics. The calculations for the external resistor came in (at least by my calculations of not being required, as such a zero ohm was used.

The LSE oscillator simply doesn't appear to start up at all, I'm happy to create a separate question for that if needed however it is a recommended NDK NX3215SA-32.768K-STD-MUA-14 6pF 70k ESR unit with 4p7 C0G ceramics.

I really need some assistance on this as I can't afford to get more boards manufactured unless I know I'm going down the right track.

Cheers, Paul


1 Answer 1


You seem to have the 25 MHz HSE crystal on the LSE oscillator pins.

Not seen in schematics, but the assumption is that your 32768 Hz LSE crystal is on the HSE oscillator pins.

  • \$\begingroup\$ And sometimes it takes an additional set of eyes. Seems I made a stupid assumption based on the pin labelling. Many thanks, I'm surprised this board even runs to be honest. Notwithstanding that oversight, does the layout of the crystals on this board and the ground planes, etc look ok as it stands. I'd like to get some feedback on the layout side of things before I start ordering again. \$\endgroup\$
    – pspeirs
    Jan 15, 2023 at 21:23
  • \$\begingroup\$ Frankly it looks over engineered - almost every trick from crystal oscillator design appnote is used. I would not use such high 25 MHz oscillator. Too much hassle and calculations to make sure the crystals you find work reliably. The capacitor values are very low, 5pF is suggested minimum. But they are tunable so you can change caps and crystals. Have you taken stray and pin capacitance into account? Each IO pin is about 5pF. \$\endgroup\$
    – Justme
    Jan 15, 2023 at 21:38
  • \$\begingroup\$ @pspeirs: The schematic symbol for X1 is correct for a 32768 ceramic resonator. The symbol for X2 is correct for a crystal. It looks like the values are entered incorrectly. I am with Justme on the 25MHz being high. If I were to use 25MHz, an external TCXO would be my choice over the MCUs oscillator. \$\endgroup\$
    – RussellH
    Jan 15, 2023 at 22:58
  • \$\begingroup\$ I only chose the 25MHz as that is what had been used on the development boards I had been using previously, and I believe this was due to having integrated ethernet. So happy to drop down to something a little lower if it brings more stability or less tuning headaches. I've seen a number of people using a 16MHz resonator, would this likely be a more appropriate choice? In terms of being over engineered, quite likely as I wanted to eliminate as many potential pitfalls as possible (having not designed an oscillator circuit before). \$\endgroup\$
    – pspeirs
    Jan 16, 2023 at 0:32
  • \$\begingroup\$ The caps for X1, I thought were a little high actually looking back at them now. It has been suggested to use 5pF as stray, which would give me a much lower value of around 4pF using 2 * (CL - CS) \$\endgroup\$
    – pspeirs
    Jan 16, 2023 at 0:32

Your Answer

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

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