2018-07-16 04:30 AM
2018-07-16 05:33 AM
This is probably not going to work the way you want
TimHandle.Init.Period = 100*PERIOD_VALUE;
The values are N-1, so to scale properly
TimHandle.Init.Period = N-1;
TimHandle.Init.Period = (10*N)-1; // 10 longer
TimHandle.Init.Period = (100*N)-1; // 100x longer
To divide by 1000
TimHandle.Init.Period = 999;
To divide by 10000
TimHandle.Init.Period = 9999; // not 9900
2018-07-16 05:49 AM
Dear Clive,
thank you for your feedback. The period is correct. The problem is only in the first pulse after the PWM start.
It is using the old pulse value with the new period. Only from the second pulse the pwm is working as expected.
I try to give you a numerical example:
Is that more clear.
The easy way is to copy paste my main code in the pwm example and connect an oscilloscope to PA5. Putting a break point on the PWM_Start lines you will see the wrong generation of the first pulse.
2018-07-16 09:28 AM
You have preload enabled for the CCRx register. Don't enable it.
I don't Cube so you have to figure it yoursef how to prevent enbling the preload.
JW