cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407G Disc: TIM input encoder mode

MG1
Associate II

Good afternoon community,
I am trying to implement the Input Encoder in 
STM32F407G Discovery board.
I implement all things, but I am not able to generate desired the output from the board.
I get counter/count/position value as zero.

MG1_0-1710159725167.png

 


Can you please help me to implement the Input encoder?
Here is code for your reference, if any reference code you have then please provide me.
Thank you.

4 REPLIES 4
TDK
Guru

> void hal_tim_IC_CaptureCallback(TIM_HandleTypeDef *htim)

The correct callback function is HAL_TIM_IC_CaptureCallback. Function names are case sensitive.

The "position" variable should probably be defined as volatile if it will be accessed in the main thread.

If that doesn't work, ensure the pin assignment is correct and ensure the signal is making its way to your board.

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

Thank you team,
I change all things as you say, 
But still i face issue about it.

MG1_0-1710161566700.png

I change the Phase value but still it is show same value "2". in both variable,
and position value is not updating. Can you please help out.

MG1
Associate II

Good afternoon community,
I did not get any response from your side of my above query.
I have changed all things as you said in last response.
Please taking care of it.
Thank you.

TDK
Guru

I would recheck your wiring. Use a logic analyzer to verify the signals are as you think they are. I can't do this part for you.

(Note that waiting 24 hours for a response should be acceptable on a forum that provides free assistance. Be patient and appreciative for best results, not needy.)

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