I want to set two PWM singals at a time ? But I the result is error.
My code :
SCTIMER_GetDefaultConfig(&sctimerInfo);
/* Initialize SCTimer module */
SCTIMER_Init(SCT0, &sctimerInfo);
/* Configure first PWM with frequency 24kHZ from first output */
pwmParam.output = DEMO_FIRST_SCTIMER_OUT;
pwmParam.level = kSCTIMER_HighTrue;
pwmParam.dutyCyclePercent = 90;
if (SCTIMER_SetupPwm(SCT0, &pwmParam, kSCTIMER_CenterAlignedPwm, 500U, sctimerClock, &event1) == kStatus_Fail)
{
return -1;
}
/* Configure second PWM with different duty cycle but same frequency as before */
pwmParam.output = DEMO_SECOND_SCTIMER_OUT;
pwmParam.level = kSCTIMER_HighTrue;
pwmParam.dutyCyclePercent = 90;
if (SCTIMER_SetupPwm(SCT0, &pwmParam, kSCTIMER_CenterAlignedPwm, 1000000U, sctimerClock, &event2) == kStatus_Fail)
{
return -1;
}
/* Start the timer */
SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_L);
I find that the first PWM singal can't set successful when I set second PWM singal ,but the first PWM singal can work well when I just configure it. What make that happed?
thank you!