Hi.
I'm working with the PIC32MZ2048EFM100 and XC32.
I'm using some outputs as PWM signal generators.
There are frequencies for which the pwm works fine, but not for others.
For example to get 24.4 kHz, I make the following configurations:
PR2 = 255 (I use timer 2)
TCKPS<2:0> = 011 = 1:8 prescale value
TPB = 1/50 MHz
Duty Cycle = OC1RS = 0x05.
If the period is given by PR2 plus 1, which would be 256, the duty cycle is very small, but when analyzing this signal with an oscilloscope, the duty cycle is very long, greater than 50% of the signal period.
Any suggestion of what's up?
I attach an image of the signal displayed on the oscilloscope and a capture of the registers T2CON, OC1RS and PR2.