Introduction: Instant MSP Hacks: the Crystal Plug

About: (There's so much interesting stuff around, let's not waste more time in this box here.)

Have you ever oscillated between soldering and not soldering the clock crystal on the Launchpad?

This is an annoying dilemma: either you do it and lose the two GPIO pins, or you don't and you can't do LFXT1-based precision low-power timing on the board.

A day or two ago I LEGOed together an easy current-measurement attachment for the Launchpad. You know, to measure the power consumption: remove the VCC jumper from the J3 "debugger bridge" header (turning off the board), mess with the measurement (inadvertently resetting the board a dozen times, before powering it off at the end), then put the jumper back on (powering on again) -- you normally only do it once, and then never bother again... ;) But with a 2-wire female-female jumper cable, with a closing "male jumper plug" (made of the original VCC jumper cap + a 2-pin long-centered break-away PCB header piece), it's never again going to be a problem (bonus: an on/off plug for the Launchpad!). And finding it great fun, I thought I'd try something similar for the quartz, too.

Well, not quite as instant a hack as that other one, and actually I even fouled up my first one and had to throw away the crystal..., but it's still pretty simple, and I can't tell you how freaking useful it is, so definitely worth an attempt (and a retry or two)!

NOTE: After I finished mine, vague memories started nagging me that I may have seen it done by some guy before, perhaps right here on Instructables. I tried finding it, but couldn't, though. So, if you happen to have seen it, please let me know who made it, so I can give him credit.

NOTE/2: This hack is OK for quick & dirty prototyping with the Launchpad, but probably not OK as the stable, noise-free main oscillator for your secret Mars mission.

Step 1: Overview of Parts & Tools

Parts:

You can see all the parts in the first picture. Well, barely, as the quartz is so hopelessly tiny... -- but be prepared, because you'll need to even solder some stuff to it somehow!

Anyway:

  • a 2-pin DuPont-style female connector housing
  • a 2-pin break-away PCB header piece
  • 2 female crimp pins
  • 2 cm heat shrink tube, of diameter 4.5 (mm, I think, see the pic)
  • the clock crystal that came with the Launchpad

NOTE: The first picture is also an "exploded" view of the end product (sans solder).

Tools:

  • hack saw
  • narrow flat-nose pliers (and/or short tweezers)
  • optional: crimping tool (-- but that may be too big for this task!)
  • soldering iron, with the smallest tip you have (type "B", as I learned from this instructable)
  • lighter (or heat gun)
  • helping cat hand

Step 2: Cut the Connector Housing to Size

OK, this is the step, where the fun ends...

The connector is, unfortunately, just a bit too long for the the PCB header pins that we'll insert upside down, from above. So you need to cut off the top (with a hack saw), ~2mm above the plastic latches. (That will also leave a healthy strong rigid frame there to let it work properly. Er, I'm just saying, because fouled up my first piece, cutting off too much, so it basically fell apart instantly).

NOTES:

  • If you cut too little, the crimp connectors will have too little grip on the PCB header pins.
  • If you cut too much (but not quite as much as I did first), that's less of a problem: the plastic base of the PCB header pins will just stick out a bit at the top, but the shrink tube will take care of that, both functionally and aesthetically.
  • Make sure the hole is clean and tidy after the cut, as any leftover burr on the inner edge may block the crimped pins when trying to insert them later.

Step 3: Crimp the Pins

Easier said than done! I don't have a suitable crimping tool for this, so I can't tell you how exactly it would work the "proper way" (well, crimping a single hard pin like this is not exactly the "proper" way of doing anything anyway...), but I bet it would be easier than trying to manually fold those tiny flaps around the pins with the smallest flat-nose pliers I have here.

NOTES:

  • Insert the PCB pins as deep as they go into the female crimp pin connectors -- no worries, that should leave just enough space for a perfect sit on the board eventually.

  • Obviously, the crimp pin connectors should be aligned properly, with their little spring latches both facing the camera. ;)

  • It's not actually critical to make it super tight. Or you might as well solder them a bit, if you feel like.

Do I need to add that I sort of fouled up mine? Both of the (not exactly...) crimped connector pieces fell off happily no matter the amount of careful nano-scale bending and pressing all in vain.

But this time I didn't have to throw it away: I just bent the two pins closer together a bit (with a pair of pliers), until they were no longer quite parallel. Now, when sliding into the connector housing with the connectors on, they will no longer fit perfectly, but will be strained with just enough force that friction will hold the pins in place like a spring connector -- at least until putting on the shrink tube, which will do even more straining, as that is the actual fastening element (see later).

