cancel
Showing results for 
Search instead for 
Did you mean: 

TIM4- OC Toggling frequency is inaccurate...

saimaddy123
Associate II
Posted on April 13, 2011 at 09:04

TIM4- OC Toggling frequency is inaccurate...

6 REPLIES 6
saimaddy123
Associate II
Posted on May 17, 2011 at 14:31

Stupid me... The ISR was a copy+paste and the TIM3 is not changed to TIM4. I will change it and see what happens..

saimaddy123
Associate II
Posted on May 17, 2011 at 14:31

I could generate clocks close to what I intended with this code after the typo correction in ISR. But, Interrupts are poring like hell... Is there any other way I can do this without using this Toggle method...Especially, without having to update rate at each ISR call....

Thanks,

Sai

saimaddy123
Associate II
Posted on May 17, 2011 at 14:31

Well... I looked at examples given in ST library.. I did not see any example that uses OCToggling without using interrupt.. There are examples like PWM1 which do not use interrupts...They generate the channel outputs something like 50% duty cycle, 37.5% duty cycle.. But for the requirement something like i need - toggling at a particular frequency on each channel - How can we convert this.. 

I am not getting a clue on how to map the duty cycle value on PWM1 examples to Frequency values in toggle examples in order to avoid interrupt load...

saimaddy123
Associate II
Posted on May 17, 2011 at 14:31

Does anyone has any idea on this? I do not want to use OCToggling with interrupt load. Is there any alternate way?

Regards,

Sai

Posted on May 17, 2011 at 14:31

If you want different frequencies at 50/50 you'll need to use different timers. Other free clock resources may also be viable sources.

PWM is viable only if you can achieve what you want by controlling the ON or OFF period.

You could probably do a cyclic DMA of values to GPIO ports, but the pattern length might be too long to be viable.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
saimaddy123
Associate II
Posted on May 17, 2011 at 14:31

I used different timers to solve this issue... I used PWM1 mode to achieve the frequencies I want...

Thanks Clive1 for the response...