STM32G474RE - Wrong Frequency Displayed when Input signal Function Generator gets disconnected
Hello Everyone,
I'm using a Nucleo-G474RE board with TIM20 configured in input capture mode on channels 1–3 to measure PWM frequency from a function generator. Everything works fine when the signal is active, but when I turn off or disconnect the input, the code starts reporting a consistent 50 Hz frequency on the channel that gets disconnected—even though there is no signal. I'm using HAL, and the input pins (PB2, PC2, PC8) are configured without any pull-up/down resistors. I suspect it's retaining old capture values because when I was developing the code I was testing one timer channel with constant 50hz signal. Or Maybe it is caused by some electronic noise . How can I make sure the timer detects that the signal is lost and reports 0 Hz instead of a false frequency?
