Crystal Load Capacitance - Page 1
Forum section: electronics / general

author: anvoice
author_rank: Frequent Contributor
timestamp: May 15, 2025, 07:45:09 am
content: Hello, trying to select a 32.768KHz crystal for a project where I'm hoping to use a SAMD51 chip (ATSAMD51G19A-MF), which can operate at 120MHz max. The project is a BLDC motor controller, so I'm not certain I need the extra accuracy over the internal oscillator. So I had several general questions: (1) is it worth using an external crystal for an application driving a BLDC motor? (2) If it is, how important is it to match the datasheet load capacitance of the crystal to what it will actually see? I don't see how I can match it exactly with fixed caps, but I can try to get close using the given approximate internal capacitance of the XOUT and XIN pins (slightly different values of 5.9 and 6.3pF) and a general estimate of the trace capacitance.

author: voltsandjolts
author_rank: Unknown
timestamp: May 15, 2025, 08:07:46 am
content: Your mcu has two digital PLLs (FDPLL200Mn) which can multiply 32kHz to near 200MHz, with some filter settings for jitter reduction. Whether the accuracy and jitter are acceptable for your applcation, I don't know. My recommendation would be to use a higher accuracy, lower jitter crystal, say 8 or 16MHz and use that as input to the PLL. Build your application with that, and when your happy with the functionality try running it from 32kHz, if your cost optimisation really needs to save the USD$0.8.

author: anvoice
author_rank: Frequent Contributor
timestamp: May 15, 2025, 08:55:22 am
content: More like space/effort optimization. Considering the cost of the motor itself and other components like the encoder, the cost of the crystal is almost nothing.So 16MHz is a better choice than the 32.768KHz the datasheet suggests? I have very little experience with this, so I just took the reference value. Is there a way optimize the frequency in this case?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: May 15, 2025, 08:49:07 pm
content: Most 32kHz locking schemes I've seen simply wobble the trim register to average the internal RC oscillator. More accurately called Frequency Lock.The edge frequency is too low to run a proper analog phase lockHigher 8Mhz + clock-in values are usually enough to operate a true Phase Locked loop, but check the data sheet details and even verify yourself with a scope.Another clock choice not mentioned yet, is an Active Crystal Oscillator.These are dropping in price, and have a few advantages* They do not need two trim caps* They have no exposed analog nodes* They can have quite good initial cals, ±10ppm is common* The vendor ensures they start properly* They consume only one MCU pinExample : 16c/500+ for 16Mhz ±10ppmhttps://lcsc.com/product-detail/Crystal-Oscillators_huaxindianzi-3Y016000VP_C19725354.html

author: wraper
author_rank: Unknown
timestamp: May 15, 2025, 08:56:07 pm
content: Oscillator jitter is irrelevant for driving a motor unless it's extremely terrible.

author: BadeBhaiya
author_rank: Regular Contributor
timestamp: May 15, 2025, 10:10:33 pm
content: Your microcontroller has an internal 32.768KHz oscillator which you can use for walking up from sleep and such. Its entirely optional to put an external 32.768KHz crystal from a functionality standpoint.Seems like this chip also has a bunch of internal PLLs and stuff.For a motor driving application, i wouldn't really bother with having an external low speed crystal, or even high speed one .The jitter won't hurt, you can definitely afford to be off. Motors aren't fast, relative to your clock.

author: xavier60
author_rank: Super Contributor
timestamp: May 15, 2025, 11:12:08 pm
content: I use the PIC16F15323 for my motor drive application. Although the internal oscillator is good enough, I have decided to try a ceramic resonator.The upper temperature limit is higher than most crystals and drive level seems to be a non-issue. I did add some drive resistance to get a nicer wave shape.https://au.mouser.com/ProductDetail/Murata-Electronics/CSTLS8M00G53Z-B0?qs=ip6kGrui0d7%2FrFfcdtMldQ%3D%3DCorrection:https://au.mouser.com/ProductDetail/Murata-Electronics/CSTNE8M00GH5C000R0?qs=y6ZabgHbY%252ByuG8XwUR67qA%3D%3D

