Skip to main content
PRaje
Visitor II
April 5, 2022
Question

I need to measure a frequency in STM32F767VIT6 Timer1 CH1. 0 to 14khz input freq

  • April 5, 2022
  • 4 replies
  • 1215 views

Give me a suggestion, Is it possible or not.

This topic has been closed for replies.

4 replies

waclawek.jan
Super User
April 5, 2022

Read the PWM input subchapter of TIM chapter in RM. Part of the PWM input measurement is measurement of period (which is 1/frequency).

JW

Tesla DeLorean
Guru
April 5, 2022

Perhaps you, and your friend can work it out?

https://community.st.com/s/question/0D53W00001Tfs1PSAR/i-need-to-measure-an-1hz-to-14khz-frequency-in-stm32f767vit6-timer1-ch1

I'd probably have used a different TIM, to get some reasonable resolution. But conceptually you can use the TIM in PWM Input Capture, to get frequency and duty cycle quite easily.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
PR.Atom
Associate
April 6, 2022

My Hardware is finalized for TIMER 1. Could you please suggest alternative methods?

waclawek.jan
Super User
April 6, 2022

Alternative to what?

The basic idea is to use Input Capture, which give you the exact moment in time when an edge on input signal occurs. From two consecutive capture values (and input frequency of timer) calculate the period, and 1/period = frequency.

The method described as PWM Input in the RM is simpler in that with capture it simultaneously resets the timer's counter, so you don't need to subtract two consecutive capture values.

JW