cancel
Showing results for 
Search instead for 
Did you mean: 

using a timer to count pulses on STM32F7

spa23
Associate III
Posted on November 08, 2017 at 10:50

Hi 

I have a question about using a timer to count pulses form a encoder (only one pin) I don't care about the direction.

I'm trying to use Timer 3, but I'm not sure how to set it up in CubeMx.

0690X00000608sUQAQ.png0690X00000608sjQAA.png

I start it with: 

HAL_TIM_Base_Start( mpEncoderTim );

And read with: 

count = mpEncoderTim->Instance->CNT;

Hope anyone of you, have done this before, so you can give me a hint 

thanks in advance and best regards

panduro..

#stm32f7-timer
1 ACCEPTED SOLUTION

Accepted Solutions
spa23
Associate III
Posted on November 08, 2017 at 13:22

I think I solved the case.

Counter Period was 0 :(

View solution in original post

4 REPLIES 4
Posted on November 08, 2017 at 11:03

On TIM13 you can't - it does not have the slave mode controller needed for external counting modes.

Look into RM, search for SMCR register, look at its SMS field.

JW

spa23
Associate III
Posted on November 08, 2017 at 11:17

sorry for my mistake I meant Timer 3

Posted on November 08, 2017 at 11:40

I don't use CubeMX nor Cube.

You want to set TIMx_ARR (I guess it's what is called there 'period') to nonzero.

JW

spa23
Associate III
Posted on November 08, 2017 at 13:22

I think I solved the case.

Counter Period was 0 :(