2408758_en-US

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

2408758_en-US

2408758_en-US

Modify the value of CNTFRQ_el0 on the A72 core of the im8QM.

Hello!

How do I modify the CNTFRQ_el0 value of the A72 core on the im8QM? It's currently 8000000, and I want to change it to 16M.

Thanks!


Re: 修改im8QM的A72核的CNTFRQ_el0的值

On the i.MX8QM, it is not recommended, and it is practically impossible, to change the actual counting frequency corresponding to CNTFRQ_EL0 of the A72 from 8 MHz to 16 MHz. The reason is that CNTFRQ_EL0 is just a register that allows the software to "discover" the System Counter frequency; even if the software can write this register value, it will not change the actual frequency of the hardware System Counter.

For the i.MX8QM, the reference manual states that the SCU ROM will enable the System Counter and input a 24 MHz clock; the System Counter internally divides this to generate an 8 MHz clock. The relevant clock root also belongs to the clock domain managed by the System Controller Firmware. The documentation shows that SCU_MSLICE0_CLK_ROOT / SCU_MSLICE1_CLK_ROOT can be used as the root clock for the SYS COUNTER, and the root clock generation is controlled by the SC FW.

So if you are reading this now:

CNTFRQ_EL0 = 8000000

I want to change it to:

CNTFRQ_EL0 = 16000000

Two things need to be distinguished:

  • Modifying only the CNTFRQ_EL0 register value
    may cause some software to "think" that the timer is 16 MHz, but the hardware counter still runs at 8 MHz, resulting in errors in time, scheduling, latency, profiling, etc., all being 2 times the normal value.
  • The System Counter was actually changed to 16 MHz.
    Based on the i.MX8QM documentation I found, the System Counter is initialized to 24 MHz / 3 = 8 MHz in the SCU ROM, and there are no publicly available registers or procedures to change it to 16 MHz. Similar discussions in the i.MX8 series have also clearly stated that the system counter frequency is fixed in hardware and cannot be changed.

If your goal is to get Linux/RTOS using the correct frequency, it's recommended to keep CNTFRQ_EL0 = 8000000 and check if the device tree/firmware/bootloader is incorrectly overriding the timer frequency. Don't modify CNTFRQ_EL0 just to meet a 16 MHz requirement unless you're specifically doing an experiment with a non-real frequency.

Conclusion: The A72 CNTFRQ_EL0 of the i.MX8QM should not be changed from 8 MHz to 16 MHz; the actual System Counter is initialized by the SCU/SCFW and is actually 8 MHz. Changing the register value alone will not change the hardware frequency, but will instead disrupt the system time base.


Re: 修改im8QM的A72核的CNTFRQ_el0的值

Hello:

Thank you for your reply!

Could you provide a method or demo code for setting the System Counter to 16MHz in an SCU or SCFW?

Thanks!

タグ(1)
評価なし
バージョン履歴
最終更新日:
6 時間前
更新者: