AnsweredAssumed Answered

How to get the imx6 epit clock frequency

Question asked by 其东 刘 on Mar 21, 2019
Latest reply on Mar 29, 2019 by Artur Petukhov

Hello everyone
The board I use is the development board of the IMX6Q of NXP official website. The kernel version I am using is linux3.14.52. The problem I am having now is: I want to get the clock frequency of the EPIT, I want to calculate the time period of its counting according to its frequency. Currently, my epit timer 1 and epit timer 2 are working properly. But when I get the clock frequency of the timer, the value I get is 0. The way I get it is:

struct clk *timer_clk = NULL;
  timer_clk = clk_get_sys("imx-epit.1", "per");
     If (IS_ERR(timer_clk))
     {
         Printk("Get EPIT1 time_clk fail !\n");
         Return -1;
     }
     clk_value = clk_get_rate(timer_clk);
     Printk("epit1 timer_clk->rate = %d !kernel \n", clk_value);

 

The last print is: epit1 timer_clk->rate = 0 !kernel

How can I get the actual frequency of the clock?
Because I want to use epit to achieve precise timing.
For example, I want to interrupt once in 1ms. What should I set the EPITLR register to be correct? At the same time, I hope to have a calculation method!
I look forward to your help.
thank you very much.

Outcomes