cancel
Showing results for 
Search instead for 
Did you mean: 

how can read timer counter value in stm32f0

kalpeshpatil102
Associate III
Posted on November 07, 2016 at 02:53

hi , i want to read timer counter value . i was used __HAL_TIM_GetCounter(); function but it didn't work .

please help me .

thank you
3 REPLIES 3
Posted on November 07, 2016 at 04:04

It should basically be doing a read of TIMx->CNT, hard to see you that would cause an issue.

Unfortunately ''doesn't work'' really doesn't provide sufficient context to determine why it is not working, or how it is not working. Is there some minimal implementation you can share that demonstrates the issue?

Does it always read zero? Is the clock to the timer enabled?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
kalpeshpatil102
Associate III
Posted on November 07, 2016 at 06:06

value is 0. every time. 

Posted on November 07, 2016 at 09:27

Assume that I'm not a mind reader.

If all TIM registers read zero then make sure peripheral clock has been enabled.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..