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.

MSP430FR2311: TimerB PWM and comparator

Part Number: MSP430FR2311

Hi Team,

I experimented with MSP430FR2311 launch pad

when I only use either TB0 or TB1 to output PWM waveforms, it works normally as I thought

Next step, enabling eCOMP to monitor external signal, it is found that the PWM signals are affected by the eCOMP output as below shown

blue one is eCOMP out, red one is timerB PWM out

have you got the same issue?

  • Hi Ian Yeh,

    Would you please share the schematic and test code so I can reproduce your issue?

    BR,
    Ling
  • Hi Ling,

    I experimented with MSP430FR2311 launch pad
    and amend the descrption of the figure shown above: blue one is eCOMP input (C0), red one is timerB PWM out (TB1.1)
    I've checked the eCOMP output (change P2.0 to COUT), it works normally

    code is as below


    int main(void)
    {
    WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
    PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode
    // to activate previously configured port settings

    PMMCTL0_H = PMMPW_H;
    PMMCTL2 |= INTREFEN_1;
    PMMCTL0_H = 0;


    initCS(); // MCLK operates in 16MHz, SMCLK is 16MHz

    /* GPIO initialization */
    P2REN &= ~0b11; // disable P2.0, P2.1 pull
    P2DIR |= 0b11; // output direction
    P2SEL0 |= 0b11; // TB1 output
    P2SEL1 &= ~0b11;


    /* eCOMP initialization */
    P1REN &= ~0x01; // disable P1.0 pull
    P1SEL0 |= 0x01; // C0 input
    P1SEL1 |= 0x01;

    CPDACDATA = (7 << 8) | 50;
    CPDACCTL = CPDACBUFS_0 | CPDACREFS_1 | CPDACEN_1;

    CPCTL0 = CPPSEL_0 | CPNSEL_6 | CPPEN | CPNEN;
    CPCTL1 = CPINV_0 | CPIES_0 | CPFLT_1 | CPFLTDLY_3 | CPMSEL_0 | CPEN_1 | CPHSEL_3 | CPIE_0 | CPIIE_0;


    /* timer initialization */
    TB1CTL = MC_0 | TBCLR;
    TB1EX0 = 0;
    TB1CTL = TBIFG_0 | TBIE_0 | ID_0 | TBSSEL_2 | CNTL_0 | TBCLGRP_0;
    TB1CCR0 = 1999;

    TB1CCTL1 = CCIFG_0 | COV_0 | OUT_0 | CCIE_0 | OUTMOD_7 | CAP_0 | CLLD_0 | SCS_1 | CCIS_0 | CM_0;
    TB1CCTL2 = CCIFG_0 | COV_0 | OUT_0 | CCIE_0 | OUTMOD_3 | CAP_0 | CLLD_0 | SCS_1 | CCIS_0 | CM_0;

    TB1CCR1 = 0;
    TB1CCR2 = 0;

    TB1CTL |= MC_3;


    for(;;);
    }


    BR
    Ian
  • Lan,

    Check if the output is conflict?

    PWM output P2.0 P2.1

    eCOMP output P2.0


    BR,

    Ling 

  • Hi Ling,

    when I checked COUT function, I've changed P2.0 to COUT and measure TB1.2 (P2.1) PWM signal, so it has no conflict
    even if use TB0, the phenomenon also exists.


    BR
    Ianphenomenon
  • Lan,

    Try to use TB0 and see if the phenomenon still exist?

    Ling
  • Hi Ling,

    change PWM signal to P1.6, P1.7, the waveform is shown as below

    red one is PWM signal (P1.6), blue one is COUT (P2.0)

    do you observe the same unpredictable phenomenon?

    BR

    Ian

  • Hi Lan,

    Try to add
    " SYSCFG2 |= TB0TRGSEL;"
    in your source code.

    BR,
    Ling
  • OK,

    thank you!

**Attention** This is a public forum