3 ms·
It is always good to get to know your MCUs. When I first started using STM32s I would also scope the crystal and then toggle some pins as fast as possible to m
by edoo 8y ago
It is always good to get to know your MCUs. When I first started using STM32s I would also scope the crystal and then toggle some pins as fast as possible to make sure.
Many gadgets later I trust the programmatic detection of external crystal use and appropriate PLL function. If you HAVE to know if the crystal fails you can use the CSS (Clock Security System) to generate interrupts in case you fall back to the internal oscillator.
- ChuckNorris89 8y agoTIP: You should never scope a crystal directly as that could damage it. In production, for testing crystals, we output a PWM on a pin using the crystal as a source and measure that if the MCU doesn't have a built in functionality.
- berti 8y agoSTM32 has MCO outputs that can be used to more directly pass various (divided) clocks through.
- philpem 8y agoI've never heard of putting a scope probe on a crystal damaging it, though the load resistance (typically 1Megohm to ground) and capacitance (~5pF to ground) will affect the frequency. This is why the PWM-out is useful -- it gives you a buffered, divided-down version of the crystal clock.
- edoo 8y agoInteresting, but maybe not required. You can do a programmatic check of the crystal and PLL. I've had over 200k devices fabbed and deployed without ever directly testing a single crystal. What kind of error rate do you find?