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.

PWM not being generated

Other Parts Discussed in Thread: MSP430F2132, MSP430G2553

Hello all!

I have a very simple test program that the only objective is to output a PWM wave through P1.2. I have used CCS5.3 with the help of GRACE, for a msp430f2132 MCU. It generated the following code for "Timer0_A3_init.c":

(..)

    /*
     * TA0CCTL1, Capture/Compare Control Register 1
     *
     * CM_0 -- No Capture
     * CCIS_0 -- CCIxA
     * ~SCS -- Asynchronous Capture
     * ~SCCI -- Latched capture signal (read)
     * ~CAP -- Compare mode
     * OUTMOD_7 -- PWM output mode: 7 - PWM reset/set
     *
     * Note: ~<BIT> indicates that <BIT> has value zero
     */
    TA0CCTL1 = CM_0 + CCIS_0 + OUTMOD_7;

    /* TA0CCR0, Timer_A Capture/Compare Register 0 */
    TA0CCR0 = 749;

    /* TA0CCR1, Timer_A Capture/Compare Register 1 */
    TA0CCR1 = 225;

    /*
     * TA0CTL, Timer_A3 Control Register
     *
     * TASSEL_2 -- SMCLK
     * ID_0 -- Divider - /1
     * MC_1 -- Up Mode
     */
    TA0CTL = TASSEL_2 + ID_0 + MC_1;

(..)

P1.2 is properly configured as seen in the debugger and generated code, I have WDT turned off and in the main I have a infinite while of __no_operation(), after Grace_init() is called.

I have selected SMCLK clock source of 1500KHz (I have configured DCOCLK divided by 8). Wanted and 0.5ms period PWM wave, with an output duty cycle of 30%.

What in a world I'm doing wrong here??? Can anyone help?

Thanks in advance!!!

  • Jose Filipe said:
    What in a world I'm doing wrong here??? Can anyone help?

    What about configuring output pin for PWM output?

  • I think that is done correctly by Grace tool. I see GPIO init function sets P1.2 as output and P1SEL.2. Is this sufficient?

  • #include <msp430g2553.h>

    /*
     * main.c
     */
    void config (void);

    int main(void) {
    config ();
    while (1);
    }

    void config (void){
        P1SEL |= BIT6;
        P1DIR |= BIT6;
        TA0CCR0 = 12000;
        TA0CCR1 = 1200;

        TA0CCTL1 = OUTMOD_7;

        TA0CTL = TASSEL_1 + MC_1;
        
        _BIS_SR(LPM0_bits);
    }

    Bien en este proyecto yo genero un PWM por el PIN 8  del microcontrolador poniendo P1SEL|=BIT6; tienes que mirar los pines que tienen la opcion de sacar PWM que por lo general dicen TA1 si quieres prueba este codigo en tu micro seria el PIN 19 y el Pin 23 prueba este codigo y lee un poco el datasheet te aconsejo que mires el libro micocontroler basic de jhon davies para msp430

  • David Ramirez said:
    Bien en este proyecto yo genero un PWM por el PIN 8  del microcontrolador poniendo P1SEL|=BIT6; tienes que mirar los pines que tienen la opcion de sacar PWM que por lo general dicen TA1 si quieres prueba este codigo en tu micro seria el PIN 19 y el Pin 23 prueba este codigo y lee un poco el datasheet te aconsejo que mires el libro micocontroler basic de jhon davies para msp430

    讲英语,请

  • Well in this project I generated a PWM PIN 8 microcontroller putting P1SEL | = BIT6, you have to look at the pins that have the option to get PWM TA1 usually say if you want to test this code in your micro would be the PIN 19 Pin 23 and test this code and read a bit datasheet advise you book look jhon basic micocontroler davies for msp430

**Attention** This is a public forum