Kevink 2 Posted January 14, 2016 Share Posted January 14, 2016 I'm looking for help in setting up the clocks on a msp430f149. I can find all kinds of ways online after days of googling on how to setup clocks on most of the other devices (I also have an V1.4 launchpad) but no examples on how to setup up a msp430f149 that has a crystal on XT2. (happens to be 6MHz) I've inherited this project and it is what it is. I can get the chip to do what I need it to do in most ways (set and read ports etc.) but I can not get it to use the external crystal. If someone could give me the code that does just that I will buy you a beer next time we meet. Also I believe there is a way to directly output the clock to an output pin if I could be shown that as a bonus I would very much appreciate it. My end goal is a serial port that does tx and rx. I've seen wonderful examples at http://dbindner.freeshell.org/msp430/ but I can't get any of the send and receive ones to work. I can get tx ones to work by playing with the clock settings but only using the internal RC clock. I am Using CCS and C. Thanks very much for reading this. Regards, Kevin Quote Link to post Share on other sites
Fred 453 Posted January 14, 2016 Share Posted January 14, 2016 I've not really used the F149, but MSPWare has good examples for those sort of things - at least it does for other devices. Quote Link to post Share on other sites
Kevink 2 Posted January 14, 2016 Author Share Posted January 14, 2016 Hi Fred I've spent a fair bit of time there and only find 32kHz examples but I'll look again. Thanks for the suggestion. Regards, Kevin Quote Link to post Share on other sites
Clavier 34 Posted January 14, 2016 Share Posted January 14, 2016 The file fet140_hfxt2.c in the example code package (SLAC015) shows how it's done: BCSCTL1 &= ~XT2OFF; // XT2= HF XTAL do { IFG1 &= ~OFIFG; // Clear OSCFault flag for (i = 0xFF; i > 0; i--); // Time for flag to set } while ((IFG1 & OFIFG)); // OSCFault flag still set? BCSCTL2 |= SELM_2; // MCLK= XT2 (safe) Quote Link to post Share on other sites
Kevink 2 Posted January 14, 2016 Author Share Posted January 14, 2016 Clavier! I'm located in Waterloo Ontario next time you are here you get the beer of your choice! It's working lol. Thank you so much. Do you happen to know a way to get the clock out to a pin? Bonus pizza? Regards, Kevin Quote Link to post Share on other sites
spirilis 1,265 Posted January 14, 2016 Share Posted January 14, 2016 Clavier! I'm located in Waterloo Ontario next time you are here you get the beer of your choice! It's working lol. Thank you so much. Do you happen to know a way to get the clock out to a pin? Bonus pizza? Regards, Kevin Check the datasheet and in particular port config / schematic matrix, usually there's a designated pin that can do SMCLKOUT or ACLKOUT or similar. Not sure about the older F1xx parts. Quote Link to post Share on other sites
Kevink 2 Posted January 14, 2016 Author Share Posted January 14, 2016 Thanks again Clavier for pushing me in that direction. I was able to get MCLK out using: P5DIR = BIT4;P5SEL = BIT4; A nice 6MHz. Best regards, Kevin bluehash 1 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.