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.

MSPM0G3507: How to change the PWM period and duty cycle after time init?

Part Number: MSPM0G3507

Tool/software:

Hi All,

   i need output differnet period and duty cycle waves.

i just found the setting for them from the time init code.

static const DL_TimerA_PWMConfig gPWM_2Config = {
    .pwmMode = DL_TIMER_PWM_MODE_EDGE_ALIGN,
    .period = 16000,
    .isTimerWithFourCC = false,
    .startTimer = DL_TIMER_STOP,
};

SYSCONFIG_WEAK void SYSCFG_DL_PWM_2_init(void) {

    //some init code removed
    DL_TimerA_initPWMMode(
        PWM_2_INST, (DL_TimerA_PWMConfig *) &gPWM_2Config);
    DL_TimerA_setCaptureCompareValue(PWM_2_INST, 8000, DL_TIMER_CC_0_INDEX);
   
}

i want to modify PWM period and duty cycle in the main() code.

Do i need use same API as init code, or there are other APIs in drivelib could use?

many thanks.

BR

Kelly