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.

MSP430G2230: how to generate high speed PWM and change phase on the fly

Part Number: MSP430G2230

Hi everybody , 

please  I need to generate  a square wave    from 500KHz  up to 1.5 MHz ( even higher if possible ) , and I need to change phase 180 degrees on the fly , up to 20KHz modulation .

can I make it on this  device ideally without external clock ?    

I selecting this since maybe 105 or 125 degrees are needed  ( so I can use EP version in case ) .  

thank you 

regards

Carlo

  • The timer can generate PWM signals of up to 8 MHz (by dividing down the DCO clock). The calibrated DCO frequencies might have tolerances of several percents.

    Changing the phase by 180° can be done by switching between Set/Reset and Reset/Set output modes (see figure 12-12 of the User's Guide). However, other phases are possible only by delaying EQU0 approriately, which is not possible to do exactly.

  • Hello Carlo,

    While changing the phase between the two PWM signals is definitely possible, changing the phase on the fly may not be entirely possible. According to Section 12.2.1 16-Bit Timer Counter in the MSP430x2xx User's Guide, "it is recommended to stop the timer before modifying its operation (with exception of the interrupt enable, and interrupt flag) to avoid errant operating conditions".

    However, Section 5.4 Generating Variable Out-of-Phase PWM Signals in the Using the MSP430 Timer_D Module in Hi-Resolution Mode app note mentions "variable-phase-shift PWM pair generation is also achievable with Timer_A and Timer_B; however, the phase shift resolution of Timer_D is much higher. For Timer_D, the generation of two 50%-duty cycle PWM signals with a relative phase shift from 0° to 180° is possible with a maximum resolution of 4ns". Please read through this section and the other sections of the app note carefully.

    For a fixed phase of 180 degrees between two PWMs, you can follow Clemens' helpful advice above and in the thread below.

    Two pwm signal with 180 degree phase shift USING msp430g2553

    Regards,

    James

  • Hi James ,
    OK thank you very much
    let me check with customer
    best regards
    Carlo