We have noticed an issue with the threshold level not being reflected correctly for high PWM frequencies.
I think a similar issue is also seen here with low frequencies. We will check on this as well.
We do not have an update as of now for working around this issue. We will update the forums when we have this available.
Btw, you can set the initial value of your PWM signal using the outvalue parameter of the CyU3PGpioComplexConfig_t structure.
If I use period 2 and threshold 1 , then i get 32MHz and if I use period 3 and threshold 2, then I get 42MHz ! the 50% duty cycle doesnt even show up on the wave on higher frequencies. Why this wierd behaviour and is there any actual conversion available ?
The issue seems to be because of a fault in the GPIO block logic of Fx3.
We have investigated and found these results:
Clk_src = SYS_CLK = 384 MHz
Fast_clk = SYS_CLK/2
Pin_mode = PWM
Timer_mode = High_freq (fast_clk)
1. If you set PERIOD to 3 and THRESHOLD to 1, you get a PWM waveform with 50%
duty cycle; and a frequency of (SYS_CLK / (2 * 8)) (~24 MHz).
2. If you set PERIOD to 3 and THRESHOLD to 2, you get a PWM waveform with 50%
duty cycle; and a frequency of (SYS_CLK / (2 * 4)) (~48 MHz).
Setting the THRESHOLD to 1 is causing some issues for the PWM generation as a whole. However, the THRESHOLD should be set to 2 in this case to get a 50% duty cycle.
Thanks for resolving.
I seem to have the same problem and couldn't resolve. I have to adjust the PWM signal for an LED and I have the same problem as mentioned above.
Unlike the period and threshold values being used here, I am using PERIOD = 201600-1 and THRESHOLD = 50400-1 (following the examples given in the SDK). I am not sure how you calculate the PWM duty cycle and the frequency with the values as PERIOD = 3, THRESHOLD = 1,2...
It would be very helpful, If you could explain the calculations and if you have solved the issue kindly update with the same.
Thanks in advance.