Loading...
 
Skip to main content

System Workbench for STM32


measure speed motor using Timer1 on stm32f030

Hello every one.😀
I'm using stm32f030 for a cheap project. I want it to measure motor speed by means of using a Hall effect rotary encoder and a comparator. the encoder makes fully digital pulses when motor rotates.
STM32f030 doesn't have an ETR pin for external trigger and I have to use TI2FP2 pin to trigger TIMER 1.
so:
1- Should I set input trigger filter to value 0 or 15 to achieve maximum detectable frequency?
2-I should set TIM1 to input capture mode or time base mode?which HAL functions should I use to detect TIMER1 overflow?
3-what is the maximum detectable freq?
4- is this kind of frequency meter ideal for other usages like measuring LC meter?
5-what does the word "Trigger" mean in ARM timers? It is triggering timer main clock to count it up? or trigger is a clock itself?
thanks so much.

Capture compare is likley best simplest option
the max freq you can measure is close to half the timer clk feq/ prescaler but then accuray is bad.
basiclay you have to set timer clk high enought to get precsion but not to much to cope with smallest fequencies you can measure

i sugest you read http://www.st.com/content/ccc/resource/technical/document/application_note/54/0f/67/eb/47/34/45/40/DM00042534.pdf/files/DM00042534.pdf/jcr:content/translations/en.DM00042534.pdf
have a look at CubeF0 (or F4) example for code sample or just google 😉

note that the timers are not arm they are st periferals , triger most ofen refer to "enable timer counter"