Hello Daniel,
Thank you for the response. Sorry for the confusion. Let me clarify it.
What I want to achieve is when the duty cycle is 0, the PWM output should be at voltage level low always.
My PWM is using FLEXIO which fed by SIRCDIV2_CLK (4MHz), the frequency is 20kHz.
My first approach is as what you said, set FLEXIO->TIMCMP[0] = 0x0000 to configure the comparison counter to be 0.
So I set the duty cycle of the PWM to be 50% first to get a 20kHz, 50% duty cycle PWM. Then I set the duty cycle to be 0 by setting FLEXIO->TIMCMP[0] = 0x0000
However, when the TIMCMP[0] = 0, I measured a PWM with 2MHz and 50% duty cycle on my oscilloscope instead of a straight line at 0v.
Then my second approach is to disable the timer0 by setting TIMOD to 0.
So I repeat the sample step as above, after I set the duty cycle to 50%, I can see the TIMOD bit of TIMCTL0 set to be 2, and PWM generated correctly.
Then I tried set duty cycle to 0 by set TIMOD bit of TIMCTL0 to be 0 to stop the PWM.
However, it doesn't all me to configure the TIMOD again. It stays at 2.
And the PWM is still at 50% duty cycle instead of getting off.
Could you please let me know if I did something wrong?
Thank you,
Junxi