2011-03-01 07:49 PM
PWM generation
2011-05-17 05:26 AM
Please help why this is happening?
Perhaps your PCLK isn't what you think it is? If you want people to analyze your code you need to post/attach complete working examples, especially when it has system level dependencies.2011-05-17 05:26 AM
The thing is my project contain lots of other stuff that nothing do with PWM thats why i could not upload but copied the function that generate the PWM but i think code is working fine as i am getting output. I am feeling there is problem in ARR calculation or TIM3 clock that i consider but I am not sure. I have done like this
Prescaler = TIM3 clock/TIM3 counter clock - 1 // I have taken TIM3 clock = 36 Mhz is it true?
= 36 MHz/36 MHz - 1 // as i want TIM3 counter clock = 36 Mhz
= 0
TIM3 Frequency = TIM3 counter clock/(ARR + 1)
36 KHz = 36 MHz/(ARR+1)
ARR = 999
so for 50% duty cycle CCR1 = 999 * 0.5 = 500
Is that calculation right for 36 KHz?
Thanks for your time...
2011-05-17 05:26 AM
For a TIM3CLK of 36 MHz, output 36 KHz, 50/50 duty
Prescaler = 0; // x1 Period = 999; // 1000-1 Width = 500; // (Period + 1) / 2 = 50% It is possible to make a stand-alone example that runs a few hundred lines, that just sets up TIM32011-05-17 05:26 AM
hello
did you started HSE at 72 MHz ? maybe you still running at 8 MHz HSI