2009-10-19 01:55 PM
Slow timer with pulse
2011-05-17 04:26 AM
I need to use a timer on the STM3210E-EVAL card to produce a signal with a 480 Hz repetition rate. I need the signal to be normally high and go low for a period (anything between 1 microsecond and 1/480 Hz is OK) every 480Hz.
I would prefer to use Timer2 CH2 on PA1. Can anyone give me some guidance? Thanks2011-05-17 04:26 AM
Hi, look at library examples about the timers, this is clearly the PWM mode. Please check the Reference Manual, too, for the timer description.
In general, you have to know your TIM_CK freq. (72 MHz?), the period (=2.08333 ms) and resolution 1 us?) You can see that in one period you have 150 000 ticks of timer. While timer has 16 bits only, I recommend to apply divider 3 (you get 50 000 ticks per period) and the PWM resolution will be in multiple tens of nanoseconds. To port the code from TIM1 to TIM2, you need to modify the GPIO pins used in the examples.