author: anvoice
author_rank: Frequent Contributor
timestamp: May 16, 2025, 01:56:52 am
content: Ok, I'm trying to absorb the 2000-page datasheet, but it will probably take a while... So I must ask for some clarification in the meantime. I was under the impression that the MCU would derive its 120MHz clock from an accurate 32.768kHz external crystal, but now I'm not sure. Do I need an external 32.768kHz crystal as well as a 8-48MHz crystal to generate the required clocks? A quick search via google AI seems to tell me that the 120MHz is derived via FDPLL from an external crystal such as the 32.768kHz or a 48MHz one... So a bit confused here.Quote from: PCB.Wiz on May 15, 2025, 08:49:07 pmWill do.As far as an active crystal oscillator goes, I'm not sure how to connect it to the MCU. Does it use a single oscillator in pin? I also notice they too have a load capacitance, but not sure how to provide it in this case (e.g. example layout).Quote from: BadeBhaiya on May 15, 2025, 10:10:33 pmSounds logical, I'm just trying to think of scenarios in which the crystal might be important. After all, I can add one for cheap now, but not if I already had the pcb delivered.Quote from: xavier60 on May 15, 2025, 11:12:08 pmThanks for sharing. I did find quite a few crystals with the same 125 Celsius upper temperature (definitely important for a motor with integrated driver). Since I'm still confused about whether I actually need the crystal (or a resonator), hoping for a bit more feedback before finalizing.

author: wraper
author_rank: Unknown
timestamp: May 16, 2025, 02:03:31 am
content: Quote from: BadeBhaiya on May 15, 2025, 10:10:33 pmI don't know about how good is internal oscillator in this particular MCU, but generally you would want to use something more precise to get the RPM right.

author: anvoice
author_rank: Frequent Contributor
timestamp: May 16, 2025, 02:49:09 am
content: Reading further, the low-frequency crystal is for RTC while either the internal or external higher-frequency clock source is the main clock. Is there an advantage to having a RTC that is accurate for a BLDC driver? Do I need a more accurate main clock (e.g. it was mentioned I might want more accurate rotations per minute, and I'm guessing that's dependent on the main clock, not the RTC). Not sure yet.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: May 16, 2025, 03:02:17 am
content: Quote from: anvoice on May 16, 2025, 01:56:52 amMost MCUs have a choice of external Crystal (2 pins), or external clock (1 pin)Quote from: anvoice on May 16, 2025, 01:56:52 amA Crystal resonator needs the two load Caps for precise frequency control, frequency shift ballparks may be 20ppm/pF, so the correct caps do matter there.The load C given on Active Oscillator data sheets is just for test purposes, it is not needed for frequency and a simple direct connect to the MCU pin is okKeep that trace very short.

author: Siwastaja
author_rank: Super Contributor
timestamp: May 16, 2025, 05:40:53 am
content: What are you going to do with the project? 32768Hz crystals are usually used for accurate real-time clock time keeping, or some very timing-sensitive things like low-power radio communication between multiple units where they need to start their receivers/transmitters exactly at the same time after a long pause, to minimize power use. Unless you are going to have features like these in your motor controller, crystal accuracy is not going to matter the slightest, and there probably is no need to use a 32768Hz crystal at all. Then again, if you are unsure what features you will be adding in the future, adding a 32768Hz crystal - or at very least, some exposed pads and extra room on the PCB to bodge one in place later - at this point may be a good idea.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: May 16, 2025, 05:47:16 am
content: Quote from: anvoice on May 16, 2025, 02:49:09 amIf you are doing a PCB design for this, I'd suggest including an active xtal osc footprint, wired to XIN, which is rated to 48MHz CMOS in.You can then try both.Pick an Osc MHz that is used in some of the MCU examples, which means you can copy their init code. That MCU has a complicated clock scheme.

