Timer precision on at91rm9200

Rochat Joël jrochat at netplus.ch
Wed Oct 31 07:32:21 UTC 2007


Think you for your response !

I've took a look int clock.c and I don't understand why the function
Clock_driver_support_initialize_hardware use the SLCK_FREQ to calculate how
many tick muss be count. Why not use the MAIN_FREQ oscillator ?

For exemple

I want a 10 khz timer with this definition :

#define CONFIGURE_MICROSECONDS_PER_TICK 100

the calcul in the Clock_driver_support_initialize_hardware function to know
how many times I have to count is :

st_pimr_reload =
    (((BSP_Configuration.microseconds_per_tick * slck) + (1000000/2))/ 1000000);

st_pimr_reload = 3.7768 but whith an integer it is 3 !

There is a relative big difference between the timer calculated ans the
timer I wanted.

How can I manage to have a better result ?

Think you again

Joel R.





More information about the users mailing list