cancel
Showing results for 
Search instead for 
Did you mean: 

Problem reading the counter/timer register TIM->CNT

flyer31
Senior
Posted on September 21, 2012 at 21:20

STM32F407: I use Timer2-5 in QEI configuration, and in my motor control loop (coming every 45usec) I need to read out the current position from TIM->CNT.

If I scan the values read out - it is strange that about every 50th read fails - some strange value will be returned (if the QEI is counting while I read out).

I assume, this might be some sort of access problem, as the timer module accesses the value of CNT, and I want to read it?

In the ref. manual I do not find any info concerning buffer / shadow register for TIM->CNT.

Is there some special trick to read this register? (e. g. should I read it only with some special command, or width?) - or do I really need to read it out several times and check for equal return values (so that I read at a time when the counter just stayed stable?)?

PS: Sorry, stupid question - I meanwhile recognized that my QEI input signal has stupid spikes - I think the processor is doing perfectly well.
0 REPLIES 0