2014-06-08 10:21 AM
Hello everyone, i'm using the CCP module in ''PWM input mode''. My goal is to measure the frequency, the period and the duty cycle but the measure isn't precise, it continually changes near the true value. This happens only with frequencies higher than kilohertz. I'm using the ''Peripheral_Examples'' code: TIM_PWM_Input that ST has released in ''STM32F4-Discovery_FW_V1.1.0'' file. Can someone help me? thanks and sorry for my bad english
#pwm #input #discovery #stm32f42014-06-08 11:34 AM
With higher frequencies the granularity of the timer, and the ability to saturate the processor become bigger issues. The granularity will be worsened by having a prescaler other than zero (DIV1). Ideally you should use a timer on APB2 clocking at 168 MHz, these will all be 16-bit timers.
One might address this a couple of ways a) use DMA to capture a list of time stamps in Input Capture mode (not PWM Input). One or Both Edges. b) use IC Prescalers (DIV8), not to be confused with the TIMEBASE Prescaler c) counting external pulses, integrating over time, ie ticks per millisecond. Gating the timer, or snap shot with DMA2014-06-09 03:49 AM
Thanks, now I will try