author: anvoice
author_rank: Frequent Contributor
timestamp: May 16, 2025, 06:16:07 am
content: Quote from: Siwastaja on May 16, 2025, 05:40:53 amThe idea is to use the bldc controllers in a robot arm and a quadruped robot. It's indeed unlikely that I'll be using something like low-power radio between motors. Perhaps I will still benefit from an external 48MHz for the main clock though?Quote from: PCB.Wiz on May 16, 2025, 05:47:16 amFair point. Unless I find myself extremely space-constrained, which is unlikely, that is a good suggestion.

author: Siwastaja
author_rank: Super Contributor
timestamp: May 16, 2025, 08:53:39 am
content: Quote from: anvoice on May 16, 2025, 06:16:07 amPerhaps. How are you going to communicate between controllers? Maybe CAN BUS, maybe UART? For those, approx ~1% worst case clock accuracy is a good idea. Most internal MCU oscillators can do that, but some only after calibration (in which case an external crystal or oscillator can be just simpler), so it's worth checking.Or, are you going to measure speed (RPM) and if yes, what accuracy you need for that? 1% clock error would directly translate into 1% RPM error, for example.

author: Aart
author_rank: Newbie
timestamp: May 16, 2025, 09:13:16 am
content: Crystals are quite complex electromechanical components, with a lot of analog parameters that MIGHT be relevant when you least expect it.If it is possible to copy an existing (pcb-) design & BOM that can be an easy option.If that is not possible the choice is between engineering and testing (over relevant temperature etc.) a new design, or avoiding that by buying a complete xtal oscillator.Given the context the last option might be te best advice.

author: bson
author_rank: Unknown
timestamp: May 19, 2025, 07:36:07 pm
content: A 32.768kHz crystal actually seems like a fine choice. They're tiny and low power, as are the internal oscillators that drive them. They are however sensitive to load capacitance, so make sure to load it properly, or find one that's happy with just the pin capacitance. Because of the low drive power if slightly mismatched the XO simply won't start up. Don't ask how I know.Frequency lock is all you need. The clock frequency correlates to motor speed, so locking the internal RCO to an XO is all that's needed. Any jitter is going to be at frequencies significantly higher than 32.768kHz, which I'm sure is substantially higher than what matters for the motor speed control. At e.g. 1kHz the std dev (jitter) is going to be tight around the mean 1ms interval.I have a trivial XO load capacitor calculator athttps://github.com/bson/xoloadHowever, this won't handle asymmetric XO pin capacitance.You can disregard the trace capacitance for SMT scale traces with a crystal and load caps placed close to the pins.

author: anvoice
author_rank: Frequent Contributor
timestamp: May 20, 2025, 12:40:34 am
content: Quote from: bson on May 19, 2025, 07:36:07 pmI haven't yet calculated the PWM frequency I'll need for this motor, but my guess is it's closer to 10kHz. Also, is the RTC crystal the one responsible for the PWM frequency? Or do I select between the low frequency crystal (and FLL) and a higher frequency 48MHz to generate the main clock? If my choice is one or the other and I don't need high accuracy for the RTC specifically, is there a reason to choose the 32.768kHz crystal?It'll probably be a bit of a challenge to load the crystal correctly. There are two (different) internal capacitances for the XIN and XOUT pins, as well as the pin/trace capacitance that I'll have to guesstimate.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: May 20, 2025, 12:52:54 am
content: Quote from: anvoice on May 20, 2025, 12:40:34 am32Khz crystals are more accurate than the on chip RC oscillators, but less temperature stable than a MHz crystal or MHz crystal oscillator.32Khz crystals are also very high impedance parts, so are slow to start, (they can take 1 second) and can be fussy to get going with margin.They are used mainly if youreally needa low power mode, that keeps the RTC going.If your motor controller is simple, standalone and does not need to keep pace with other motor controllers, you may not need a crystal at all.

