cancel
Showing results for 
Search instead for 
Did you mean: 

TIMER accuracy

welsonTW
Associate

Hello,

I’m currently working on a project to synchronize two ICG and ECG devices. Although they require different oscillator frequencies—and therefore use different timers—both timers are driven by the same APB1 clock.

  1. Phase offset
  2. Since they share the APB1 clock, does this mean that, despite generating different output frequencies, only a fixed phase offset will exist between the two timers?
  3. Divider accuracy
  4. When a timer applies division via the prescaler (PSC) and auto-reload register (ARR), is the output accuracy the same as the original clock’s accuracy? For example, if the source clock has a 1% frequency error, will that same 1% error persist after prescaling/division?

I have searched the reference manuals but could not find any information on error introduced by the divider itself. Any documentation or insight on timer-divider accuracy would be greatly appreciated.

Thank you!

2 REPLIES 2
Danish1
Lead III

Phase offset is difficult to define when you have two different frequencies. So let’s imagine you have two timers clocked off APB1 but set the division ratios equal. Can they be different phases? Most definitely YES. It very much depends how many ticks elapsed between setting one timer going and setting the other going.

But if that’s a problem for you, then you can generally arrange for the two timers to start counting from a common trigger so they will be exactly in phase.

And ghe case where they are different frequencies? If there’s a simple ratio between them e.g. 2:1 then phase is meaningful.

 

As to clock accuracy, the division ratios equal is exactly what you program, so the frequency stability will be as good as the APB1 clock, which is as good as whatever crystal or internal oscillator is used to generate it. And accuracy also as good - providing that the division ratio works out exactly; otherwise you’ll have an error

Bob S
Super User

> Phase offset

It depends.  If one frequency is a multiple of the other (say, 100 Hz and 200 Hz), then, yes, they will maintain a fixed phase relationship.  Otherwise, no.  Picture a 100 Hz signal and a 110 Hz signal, for example.

 

> Divider Accuracy

Yes - timer's output freq should have the same accuracy as the timer's clock source.