3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

MSP430 Based Chronulator (using Launchpad chip)

Step 11Determining the 32.768 kHz Crystal's load Capacitance

Determining the 32.768 kHz Crystal\
«
  • Crystal_Cload_adj.jpg
  • IMG_3283x.jpg
  • IMG_3288xc.jpg
  • IMG_3280xc.jpg
  • IMG_3285xc.jpg
One of the potential gotchas of this type of project is selecting the correct load capacitors (C_load) for the 32.768 kHz crystal. You often have little data about the crystal. Different crystal manufacturers design the crystals with different load capacitor requirements. Searching the web I have seen a range of 6 - 22 pF recommended. The most common one appears to be 12 pf.

Differences in circuit layout on the project board (or PCB) complicates the problem by adding more capacitance. On the plus side, the MSP430G2211 has the ability to provide different capacitance values to the circuit. We can change the capacitance value within a range by software. In the code you will find the following lines. We will select one based on the result of our tests.


// crystal Cload capacitor adjustment - only one line of next four should be uncommented
// BCSCTL3 = LFXT1S_0 + XCAP_3; // 32768KHz crystal, 12.5 pF
// BCSCTL3 = LFXT1S_0 + XCAP_2; // 32768KHz crystal, 10 pF
   BCSCTL3 = LFXT1S_0 + XCAP_1; // 32768KHz crystal, 6 pF
// BCSCTL3 = LFXT1S_0 + XCAP_0; // 32768KHz crystal, 1 pF


Impact of an incorrect selection of C_load:

When C_load for a crystal is too high the crystal oscillates at a slightly lower frequency. Likewise, when the capacitance is too low the crystal will oscillate slightly faster. For a 32.768 kHz crystal, we are generally talking about 1 or 2 Hertz. One or two Hertz, you say, that doesn't sound like much. What is the big deal?

The MSP430's 16 bit timer resets every 2^15 or 32,768 pulses. If we use a crystal that provides exactly 32,768 pulses per second, then the timer will reset every second. If the crystal is actually running at 32,766 pulses per second, the effective MSP430 "second" is

1 sec + 2/32766 sec = 1 1/16383 sec

After 16383 seconds (~4.55 hours), the Chronulator would be one second behind a clock with a crystal running at 32,768 Hz. In other words, it would lose a minute every 11.375 days.


    Crystal            Pulses       Time to be       Time to be        Fast /
  Frequency           Off            off 1 sec.           off 1 min.       Slow
----------------------------------------------------------------------------------------
   32,766                -2              4.55 hrs.         11.375 days     Slow
   32,767                -1              9.50 hrs.         22.750 days     Slow
   32,768                 0                 -- should keep good time --
   32,769                 1              9.50 hrs.         22.750 days      Fast
   32,770                 2              4.55 hrs.         11.375 days      Fast


How to select the proper value of C_load:

Step 1:

Select a watch that keeps very good time, or use your computer or cell phone clock, to be your standard. Place your standard next to the Chronulator. Wait until your clock' second hand is at about at 20 seconds and quickly set your chronulator time to just one minute behind your clock. When the clock's second hand approaches 12 (or 60 if digital) push the chronulator's minute increment button to bring the two clocks into sync. Since you will most likely be off a second or two, observe both clocks another minute to get the exact second that the Chronulator's minute meter advances ("ticks"). Write down the date, time, and the second of the "tick". You will not remember.

Step 2:
Wait a day or two, then check to see if the both clocks are still in sync. If you are not sure wait a few more days, by that time if they are off, you should be able to tell. If you still can't tell, then things are ok and no adjustment will need to be made.

Step 3:
If the clocks have lost sync, adjust C_load capacitance by changing one of the commented lines above in the c program and commenting the setting that was in use. If your standard clock is ahead of the Chronulator, the Chronulator is slow. Decrease the capacitance value. If your standard clock is behind the Chronulator, the Chronulater is fast. Increase the capacitance value.

What if your clock is still fast and you can't increase the capacitance any higher? In this case, you could add 2 very small capacitors (6-12 pF) from each of the crystal's leads to ground. I would just try another crystal. If you decide to add capacitors you can get them from Mouser (6 pf - Mouser part # 81-RPE5C1h6R0D2P1B03 $0.18, 12 pF - Mouser part # 81-RPE5C2!120J2P1Z03 $0.23).

What if your clock is still slow and you can't decrease the capacitance any lower? In this case, check if you can reduce the capacitance on your project board. This can be done by making sure that the crystal is close to IC pins 12 and 13. Also make sure that the runs for the crystal are short. If this doesn't help, I would try another crystal from another source.


By the way, if you have a pulse counter, you can make ACLK available at P1.0 with a simple program (attached below) and check the crystal's frequency in the project board directly. I used this technique to observe changes on my Launchpad / crystal setup. I found that the recommended setting of 12 pF (XCAP_3) was a little too high C_load. Look at the different photos below to see the results of different XCAP settings. You might wonder about my counter calibration. I feel very comfortable that it is correct, because I was able to achieve a 32,766 Hz setup on my project board / crystal combination. With this setup, I observed the 1 second loss every 4.55 hours shown in the table above. When I optimized it for C_load (i.e., observed freq = 32,768 Hz), the clock was right on the money.
« Previous StepDownload PDFView All StepsNext Step »
1 comment
Jan 24, 2011. 4:15 PMrcafrix says:
thanks for the effort of detailing everything. just finished building it, it works perfectly!!!

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
30
Followers
8
Author:Doug Paradis