author: anvoice
author_rank: Frequent Contributor
timestamp: June 18, 2025, 03:17:25 am
content: Trying to find an actual 48MHz part with good frequency stability on Digikey (crystal or oscillator): the best they have is +-50ppm for higher temperature ranges. Wonder if that is acceptable accuracy. Assuming 48MHz, it should drift to a max of 48.0024 or a min of 47.9976MHz. Seems like reasonable for speed control, but not certain.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: June 18, 2025, 05:21:42 am
content: Quote from: anvoice on June 18, 2025, 03:17:25 amWhat temperature range do you need?I see the MC2520Z48.0000C19XSH specs 1.71V ~ 3.63V ±30ppm -40°C ~ 125°Cand the TCXOO 48,0-JT21CT-A-P-1,8-LF = TCXO 48 MHz HCMOS 1.8V ±2.5ppm -40°C ~ 105°CO 48,0-JT21CT-A-P-3,3-LF = TCXO 48 MHz HCMOS 3.3V ±2.5ppm -40°C ~ 105°C

author: anvoice
author_rank: Frequent Contributor
timestamp: June 18, 2025, 07:15:33 am
content: Quote from: PCB.Wiz on June 18, 2025, 05:21:42 amThat first one is the one I am currently planning on using. I don't know how hot the board will get without building and measuring, but trying to stay at 125°C top range for components.

author: ftg
author_rank: Frequent Contributor
timestamp: June 18, 2025, 07:55:49 am
content: Why does a motor controller need a TCXO?Does it have some radio on it that needs it for stability reasons?Considering that even 1000Base-T runs fine with low cost 25MHz crystals.As for 32kHz vs. some +8MHz crystal, the high frequency crystals will be more mechanically robust and smaller.Modern crystals below 30MHz should be fundamental mode and require minimal trickery to get running reliably.Unless the motor controller keeps an accurate runtime in it for warranty reasons, I don't see what value the 32kHz crystal would bring.

author: NorthGuy
author_rank: Super Contributor
timestamp: June 18, 2025, 01:42:39 pm
content: Use common sense. Ask yourself: "What is going to fail if my time base is not accurate and may vary within 2%?". Understand the mechanism of the possible failure and evaluate consequences for your design. Most likely you don't need a crystal for motor controller.

author: anvoice
author_rank: Frequent Contributor
timestamp: June 18, 2025, 10:07:05 pm
content: Quote from: NorthGuy on June 18, 2025, 01:42:39 pmQuote from: ftg on June 18, 2025, 07:55:49 amFair points. Someone pointed out it may be better to provision for a crystal even if I don't end up needing it, since I can't add pads post-design. I do plan to do speed control, which may benefit from better than 2% stability. Nothing else that would fall apart comes to mind.

author: SteveThackery
author_rank: Super Contributor
timestamp: June 18, 2025, 11:05:46 pm
content: Just a note about 32768Hz crystals: some of them are designed for use in watches, which run on 1.5V. Make sure you don't buy that type because they don't perform well when connected to a 3.3V or 5V microcontroller. When the crystal resonator is overdriven such that its amplitude is much higher than designed, its frequency can move well outside the specified tolerance.So, make sure the crystal is specified for 3V and above.

author: anvoice
author_rank: Frequent Contributor
timestamp: June 18, 2025, 11:37:43 pm
content: Quote from: SteveThackery on June 18, 2025, 11:05:46 pmThanks, will do. I will likely buy from Digikey, and they well-defined electrical characteristics. The one I chose should operate fine at 3.3V.

author: Siwastaja
author_rank: Super Contributor
timestamp: June 19, 2025, 06:44:18 am
content: Quote from: SteveThackery on June 18, 2025, 11:05:46 pmI have never seen voltage specification for crystals. Picked six random datasheets from different manufacturers to verify this: no such specification.