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.

CCS/TM4C1294NCPDT: Timer PWM Mode doesn´t load and start

Part Number: TM4C1294NCPDT

Tool/software: Code Composer Studio

Hello

The first Problem is that TimerLoadSet() function is not loading any value into the timer. It´s always the default value of 65535. 

The second Problem is that the timer is not starting. The TnEN Bit of the GPTMCTL Register is set when enabling the timer but it´s not starting. 

Do you have any ideas how to fix that? Thank you! :)

	uint32_t Period, dutyCycle;
	uint32_t Prescale;
	uint32_t TimerVal;


	Prescale = 0;
	Period = 60000 ;
	dutyCycle = Period/2;

	SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
	while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOM))
		{

		}
	GPIOPinConfigure(GPIO_PM7_T5CCP1);
	GPIOPinTypeTimer(GPIO_PORTM_BASE, GPIO_PIN_7);
	GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_7, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER5);
	while(!SysCtlPeripheralReady(SYSCTL_PERIPH_TIMER5))
	{

	}

	TimerDisable(TIMER5_BASE, TIMER_A);
	TimerConfigure(TIMER5_BASE,TIMER_CFG_B_PWM);				
	TimerUpdateMode(TIMER5_BASE,TIMER_B,TIMER_UP_LOAD_IMMEDIATE | TIMER_UP_MATCH_IMMEDIATE);


	//TimerVal = TimerValueGet(TIMER5_BASE,TIMER_B);

	TimerLoadSet(TIMER5_BASE,TIMER_B,Period-1);
	//TimerVal = TimerValueGet(TIMER5_BASE,TIMER_B);

	TimerMatchSet(TIMER5_BASE,TIMER_B,dutyCycle);
	//TimerVal = TimerValueGet(TIMER5_BASE,TIMER_B);

        TimerPrescaleSet(TIMER5_BASE, TIMER_B, 0);
        //TimerVal = TimerValueGet(TIMER5_BASE,TIMER_B);
        
        TimerEnable(TIMER5_BASE, TIMER_B);