cancel
Showing results for 
Search instead for 
Did you mean: 

input configured pin to detect frequency.

KGaik.1
Associate II

I am using STM32F103C8, in which I want to use pins which are configured as digital input to detect the square wave frequency or the frequency at which the pin is reading high and low.

Is it possible without Input capture direct mode?

2 REPLIES 2

Poss​ible? yes - for example using EXTI interrupt and free-running timer - but the potential for error is higher and you need to set this interrupt to be of the highest priority among all other interrupts you are using.

JW​

Javier1
Principal
  • I use a similar funcionality in one of my products, Input Capture & DMA.

 to measure precise freq and duty cicle of PWMs without bottering too much my processor

This guy explains it better

https://www.youtube.com/watch?v=qqzZ9C0umQ4

  • As @Community member​ said​ EXTINT is also an option with high priority interruptions

  • Last idea (the ugliest one) if your pwm is slow enough you could use ADC&DMA oversampling the PWM signal, then using the ADC readings buffer to approximate the PWM freq
we dont need to firmware by ourselves, lets talk