This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5342 XT2 Oscillator

Other Parts Discussed in Thread: MSP430WARE

I am trying to get the 5342 to work at 8 MHz using XT2 on an eval board. I ahve added load capacitors as suggested and get an oscillation of about 1V at the crystal. BUT the part clocks using an internal clock (I think) that is much slower.  The code taht I have written is below. I am an analog engineer so NOT a micro expert therfore I may have done something obvious to others.

Code:

P5SEL |= 0x0C;  //  set for XT2, P5 bits 2 & 3

UCSCTL4 = SELA__XT2CLK | SELS__XT2CLK | SELM__XT2CLK;   // XT2 for all

UCSCTL5 = DIVM_0 | DIVS_0 | DIVA_0 | DIVPA_0;  // divide all by 1

UCSCTL6 &= ~XT2OFF;  // turn XT" on

UCSCTL6 |= XT2DRIVE_1;  // drive level

UCSCTL6 |= XT1OFF_L;  // turn off XT1

UCSCTL6 &= ~XT2BYPASS;  //  turn off bypass

 

  • Hi Henry,

    I think you need to turn the XT2 crystal on and let it stabilize (check for oscillator fault flag to clear) before setting all of your system clocks to be sourced from it. As it is right now, you set the system clocks to source from the XT2 before XT2 has been started - so due to the oscillator fault flag being set they'll end up falling back to their fail safe configuration of running from a different internal clock, which sounds like what you have observed.

    Might I suggest trying MSP430 DriverLib, included with MSP430Ware in CCSv5? This includes function calls that will do some of the lower register-level handling for you. First, go to Help > Check for Updates to make sure you have the most current MSP430Ware version. Then, there is an example you should see under TI Resource Explorer (View > TI Resource Explorer) at MSP430Ware > Libraries > Driverlib > MSP430F5xx_6xx > Example Projects > UCS > ucs_ex4_XTSourcesDCOInternal.c. This example shows using Driverlib to start your crystals, wait for them to stabilize, and then set them as sources for various clocks, similar to what you are trying to do.

    You can find documentation on the different Driverlib functions and their parameters at MSP430Ware > Libraries > Driverlib > MSP430F5xx_6xx > API Programmer's guide. Then you can click Files and scroll down to ucs.c to see all of the clock (UCS) module function calls and what they do.

    Another tip for using Driverlib: CCS includes Autocomplete functionality - if you have the UCS.h header file for driverlib included, then you should be able to start typing one of the function names and hit Ctrl+Spacebar to bring up a list of possible functions that you might be typing. This works for defined parameters to the functions too.

    Regards,

    Katie

**Attention** This is a public forum