CNTPCT_EL0 (Physical Timer counter) always reads '0' after power up

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CNTPCT_EL0 (Physical Timer counter) always reads '0' after power up

5,844 Views
ramakrishnan_mu
Contributor II

I am using ARMV8 processor. I am trying to read the Physical timer counter CNTPCT_EL0 (read system timer ticks) for the purpose of comparing timestamp between 2 instances in the code.

However when i read the register, it always reads '0'. When i opened the peripheral window in the Trace32 debugger, i saw that the the value in the CNTPCT_EL0 register is reading 00000000.

I have set the CNTFRQ_EL0 to 100000000

I think the clock to increment the counter is not provided. Is there a way to do it for the ARMv8 processor. I am using LS1046A ARM NXP processor for the same.

3 Replies

5,773 Views
Pavel
NXP Employee
NXP Employee

See the following pages about this timer:

https://discuss.96boards.org/t/how-to-read-the-system-timer/3847/4

 

https://events19.linuxfoundation.org/wp-content/uploads/2017/12/Christopher-Dall_Arm-Timers-and-Fire...

 

https://github.com/qemu/u-boot/blob/master/arch/arm/cpu/armv8/generic_timer.c

 

https://lists.denx.de/pipermail/u-boot/2018-June/333000.html

 

https://git.tsaro.io/fkantere/linux-kernel/commit/985c0679dfa459a1deed31b999b26e4420786874

Have a great day,
Pavel Chubakov

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

3,292 Views
fenghua_jiang
Contributor IV

I have the same question .

but linux-kernel  patchhttps://git.tsaro.io/fkantere/linux-kernel/commit/985c0679dfa459a1deed31b999b26e4420786874 can not connect.

0 Kudos

5,773 Views
ramakrishnan_mu
Contributor II

Thank you. 

I got this issue sorted. 

I set the Control register (CNTCR) of the System counter to 1. This enabled the clock to the ARM timer block.

One i did that, the CNTCP_EL0 started ticking. 

Thanks for your links. It was useful in lot of aspects.