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.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
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 TIM3
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Posted on May 17, 2011 at 14:26Thanks a lot for reply Clive. Yes, you got it, i am not getting PCLK that i think.
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