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.

Re: PWM generation

Other Parts Discussed in Thread: MSP430G2553, MSP430F5438A, MSP430F5132

Hi All,

My requirement is to generate a PWM signal of 10MHZ to 20MHZ. I want to know wheather this can be achived using valueline msp430 without any external pwm circuit.

What is the maximum PWM frequency can be generated from msp430 valueline series.

 

Earliest reply will help me a lot.

 

Thanks in Advance.

Mithun

FAE

  • Hi! I´m using the MSP430G2553 and i easily reached 4 MHZ PWM. I don´t know if that suits your needs, but i´m not sure if this is the fastest frequency you can get with that family because there are some other proccessors of the same familiy, like the MSP430F5438A that can use 32Mhz clocks while MSPG2553 can use a maximum of 16Mhz.

  • Hi,

    the system clock of MSP430 controllers (value line) is up to 16MHz. I guess you will have some troubles to generate a PWM with a PWM frequency around this frequency with the standard PWM timers (Timer_A or Timer_B).

    I think the Timer_D module that is for example available in MSP430F5132 may help you.

    Regards, V.

  • PWM stands for Pulse Width Modulation. If you are only interested in the highest frequency of the pulses, you can generate up to 21 MHz with the G2xx chips. But at this frequency, you cannot modulate the pulse width at all; the pulse width is always 50% of each period. Up to 7 MHz, you can have a choice of 33% or 66%. Up to 5 MHz, you can have 25%, 50%, or 75%.

  • mithun sappannavar said:
    What is the maximum PWM frequency can be generated from msp430 valueline series.

    The highest PWM frequency is 1/2 of the maximum timer clock frequency (see datasheet). However, the duty cycle resolution requires a larger number of timer ticks for finer granulatrity.

    So the larger the factor between timer frequency and PWM frequency, the fine the granularity of the duty cycle: on max/2 it is just 0,50,100%. On max/3 it is 0,33,66,100%, on max/4 there are 0, 25, 50, 75, 100% possible etc.

  • talking about the maximum PWm frequency...i´ve been trying to reach that 1/2 of the meximum timer clock frequency but with bad results as i only got 4 Mhz with a frequency of 16 MHZ with the DCO clock. I used first the timer_A and the two CCR registers ( CCRO and CCR1) to generate the PWM signal and i only reached those 4MHZs. Then i just tried to turn on and then turn off a pin writing directly in the port register( P1OUT). With this method i obtained even less frequency. 

    Can someone please give me a clue?

     

    Thanks!!!

  • Here is an example of generating frequencies of max, max / 3, and max / 24.

    /*** Warning *** Warning *** Warning *** Warning *** Warning ***

     This program uses P1.1, P1.2, & P1.4 as output pins
     for the LaunchPad board, you must remove the TXD and RXD jumpers
     to avoid contention with the “EMULATION” part of that board

    **** Warning *** Warning *** Warning *** Warning ***Warning ***/

    #include <msp430.h>
    #define PERIOD 3
    #define WIDTH 1

    void main(void)
    {
      WDTCTL = WDTPW + WDTHOLD;
      BCSCTL2 = DIVM_1;        // MCLK = DCOCLK/2, SMCLK = DCOCLK
      DCOCTL = DCO2 + DCO1 + DCO0;
      BCSCTL1 = XT2OFF + 15;   // DCOCLK = max rate

      TACCR0 = PERIOD - 1;
      TACCR1 = WIDTH;
      TACCTL1 = OUTMOD_7;
      TACTL = TASSEL_2 + MC_1; // generate pulses at CC1
     
      P1DIR = BIT4 + BIT2 + BIT1;
      P1SEL = BIT4 + BIT2;     // show SMCLK, CC1, & P1.1
     
      while (1) P1OUT ^= BIT1;
    }

  • Thank you very much! I tried that code and it works perfectly! ;)

**Attention** This is a public forum