Configure the timer to PWM mode with the following sequence:
- Ensure the timer is disabled (the TnEN bit is cleared) before making any changes.
- Write the GPTM Configuration (GPTMCFG) register with a value of 0x0000.0004.
- In the GPTM Timer Mode (GPTMTnMR) register, set the TnAMS bit to 0x1, the TnCMR bit to 0x0, and the TnMR field to 0x2.
- Configure the output state of the PWM signal (whether or not it is inverted) in the TnPWML field of the GPTM Control (GPTMCTL) register.
- If using a prescaler, write the prescale value to the GPTM Timer n Prescale (GPTMTnPR) register.
- If using PWM interrupts, configure the interrupt condition in the TnEVENT field in the GPTMCTL register, and enable the interrupts by setting the TnPWMIE bit in the GPTMTnMR register. Edge-detect interrupt behavior is reversed when the PWM output is inverted.
- Load the timer start value into the GPTM Timer n Interval Load (GPTMTnILR) register.
- Load the GPTM Timer n Match (GPTMTnMATCHR) register with the match value.
- Set the TnEN bit in the GPTM Control (GPTMCTL) register to enable the timer and begin generation of the output PWM signal.