According to the parameters of this code, the PWM period should be 50KHz, no problem. The positive duty cycle of channel A should be 33.3%. There is an inverter in my circuit, and the measured waveform has a positive duty cycle of 62%. Considering the measurement error caused by waveform distortion, this waveform can be considered correct. Changing the value of CMPA will change the waveform duty cycle, and the error is basically fixed.
Let's take a look at the waveform of channel B. The positive duty cycle should be (600-500)*2/1200=16.6%, and it is 83.4% after the reverse. The actual measured duty cycle is 41%, that is, 500/1200, which means that the code is actually executed in the increasing stage, and it is a low level when it is 0-500. After matching CMB, it becomes a high level. In the decreasing stage, the match is not completed, but it can be reduced to 0 and then become low.
I can't see anything wrong with the code. And it is the official reference code. Are there any friends who have used this module who can give me some advice. Thank you