Now, snap the header piece right in to the housing, for some well-deserved fake reward. (This at least always feels so good, doesn't it?)

Step 4: Solder the Crystal to the PCB Header Pins

(To the "official bottom" side, with the shorter pin endings.)

Hah! Now, this is serious pain...

NOTE: The quartz is pretty annoyingly small and delicate. It has tiny, fragile legs, too close to each other, pre-bent for surface-mounting, and too close to the metal case. So, guess what: I fouled up mine first (OK, I mentioned this already), because I dropped a solder blob right with my first move, right to the middle between the tiny legs, shorting the crystal for good. (I might have managed to somehow clean it with a thin solder wick or a "precision sucker" (neither of which I really have), but I just didn't quite feel the Force for doing magic like that. Besides, I have all those unused 32K Launchpad clock crystals anyway, so I just let it go.)

And I also fouled up another one later: this time I noticed only afterwards that I had managed to solder the entire lab to the metal case of the crystal, which sort of negates its usefulness as an oscillator. Don't do that.

Here's the thing:

  1. Take the crystal, and lightly bend its legs apart to match the 0.1" distance of the PCB header pins. (See the pic.)

  2. Clamp the contraption into a helping hand or a vice or something, preferably with a magnifying glass.

  3. Put some solder on the tips of the two header pins. Not too much, to avoid shorting, but have a good 1 mm on the sides, too -- that can save the day when desperately trying to align the crystal as best as possible, and failing.

  4. Hold the crystal in place, with its legs touching the solder blobs on the PCB header pins. Don't move, don't breathe, just hold it still while re-heating the tin blobs with the soldering iron just so much that they float up the crystal's legs a bit.

  5. Phew. All right, you can breathe now, and check the contacts with a multimeter. If it beeps, start over from step 1, with another crystal...

Step 5: Test Before Finalizing!

If you are lucky:

  • the crimp pins are just perfectly in place,
  • the "crimping" holds with enough force to maintain contact,
  • but the (hit-and-miss) soldering is not stretched too much so as to break off.

Before the final move, it may now be a good idea to test it in action, because this is the last moment when you can still make corrections without even more pain. (Or, actually, it may quite as well be a bad idea, since plugging the half-ready fragile thing in, and then pulling it off, may itself cause some damage, so... It's up to your intelligent judgement, by assessing how you've excelled or messed up so far.)

Testing live on the Launchpad:

Because the external crystal is turned on by default on the Launchpad (regardless of it being present or not), and is fed to the ACLK clock signal, all you need to do is routing ACLK to GPIO -- which is thankfully supported by the MSP430, at pin P1.0. (See the test code below.)

a) If you have an oscilloscope, you're done: tap on the pin, and see the difference with the crystal plug on and off.

b) If you don't have a scope: nooo waaay! :-o Get a DSO Nano, immedieately!

Until it arrives, notice that P1.0 also happens to be the same pin that drives the red LED on the Launcpad, which means it will now be turned on and off by ACLK directly! So, with some lucky tweaking, the frequency difference at which ACLK would be blinking the LED, with and without a crystal, might just be visible with the naked eye!

Well, I tried it and: ...bingo! The "raw" ACLK signal divided by the highest setting (8) does flicker the red LED quite visibly!

NOTE: That "raw" ACLK seems to be a pretty erratic but fairly steady signal at 4-6 kHz, which is just somewhat below VLO/2. But neither VLO nor (even less) that divider of 2 seems to be the default, according to my reading of the docs... So, I'm a bit puzzled here, what that signal is, so please help me out in the comments, about what's going on there!

Anyway, burn the code below to the Launchpad, and see the red LED slightly, but clearly trembling. Then (carefully!) put the crystal plug on the XIN/XOUT headers, step back, and wait a sec. If all went well, you should see the red LED now glowing in a nice, smooth light (roughly at 32/8 = 4kHz) now!

NOTE: Noticed, how sensitive this crystal stuff actually is? Touching the XT pins, or even just moving your hands close enough to the crystal can make the oscillationrun havoc (actually: slow down, this is exactly how the touch-sensitive pin oscillators work!) or totally collapse, so the light (= ACLK) easily becomes a randomly flickering mess. I told you, this won't fly you to another planets, but still great for experimenting at home!

#include <msp430g2553.h>

int main()
{
	// Stop WDT
	WDTCTL  = WDTPW + WDTHOLD;

	// Set div. 8 for ACLK
	BCSCTL1 = 0x30;

	// Route ACLK to GPIO pin P1.0 - which is also the red LED!
	P1SEL |= BIT0;
	P1DIR |= BIT0;
	P1OUT |= BIT0;

	// Blink the green LED, too, if we are at it... ;)
	P1DIR |= BIT6;
	while (1) {
		P1OUT ^= BIT6;
		__delay_cycles(100000L);
	}
}

Step 6: Add the Heat-shrink Tube, and Enjoy Your Crystal Plug!

The shrunken tube will hold the stuff surprisingly tight & fixed nicely and securely. Short of a heat gun, I just used a lighter (and not fouled up this time).

Conclusion:

This solution is presumably not bullet-proof, but works great, seems and feels strong enough to survive lots of happy prototyping, and while it lasts, mine will trigger an ear-to-ear smile every time I upload firmware that happens to need a crystal on a Launchpad that has none soldered on -- and will never really need one, after all, from now on...