This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cortex-A7 Generic Timer Clock and Operation

Hi,

     I'm using NXP imx6ul-evk(single core cortex-a7 processor) and I'm trying to operate CPU at different frequencies(642MHz, 480MHz, 100MHz, 12MHz) and experiencing time drift on certain frequencies (Generic Timer's time lags Real Time), I'm using virtual timer.  I've certain confusions which are following:

* Which clock is going to Generic timer,Why it has range, as I read it operates in range [1-50 MHz], if so then what is its relation with system's core clock which has range up to 696 MHz?

* On system side I've three memory mapped system_counter block (SYSTEM_COUNTER_CTRL = CNTControlBase), SYSTEM_COUNTER_CMP and (SYSTEM_COUNTER_RD = CNTReadBase)

* I consider the timer clock rate 8000000 Hz, load 80000 in CNTV_TVAL and it gives me 10 ms interval but changing the system frequency cause time drift?

Parents
  •      I think only I can answer this question on planet , using timer cause this drift because we load timer with some value like 80000, and it counts down to zero generate interrupt and disable itself but servicing this interrupt take some time like 1ms or on lower frequencies(12MHz) up 20 ms which couldn't be figure out, so the other method.

         Use compare register(cntv_cval) and counter(cntvct), read initial value of counter(Read Only) add your desire ticks like(80000) for 10ms and enable the timer from control register(cntv_ctl). every time when interrupt occurs, add 80000 in the previous value (don't read the fresh value because it can contain drift just give it 10ms slice and let the timer figure it out itself) and enable the time again from the control register. You've to use inline assembly instruction (like mrrc and mcrr). Enjoy drift proof timer.

Reply
  •      I think only I can answer this question on planet , using timer cause this drift because we load timer with some value like 80000, and it counts down to zero generate interrupt and disable itself but servicing this interrupt take some time like 1ms or on lower frequencies(12MHz) up 20 ms which couldn't be figure out, so the other method.

         Use compare register(cntv_cval) and counter(cntvct), read initial value of counter(Read Only) add your desire ticks like(80000) for 10ms and enable the timer from control register(cntv_ctl). every time when interrupt occurs, add 80000 in the previous value (don't read the fresh value because it can contain drift just give it 10ms slice and let the timer figure it out itself) and enable the time again from the control register. You've to use inline assembly instruction (like mrrc and mcrr). Enjoy drift proof timer.

Children
No data