Hi,
I have to say when you call the follwoing code
CTIMER_GetPwmPeriodValue(20000, 20, timerClock);
CTIMER_SetupPwmPeriod(CTIMER, CTIMER_MAT_OUT, g_pwmPeriod, g_pulsePeriod, false);
//Can not use kCTIMER_Match_3, which is used to control PWM period
CTIMER_GetPwmPeriodValue(20000, 40, timerClock);
CTIMER_SetupPwmPeriod(CTIMER, kCTIMER_Match_0, g_pwmPeriod, g_pulsePeriod, false);
when you configure multiple PWM channel and use the status_t CTIMER_GetPwmPeriodValue(uint32_t pwmFreqHz, uint8_t dutyCyclePercent, uint32_t timerClock_Hz) to compute the variables g_pwmPeriod/g_pulsePeriod, the first parameter pwmFreqHz must be the same for multiple calling CTIMER_GetPwmPeriodValue(), only the duty cycle can be different. Otherwise, there is error.
Hope it can help you
BR
XiangJun Rong
Hi,
How about using the code
CTIMER_GetDefaultConfig(ctimer_config_t *config)
config->prescale=100;
BTW, can you tell us the value of the two variables if you set up 1HZ PWM
volatile uint32_t g_pwmPeriod = 0U;
volatile uint32_t g_pulsePeriod = 0U;
Hope it can help you
BR
XiangJun Rong