cancel
Showing results for 
Search instead for 
Did you mean: 

TIM Input Capture direct mode GPIO mode

CKugl.1
Senior II

STM32L412KBUx on NUCLEO-L412KB, STM32CubeIDE, Version: 1.8.0.

I'm trying to use TIM1 to measure frequency of an external input signal connected to PA8. I'm confused by the choices in CubeIDE. In Pinout & Configuration, TIM1, Channel 1, I selected Input Capture direct mode. Now, if I go to GPIO, PA8, my only choices for GPIO Mode are Alternate Function Push Pull, or Alternate Function Open Drain. Neither makes much sense to me for an input.

With it set to Alternate Function Push Pull, I am able to measure frequencies from my signal generator, but in the real application the line gets periodically grounded by a set of contact points, and I have found that if I ground this line it resets the board*, which seems strange for an input.

What am I misunderstanding here?

*EDIT: I might have smoked this input. I made a mistake in my wiring:

0693W00000JN1qjQAD.pngso I accidentally put 6-7.5 V at unlimited current to it. But I still don't understand the GPIO Modes.

5 REPLIES 5
TDK
Guru

Since the pin is used as an input by the peripheral, it will never be driven high or low. Thus, the two modes are equivalent in this case as the difference in OD and PP is how the pin is driven in the high state.

Your reset issue is coming from somewhere else, unless you’re driving it outside it’s limits.

If you feel a post has answered your question, please click "Accept as Solution".
CKugl.1
Senior II

OK, thanks! I won't worry about it, then.

I think I blew this input (see edit to previous post), so now it acts like a short to the 3.3v supply (and it doesn't work with the signal generator anymore). I was pretty confused for a while by the whole unfortunate sequence of events.

TDK
Guru

Yep, shorting to 6.5V is sure to blow something’s. Sounds like the upper protection diode is shorted out. I would be surprised if that’s the only issue.

If you feel a post has answered your question, please click "Accept as Solution".

> I  would be surprised if that’s the only issue.

Yeah, but I have only one spare eval. board. I'm a little wary of switching to that at this stage, in case I blow something else. So, I think I will hack around this and use another input and see if I can limp along a little further with this prototype.

It looks like I could re-purpose PA5 and switch to TIM2_CH1, which, of course, will mean some significant firmware changes. Looks like a better timer, though.

CKugl.1
Senior II

I switched to TIM2 and left PA8 disconnected. It runs, but the chip seems to be running very hot. Internal temperature 118C. I can feel it giving off heat. I went to see if I could buy a new NUCLEO-L412KB but they are gone. It seems like everything STM32 is out of stock these days.