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.

TM4C123BE6PZ PWM channels, PWMPulseWidthSet changes two outputs

Hi,

I am trying to use each PWM output individually, but when I set the PWM to one output, two outputs gets the same value.

when I use PWMPulseWidthSet(PWM0_BASE, PWM_OUT_1, 2500)...PWM_OUT_2 gets the same value.

int main(void) {

	SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_25MHZ);;
	ui32SysClkFreq = SysCtlClockGet();




	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
	PWMClockSet(PWM0_BASE,PWM_SYSCLK_DIV_8);

	//M0PWM2
	GPIOPinConfigure(GPIO_PH2_M0PWM2);
	GPIOPinTypePWM(GPIO_PORTH_BASE, GPIO_PIN_2);
	PWMGenConfigure(PWM0_BASE, PWM_GEN_1, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC);
	PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, 10000);
	PWMPulseWidthSet(PWM0_BASE, PWM_OUT_2, 1);
	PWMGenEnable(PWM0_BASE, PWM_GEN_1);
	PWMOutputState(PWM0_BASE, PWM_OUT_2_BIT, true);



	//M0PWM1
	GPIOPinConfigure(GPIO_PH1_M0PWM1);
	GPIOPinTypePWM(GPIO_PORTH_BASE, GPIO_PIN_1);//pf1
	PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC);
	PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, 10000);
	PWMPulseWidthSet(PWM0_BASE, PWM_OUT_1, 1);
	PWMGenEnable(PWM0_BASE, PWM_GEN_0);
	PWMOutputState(PWM0_BASE, PWM_OUT_1_BIT, true);





	//set pwm
	PWMPulseWidthSet(PWM0_BASE, PWM_OUT_1, 2500);


	while(1);


	return 0;
}