JohnDough 1 Posted November 10, 2015 Share Posted November 10, 2015 Hi, I have a very simple program, which writes a message to oled, and then start "Timer A" to blink the internal led. The program looks to work fine when I execute it from CCS using "Debug". (Code Composer Studio, Version: 6.1.1.00022) But when I just connect it to USB for power, or hit the "reset" button, the program executes the code before the timer, but the timer interrupt is not working. The code for timer was taken from here (2nd example: "Using the Timer") http://www.crash-bang.com/getting-started-msp430-timers-3/ I suspect it is something with the settings of timer, not with CCS, but I dont know what can cause this problem. Thanks for any help. Quote Link to post Share on other sites
tripwire 139 Posted November 10, 2015 Share Posted November 10, 2015 Which MSP430 are you running this on, and what board/launchpad are you using? Also, what does your main() function look like? I'm particularly interested in the Basic Clock System setup code. Quote Link to post Share on other sites
JohnDough 1 Posted November 10, 2015 Author Share Posted November 10, 2015 @@tripwire I'm using MSP-EXP430G2, G2553 From main, this is the code which looks relevant to me: // init for oled WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer DCOCTL = CALDCO_16MHZ; // Set DCO for 16MHz using BCSCTL1 = CALBC1_16MHZ; // calibration registers // init for timer TACCTL0 |= CCIE; //Enable Interrupts on Timer TACCR0 = delayCycles; //Number of cycles in the timer TACTL |= TASSEL_1; //Use ACLK as source for timer TACTL |= MC_1; //Use UP mode timer // loop while (1) { _bis_SR_register(LPM3_bits + GIE); //Enter Low Power Mode 3 with interrupts } Quote Link to post Share on other sites
terjeio 134 Posted November 11, 2015 Share Posted November 11, 2015 @@JohnDough What is your ACLK source and the delayCycles value? Is the LED partly lit? tripwire 1 Quote Link to post Share on other sites
tripwire 139 Posted November 11, 2015 Share Posted November 11, 2015 @@JohnDough What is your ACLK source and the delayCycles value? Is the LED partly lit? Also, do you have the watch crystal soldered onto the launchpad or not? Quote Link to post Share on other sites
JohnDough 1 Posted November 11, 2015 Author Share Posted November 11, 2015 @@terjeio Your question "What is your ACLK source" led me to do a small research - I added this line: BCSCTL3 |= LFXT1S_2; and problem solved. Oddly, it was missing from the example I used which was specific to timers. Thanks for your help ! tripwire 1 Quote Link to post Share on other sites
JohnDough 1 Posted November 11, 2015 Author Share Posted November 11, 2015 @@tripwire Also, do you have the watch crystal soldered onto the launchpad or not? Sorry, I missed your message before. Not yet, this is my next task. Thanks for your help ! Quote Link to post Share on other sites
JohnDough 1 Posted November 11, 2015 Author Share Posted November 11, 2015 A question regarding soldering the crystal: It looks my soldering skills need to be improved... I failed to solder the crystal, and now I need to buy a new one. The crystal which came in the kit is this one: http://www.microcrystal.com/images/_PDF/2_Crystal_Metal-Package/MS3V-T1R_Pd.pdf And according to "how to solder" - "MSP 430 launchpad soldering Crystal" tutorial in YouTube There are 3 points to solder: the 2 legs and the body. My local supplies store has this one in stock: https://www.sparkfun.com/products/540 But this one seem to have only 2 legs, and the body is in "barrel" shape, which doesnt look like intended to be soldered to the board. So my question is: Can the crystal from the sparkfun website can be used instead ? Do I need to solder the "barrel"/body ? Thanks for your help. Quote Link to post Share on other sites
tripwire 139 Posted November 11, 2015 Share Posted November 11, 2015 So my question is: Can the crystal from the sparkfun website can be used instead ? Do I need to solder the "barrel"/body ? It looks like the sparkfun crystal is slightly bigger than the stock launchpad one. It's also a through-hole part rather than SMT. I think it would be possible to push the leads through the plated through-holes on either side of the pads used by the stock SMT crystal. Then you could solder the two wires from the back of the board, which might be easier than surface mounting. The body connection can probably be made with the sparkfun crystal even though it doesn't have a flat underside. Having said that, the body connection is not essential. It grounds the case, which helps to shield against any interference. It should still work just fine without it, and it's better to leave it unconnected than to overheat the crystal if you're finding it awkward to solder. KatiePier and JohnDough 2 Quote Link to post Share on other sites
JohnDough 1 Posted November 12, 2015 Author Share Posted November 12, 2015 @@tripwire Thanks a lot for your help ! 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.