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.

msp430f5308: clock jitter



We have some trouble with the stability of UCS in our MSP

We use the compare-function in a timer to generate a soundwave on a PWM

 

PWM-utgången har en del jitter, se bifogad bild (DISMOD_0). En halvperiod jittrar med 35 ns, på en halvperiod av 2.5 us.

The Pwm output has some jitter, in half period of 35ns of jitter in a 2.5 us halfperiod.

We tried to shut of the modulation by setting DISMOD to 1 but the jitter got worse, 220 ns.

 

- Is it correct that DISMOD 1 means that the modulation is turned off? With DISMOD = 1 the MOD bits in UCSCTL0 is still changing automatically.

- Is there any other way to turn the modulation off?

- Vi mätte på ACLK, P1.0-pinnen. Även den jittrar lite trots att vi har säkertställt att vi går på kristall. - We measured on the ACLK, P1.0-pin. Also this one jitters a bit despite the fact that we are running on cristal, can this be a load problem?

 

:

- SMCLK is drivin the PWM timern.

- We use timer B with latchad CCR values for duty-cycle.

 

Init sequence to UCS:

    volatile uint16_t i;
 
    // Stop the watchdog.
    WDTCTL = WDTPW + WDTHOLD;
 
    // Select clock function for the XIN and XOUT pins.
    XTAL_PORT_SEL |= (XIN_PIN | XOUT_PIN);
 
    // Start the XT1 oscillator.
    UCSCTL6 &= ~(XT1OFF);
    UCSCTL6 |= XCAP_3;
 
    // Wait for the crystal to stabilize.
 
    do {
        // Clear all oscillator faults.
        UCSCTL7 = 0;
 
        // Clear oscillator fault flag.
        SFRIFG1 &= ~OFIFG;
 
        for (i = 0x4800; i > 0; i--) asm("NOP");
    } while (SFRIFG1 & OFIFG);
 
    UCSCTL0 = 0;        // Content updated automatically in HW.
    UCSCTL1 = DCORSEL_4 // DCORSEL = 4 -> 3.2 to 12.3 MHz.
        | DISMOD;       // DISMOD = 1 -> Modulation disabled.
    UCSCTL2 = FLLD_1    // FLLD = 1 -> f_DCOCLK / 2,
        + 121;          // FLLN = 121.
    UCSCTL3 = SELREF__XT1CLK// XT1CLK as source.
        | FLLREFDIV_0;      // No FLL reference divider.
    UCSCTL4 = SELA__XT1CLK  // XT1CLK as ACLK source.
        | SELS__DCOCLK      // DCOCLK as SMCLK source.
        | SELM__DCOCLK;     // DCOCLK as MCLK source.
    UCSCTL5 = 0;            // 0: no clock divider.
    UCSCTL6 = XT1DRIVE_0    // The clock has started, the drive can be reduced.
        | XT2OFF            // No XT2 input.
        | XCAP_3;           // 12 pF capacitors.
 
    // Wait for DCO to synchronize with ACLK (at least 28*32 ACLK cycles)
    for (i = 0x1C00; i > 0; i--) asm("NOP");
 
    // Erase possible faults.
    UCSCTL7 = 0;
    // Clear the oscillator fault flag.
    SFRIFG1 &= ~OFIFG;
  • Fredrik Johansson said:
    Is it correct that DISMOD 1 means that the modulation is turned off

    Yes. If it is set, teh DCO won't switch between the configured tap and the next higher tap based on the 32 bit modulation pattern.

    Since the FLL, which is still active, cannot adjust the DCO anymore by fine-tuning the modulation, it only can directly change the DCO setting. This of course results in a much larger jitter (or rather, the clock constantly changes between two frequencies at the DCOREF frequency - 32768Hz per default). So the clock runs on one frequency for some time (up to 1/32768s) and then with another frequency for some time (the rest of 1/32768s), so superimposed with your PWM clock generation, this gives a realyl large jitter on the PWM signal.

    Fredrik Johansson said:
    We measured on the ACLK, P1.0-pin. Also this one jitters a bit despite the fact that we are running on cristal,

    If you're indeed reading ACLK, this is more than strange. There shouldn't be a jitter on ACLK is ACLK is driven from LFXT1. Even if teh crystal wouldn't work, ACLK shoudl fall back to REFO, which does not jitter too, only drifts.

    Fredrik Johansson said:
    can this be a load problem?

    Unlikely. A load problem would detune the crystal, and maybe change the duty cycle of the generated clock signal, but not cause a jitter. Every oscillation should be identical to the previous one. Except if your crystal is subject to EMI.

     

  • One way to eliminate jitter is to turn off both the DCO clock modulation and the FLL.

    As you said, DISMOD turns off DCO clock modulation.

    Setting SR bit SCG0 turns off the FLL.

    Be careful when exiting ISRs that you don't clear SCG0 on exit.  (Entering the ISR won't automatically start up the FLL, so you really can keep the FLL completely off.)

    Realize of course that with the FLL off, the clock can drift with supply voltage and/or temperature changes.

    Jeff

**Attention** This is a public forum