2014-08-19 10:55 AM
Hi,
I am new with programming STM32 but I've experience with MSP430. I'm looking for information on setting timer / capture timer. TI has many user guide and complete datasheet explaining each register. I didn't find the same.My second problem is with my capture timer. I'm using the code example ''TIM_PWM_Input'' in order to measure a frequency. It is said that CCR1 is for the duty cycle and CCR2 to compute the frequency. I only need to compute the frequency but I don't find track of configuration of CCR1. Then, CCR2 always reset after each interrupt. How can I keep its value?Thank you for your help. Please show me as well where I can find a detailed documentation so that I can make my own way.2014-08-19 11:29 AM
You want to review the
http://www.st.com/web/en/resource/technical/document/reference_manual/CD00240193.pdf
for register level minutia.PWM Input uses TWO channels (1 & 2). To measure frequency use Input Capture, and do a delta ticks computation between subsequent measurements in a CCRx latch. Remember there is only ONE counting element in the timer, and four latches (which don't count)2014-08-19 11:27 PM
Hi,
Thank you. Reference Manual was indeed what I was looking for.Not sure to get your point on Input Capture. I want to use the capture mode. I get an interrupt after each rising edge on my input. I would like to save the current tick counter. I want to have 10 periods (without resetting the tick counter after each interrupt). Then subtract my first value to my last value and divide it by my 10 periods.My SW must be for LP applications. I don't see where they configure the input capture 1. I see in my interrupt routine where they store the value only. Not sure if I am clear enough.2014-08-20 06:44 AM
You don't need to get the current tick count (CNT), the tick at the edge is latched into the CCRx register, and you then get an interrupt and read the latch. This means the latency of the interrupt will not impact the measurement.
If you are not wedded to 10, the Input Capture can have a prescaler set to permit is to look for 1X, 2X, 4X or 8X edges.