Electronic – Using external oscillator for MSP430 Timer

msp430oscillator

I'm want to use an external low frequency crystal (32kHz) for the timer in my MSP430G2553 and the internal oscillator at 8MHz, but in the datasheet I can't see how I should use the external crystal for the timer. As there only appears to be one pin(TACLK). So how would the design for the oscillator look?

Best Answer

To use an external 32.768 KHz crystal with the MSP430G2553, the crystal needs to be soldered between the Xin and Xout pins of the microcontroller. In the DIP package, those are pins 18 and 19. No additional components are required for this.

TA0CLK has nothing to do with this crystal's connection, please see the pin descriptions in the datasheet.

See this schematic of the MSP430 Launchpad Target Microcontroller section:

MSP430 Launchpad Target Board

You can see the two 0 Ohm resistors on the pins 18 and 19 - the crystal attaches between them.

Please note:

  • Adding a crystal prevents those pins from being used as GPIO Pin 2.6 / TimerA TA0.1 (the Xin pin's other functions) and GPIO Pin 2.7 (the Xout pin's other function.
  • Instead of crystal, a digital clock from an oscillator can also be supplied to Xin in bypass mode.
  • For crystals of frequency higher than the 32.768 KHz crystal, appropriately sized load capacitors are required in addition. See the relevant part-specific datasheet for this.

UPDATE:

Once the 32.768 KHz watch crystal is connected to the MSP430, the following notes are handy to confirm that the crystal is operational, and of course to use the crystal going forward.

  • The crystal on XIN / XOUT is used as ACLK. Conversely, for using ACLK, a crystal must be connected between XIN and XOUT.
  • If the implementation is on an MSP430 Launchpad board, note that crystal diagnostic code is provided in Justin's Tech Blog - the gold standard that pretty much everyone followed in the early days of the Launchpad.
  • Other such walk-throughs are in NJC's Launchpad Blog, and in the TI "Getting Started with the MSP430 Launchpad" document, in the "Optional Lab Exercise – Crystal Oscillator" section.
  • The internal (on-chip) matching capacitance needs to be set for the crystal to work: Set BCSCTL3 (Basic Clock System Control 3), BCSCTL3 |= XCAP_3; for the 12.5 pF watch crystal provided with the Launchpad.
  • Detailed information on using Low Frequency Crystals is provided in this TI document.
  • An excellent, step by step explanation and verification code is provided in this blog.
  • Most important: Code using LF crystal ACLK does not function as expected while stepping through in debug mode, you have to run the code in "Run" mode for the various diagnostic code fragments mentioned above to work. This quirk is apparently not documented anywhere, I spent a fair bit of time removing and resoldering the crystal on my first launchpad, assuming a failure, till I figured this out.