Hi all:
I use tm4c130hpm because there is no PWM module, so I use universal timer to generate PWM. The data manual says that it can be configured as 24/48BIT PWM module.
“The GPTM supports a simple PWM generation mode. In PWM mode, the timer is configured as a 24-bit or 48-bit down-counter with a start value (and thus period) defined by the GPTMTnILR and GPTMTnPR registers.”
But the official reference code is the 16bit timer PWM. I wrote my own application code with reference to the official code, but unfortunately it was not successfully configured as 24/48bit timer PWM.
The code is as follows. Is there any way to solve this problem? Thanks very much.
uint32_t clk; ROM_GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_4); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1); ROM_GPIOPinConfigure(GPIO_PB4_T1CCP0); ROM_GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_4); TimerConfigure(TIMER1_BASE, TIMER_CFG_A_PWM); TimerLoadSet(TIMER1_BASE, TIMER_A, 16000000); clk = TimerLoadGet(TIMER1_BASE, TIMER_A); TimerMatchSet(TIMER1_BASE, TIMER_A, clk/2); TimerEnable(TIMER1_BASE, TIMER_A);