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.

MSP430F6636: Couldn't able to generate PWM.

Part Number: MSP430F6636

Hello TI Team,


We are using the MSP430F6636 Controller. We are targeting to generate the PWM using Timer-TA2 -on CCR0 (PIN NUM: 47 ). But we weren't able to generate PWM for our Project.

Please verify below snippet code and let us know if we missed something .

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

GPIO_setAsPeripheralModuleFunctionOutputPin( GPIO_PORT_P3, GPIO_PIN5 );        

//Update timer parameters to start timer        

Timer_A_initUpModeParam initUpParam = {0};        

initUpParam.clockSource = TIMER_A_CLOCKSOURCE_SMCLK;        

initUpParam.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1;        

initUpParam.timerPeriod = SMCLK_ACTUAL_CLK/15000;        

initUpParam.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_DISABLE;        

initUpParam.captureCompareInterruptEnable_CCR0_CCIE =         TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE;

initUpParam.timerClear = TIMER_A_DO_CLEAR;        

initUpParam.startTimer = false;        

//Initialize compare mode to generate PWM        

Timer_A_initCompareModeParam initComp2Param = {0};        

initComp2Param.compareRegister = TIMER_A_CAPTURECOMPARE_REGISTER_0;        

initComp2Param.compareInterruptEnable = TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE;        

initComp2Param.compareOutputMode = TIMER_A_OUTPUTMODE_RESET_SET;        

initComp2Param.compareValue = RESET;//DUTY_CYCLE2;        

Timer_A_initUpMode( TIMER_A2_BASE, &initUpParam );        

Timer_A_startCounter( TIMER_A2_BASE, TIMER_A_UP_MODE );        

Timer_A_initCompareMode( TIMER_A2_BASE, &initComp2Param );        

Timer_A_setCompareValue(  TIMER_A2_BASE , TIMER_A_CAPTURECOMPARE_REGISTER_0, 50 ); 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Here we are trying to achieve 50% Duty cycle at the moment, but we are not able to achieve so... our target is to achieve 15% Duty cycle.



Kindly please help us to unblock  the problem so we can generate PWM on same pin. 

Let us know if you need any more information from us.
Regards,
Vivek
  • Generally, you can't generate "real" PWM using CCR0 (TA2.0 in this case), since in Up mode CCR0 is also the "deassert" comparator -- you're limited to 50% using Toggle mode. [Ref User Guide (SLAU208Q) Sec 17.2.5.1, second sentence.]

    Are you required to use P3.5, or can you use another pin? P3.6 (e.g.) is TA2.1, which is capable of using the PWM modes.

  • Thank you for suggestion. 
    We have shifted PIN from 47 to 49 and we able to generated expected PWM but here, we shorted the PIN 47 and 49 physically.

    From firmware  side, PIN 49 is initialized and PIN 47 is uninitialized.

    Do we have require other configuration from Firmware side.?

    As discussed we are getting expected PWM. Can we go with this solution? Is it faithful solution or it will create problem in future?

  • As I understand it, you're generating PWM on TA2.2 (P3.7) and have a patch wire (or equivalent) to the TA2.0 (P3.5) pin, which is configured as an input. This arrangement should be fine (be careful not to forget about it a year from now (:-))).

**Attention** This is a public forum