Wednesday, October 8, 2014

Soldering the Launchpad Xtal

In this article I will talk about soldering the 32768 Hz quartz Xtal that is provided with the G2 Launchpad.
This article is a rewrite in english of one article in my spanish twin blog Aim65
The 32768 Hz Xtal is the basis of a real time clock. In fact 2^15 clock cycles of that device correspond to one second. In the MSP340 familly we can use the Watchdog in timer mode associated to it to generate one interrupt each second.

Launchpad and Xtal bag

This Xtal is included with the Launchpad package but it is not soldered on the board. As  this device uses two MCU pins, you lose two I/O lines when you solder it on the board. It's up to you to decide what is better: a 32768 Xtal or two I/O lines.

The following figure show the position where the Xtal should be soldered.

Xtal Location

This Xtal is tiny and somewhat difficult to solder. The easiest way to proceed is to fix it in place by means of adhesive tape. Beware that the Xtal is not symmetrical. When correctly laid on the board the contacts should touch the soldering pads.

Xtal fixed with adhesive tape
A good soldering iron and a magnifier helps soldering the Xtal.

Xtal soldered on the board
When the Xtal terminals are soldered we can take out the adhesive tape and then we can solder the Xtal body to the pad located below it.

Xtal soldered at the three points
After the Xtal is soldered we should check its correct operation. I have developed a little program to do that. It compiles under MSP-GCC and contain two main files: main.c and io430masks.h.

main.c



io430masks.h




The program tries to start the oscillator associated to the Xtal. If it works ok, the green LED blinks every second. If the oscillator could not start, it lights the red LED.

If the oscillator cannot start we must first check the soldering.

The oscillator is quite sensible to any interference. The oscillator pins are connected to the J2 header as they can also be used for I/O. This connection includes two zero Ohm resistors in the path. To minimize any interference those lines can be disconnected desoldering those resistors.

Resistors removed

Alternative to soldering the Xtal

If you don't want to mess with the board or you don't want to permanently eliminate two I/O lines you can connect a Xtla to the J2 lines associated to the oscillator.
That can be done using the Xtal provided with the Launchpad but its size makes it a little complex. Moreover 32768 Xtals are cheap and easy to obtain. It is important, however, to buy ones designed to operate with 12,5pF or 6pF capacitors. As the MCU includes those capacitor options inside you don't need to add them using discrete components.
This is the Xtal I have bought at Farnell, for instance:

Xtal soldered to a female header
I have soldered it to a two pin female header to be easily connected to the oscillator J2 pins.

Xtal at J2
Connecting the Xtal at J2 increase its wire lenght and could give some interferences. The proper solution is to solder it on board if possible.

With the Xtal mounted on the board its easy to develop any application that should keep a real time clock.

No comments:

Post a Comment