Skip to main content
VLe R.1
Associate II
August 30, 2020
Solved

CubeMX Generating wrong GPIO configuration code for Input Capture

  • August 30, 2020
  • 2 replies
  • 2188 views

Hi,

Beforehand, let me tell you my setup:

Board selected on CubeMX: STM32L100C-DISCO.

Input Capture with TIM2, Channel 2, Pin A1.

I've been working on a project where I have to measure frequency, so I setted up the Input Capture on Timer 2 as in the Picture:

0693W000002liQjQAI.png

After exporting the code, and implementing the functions as needed based on a tutorial I watched I didn't get any result out, nor any execution of the interrupt that should start at the capture event, what I noticed is that the GPIO pin is being declared as a alternate function push pull output instead of an input... is that ok?, you can watch that in this picture:

0693W000002liQtQAI.png

In case anyone is interested, this is the tutorial I followed: https://www.youtube.com/watch?v=de4tfSzXrGM&t=693s

Thanks in advance for your comments, I am not posting the code as I first would like to check that the way cube mx is showing the info as in the pictures is correct...

Víctor.

This topic has been closed for replies.
Best answer by waclawek.jan

>GPIO pin is being declared as a alternate function push pull output

>instead of an input... is that ok?, 

Yes.

When set as AF, the connected peripheral controls the actual direction of the pin, i.e. whether it's input or output.

JW

2 replies

waclawek.jan
waclawek.janBest answer
Super User
August 30, 2020

>GPIO pin is being declared as a alternate function push pull output

>instead of an input... is that ok?, 

Yes.

When set as AF, the connected peripheral controls the actual direction of the pin, i.e. whether it's input or output.

JW

VLe R.1
VLe R.1Author
Associate II
August 30, 2020

Thank you very much for your answer, now I know the problem must reside somewhere else, I will post again in case I can't solve it by myself.

Víctor.