jsolarski 94 Posted August 20, 2010 Share Posted August 20, 2010 This is how to install the 32K stock crystal that comes with the MSP430 Launchpad kit Original post http://justinstech.org/2010/07/msp430-launchpad-dev-kit-how-too/ * Supplies * Launch pad * 32KHz crystal * soldering iron * solder * headers * Bright lamp * electrical tape or tape like substitute * odds and ends (lol)(tweezers or other tool for manipulation) Steps 1) open crystal packagaging and place crystal on launchpad 2) more the crystal around with tweezers or other manipulation tool till the leads of the crystal line up with the solder pad (you may need to use a magnifying glass) 3) tape crystal in place, and adjust so the leads are touching the pads. 4) solder the leads to the pads*** be careful not to bridge the pads, or hold the iron on there too long. 5) once you have verified that the leads are soldered, you will have to Ground the casing, there is a small pad opposite of the leads you will want to solder the casing to the pad. after that let it cool for a moment, and double check your work. 6) Test- Use the WDT+ to dbl check that your crystal is functioning correctly IAR or CCS example code taken directly from msp430 example code //****************************************************************************** // MSP430F20xx Demo - LFXT1 Oscillator Fault Detection // // Description: System runs normally in LPM3 with WDT timer clocked by // 32kHz ACLK with a 1x4 second interrupt. P1.0 is normally pulsed every // second inside WDT interrupt. If an LFXT1 oscillator fault occurs, // NMI is requested forcing exit from LPM3. P1.0 is toggled rapidly by software // as long as LFXT1 oscillator fault is present. Assumed only LFXT1 as NMI // source - code does not check for other NMI sources. // ACLK = LFXT1 = 32768, MCLK = SMCLK = Default DCO // // //*External watch crystal on XIN XOUT is required for ACLK*// // // // MSP430F20xx // --------------- // /|\| XIN|- // | | | 32kHz // --|RST XOUT|- // | | // | P1.0|-->LED // // M. Buccini / L. Westlund // Texas Instruments Inc. // September 2005 // Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.40A //****************************************************************************** #include volatile unsigned int i; void main(void) { WDTCTL = WDT_ADLY_1000; // WDT 1s interval timer IE1 |= WDTIE; // Enable WDT interrupt P1DIR = 0xFF; // All P1.x outputs P1OUT = 0; // All P1.x reset P2DIR = 0xFF; // All P2.x outputs P2OUT = 0; // All P2.x reset // An immedate Osc Fault will occur next IE1 |= OFIE; // Enable Osc Fault while(1) { P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR _BIS_SR(LPM3_bits + GIE); // Enter LPM3 w/interrupt } } #pragma vector=WDT_VECTOR __interrupt void watchdog_timer (void) { _BIC_SR_IRQ(LPM3_bits); // Clear LPM3 bits from 0(SR) } #pragma vector=NMI_VECTOR __interrupt void nmi_ (void) { do { IFG1 &= ~OFIFG; // Clear OSCFault flag for (i = 0xFFF; i > 0; i--); // Time for flag to set P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR } while (IFG1 & OFIFG); // OSCFault flag still set? IE1 |= OFIE; // Enable Osc Fault } MSPGCC version for linux or mac users ***compiles, but is untested on MSP430***will test soon //****************************************************************************** // MSP430F20xx Demo - LFXT1 Oscillator Fault Detection // // Description: System runs normally in LPM3 with WDT timer clocked by // 32kHz ACLK with a 1x4 second interrupt. P1.0 is normally pulsed every // second inside WDT interrupt. If an LFXT1 oscillator fault occurs, // NMI is requested forcing exit from LPM3. P1.0 is toggled rapidly by software // as long as LFXT1 oscillator fault is present. Assumed only LFXT1 as NMI // source - code does not check for other NMI sources. // ACLK = LFXT1 = 32768, MCLK = SMCLK = Default DCO // // //*External watch crystal on XIN XOUT is required for ACLK*// // // // MSP430F20xx // --------------- // /|\| XIN|- // | | | 32kHz // --|RST XOUT|- // | | // | P1.0|-->LED // // M. Buccini / L. Westlund // Texas Instruments Inc. // September 2005 // Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.40A // modified by justin solarski to work with MSPGCC 4.0 //****************************************************************************** #include // IAR & CC use #include #include //for interrupt handler volatile unsigned int i; void main(void) { WDTCTL = WDT_ADLY_1000; // WDT 1s interval timer IE1 |= WDTIE; // Enable WDT interrupt P1DIR = 0xFF; // All P1.x outputs P1OUT = 0; // All P1.x reset P2DIR = 0xFF; // All P2.x outputs P2OUT = 0; // All P2.x reset // An immedate Osc Fault will occur next IE1 |= OFIE; // Enable Osc Fault _enable_interrupt(); // enable interrupts added for mspgcc while(1) { P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR _BIS_SR(LPM3_bits + GIE); // Enter LPM3 w/interrupt } } //#pragma vector=WDT_VECTOR removed for mspgcc interrupt(WDT_VECTOR) watchdog_timer (void) //__interrupt void watchdog_timer (void) removed for mspgcc { _BIC_SR_IRQ(LPM3_bits); // Clear LPM3 bits from 0(SR) } //#pragma vector=NMI_VECTOR removed for mspgcc interrupt(NMI_VECTOR) nmi_ (void) //__interrupt void nmi_ (void) removed for mspgcc { do { IFG1 &= ~OFIFG; // Clear OSCFault flag for (i = 0xFFF; i > 0; i--); // Time for flag to set P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR } while (IFG1 & OFIFG); // OSCFault flag still set? IE1 |= OFIE; // Enable Osc Fault } For MSPGCC you need to add #include to use the interrupt handlers (EG Interrupt(vector) Handler(void) { } bluehash 1 Quote Link to post Share on other sites
mavis311 0 Posted August 26, 2010 Share Posted August 26, 2010 Thanks for this! I think I read somewhere what the difference on the launchpad was with/without the crystal. Of course, now I can't find it. Anyone? Quote Link to post Share on other sites
bluehash 1,581 Posted August 26, 2010 Share Posted August 26, 2010 Its probably accuracy related. You get more accuracy with the external crystal. Quote Link to post Share on other sites
jsolarski 94 Posted August 26, 2010 Author Share Posted August 26, 2010 it also divides better (/64,/ 512, /8192, /32768) then the 1MHz internal oscilator. Quote Link to post Share on other sites
jsolarski 94 Posted September 2, 2010 Author Share Posted September 2, 2010 Updated Code forgot to add the header for interrupts on MSPGCC you must Add #include Quote Link to post Share on other sites
bluehash 1,581 Posted September 3, 2010 Share Posted September 3, 2010 How could you! ..Just kidding. Thanks for updating. Quote Link to post Share on other sites
paradug 4 Posted November 7, 2010 Share Posted November 7, 2010 You might find this instructable step informative with regards to the 32k crystal. http://www.instructables.com/id/MSP430-Based-Chronulator-using-Launchpad-chip/step11/Determining-the-32768-kHz-Crystals-load-Capacita/ It explains why the crystal's load capacitance needs to be right. It also gives a way that you can check if you have a freq. meter. jsolarski and bluehash 2 Quote Link to post Share on other sites
jsolarski 94 Posted November 8, 2010 Author Share Posted November 8, 2010 that has some great info on calibrating it for time I will definitely link to it on my blog for people that may need that for time calibration Quote Link to post Share on other sites
sirri 28 Posted November 25, 2012 Share Posted November 25, 2012 good post. but what happens if i don't use this external crystal? can it have any downside if i solder it ? i really can't understand why ti didn't pre installed it? : / Quote Link to post Share on other sites
abecedarian 330 Posted November 25, 2012 Share Posted November 25, 2012 good post. but what happens if i don't use this external crystal? can it have any downside if i solder it ? i really can't understand why ti didn't pre installed it? : / I never thought about this. It is a good question. What are the consequences of installing the crystal? What is limited by doing so? Quote Link to post Share on other sites
SugarAddict 227 Posted November 25, 2012 Share Posted November 25, 2012 You lose the GPIO of those two pins on that launchpad. But for the price of a launchpad... you can get 2, one with and one without... So... who cares? :-P Quote Link to post Share on other sites
abecedarian 330 Posted November 25, 2012 Share Posted November 25, 2012 You lose the GPIO of those two pins on that launchpad. But for the price of a launchpad... you can get 2, one with and one without... So... who cares? :-P Which may explain why I purchased 2 from the 43oh store? Quote Link to post Share on other sites
sirri 28 Posted November 26, 2012 Share Posted November 26, 2012 i just have 14 pins already : / not 20. if i solder i will have 12 pins. if i connect an lcd; i will have 12-6=6 pins left. and if i add a sensor and two buttons and a potentiometer, i guess i will be out of pins ((( but if i solder the crystal, you say it works more stable right? faster?? Quote Link to post Share on other sites
jsolarski 94 Posted November 26, 2012 Author Share Posted November 26, 2012 Not necessarily more more stable or faster, It just has different advantages for using it. 1) more accurate time and less drift 2) low power (it is all low power lol) you have to make the call on if you need that accurate time or not. Personally I have not used a project that needed a crystal for the final design. sirri 1 Quote Link to post Share on other sites
GeekDoc 226 Posted November 26, 2012 Share Posted November 26, 2012 i just have 14 pins already : / not 20. if i solder i will have 12 pins. if i connect an lcd; i will have 12-6=6 pins left. and if i add a sensor and two buttons and a potentiometer, i guess i will be out of pins :-(((( but if i solder the crystal, you say it works more stable right? faster?? As jsolarski said, you have to make the call. Until now (VFD clock), I've not needed the accuracy of the crystal in any project. However, there are a bunch of ways to use less pins; it just requires creative coding, or additional hardware. You can use a serial LCD, or add a shift register to cut your 6 pins in half or less. Inputs (buttons, pot, sensor) usually only require 1 data pin. I've used the 14-pin chips in several projects. jsolarski and sirri 2 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.