This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GPTIMER11 is to be changed to 13 MHz

Hi

Could you please let me know the GPTIMER11 Source clock change. Presenlty GPTTIMER11 source is 32Khz. I want to change to 13 Mhz in linux Kernel

Please let me know the procedure or kernel configuration.

i want to use GPTIMER as PWM with source of 13 Mhz

Regards

Alex

  • Hello,

    The GP timers can operate from the SYS_CLK or the 32kHz (as you mentioned). On the TI platforms such as blaze the SYS_CLK frequency is 38.4MHz and so 13MHz would only be possible if you used a 26MHz or 13MHz clock source for SYS_CLK. What hardware platform are you using? If you do have a 26MHz or 13MHz clock source for SYS_CLK, then to use the SYS_CLK to drive the timer you can use the following API:

    omap_dm_timer_set_source(gptimer, OMAP_TIMER_SRC_SYS_CLK);

    See the following page:

    http://omappedia.org/wiki/Timer#How_do_I_use_a_GP_timer_to_benchmark_kernel_functions.3F

    Please note that the GP timers have an internal divider and if you have a 26MHz SYS_CLK then you would need to divide the SYS_CLK by 2. So you do this by programming the prescaler using the following API:

    omap_dm_timer_set_prescaler(gptimer, 1);

    Cheers
    Jon


     

  • By the way, which kernel are you using? You can verify the timer clock frequency after you configure it by doing something like the following on recent kernels...

    printk("timer frequency is %lu\n", clk_get_rate(gptimer->fclk));

    Where gptimer is your handle to the timer.

    Jon

  • Hi

    It is very good information  and timely responded very well.

    Regarding Kernel verision: 2.6.34

    Hardware : Gumstix Overo COM  Fire Module with Expansion board

    Texas Instruments OMAP 3503 Applications Processor: ARM Cortex-A8 CPU

    Thank you

    Regards

    Alex

  • Hi Alex,

    Thanks for the info. I am aware of the overo boards, but I have not used one myself. Most OMAP3 platforms use a 26MHz SYS_CLK and so the above should work to configure a timer to use a 13MHz clock to drive the timer.

    For kernel 2.6.34, I don't think that the following will work as the omap_dm_timer structure is local to the arch/arm/mach-omap2/dmtimer.c file. In more recent kernels the structure has been move to the dmtimer.h file and so the below would work by including the header.

    printk("timer frequency is %lu\n", clk_get_rate(gptimer->fclk));

    What you can do to verify the SYS_CLK frequency is ...

    struct clk *sys_clk;
    sys_clk = clk_get(NULL, "sys_clkin_ck");
    if (sys_clk) {
            printk("sys clk frequency is %lu\n", clk_get_rate(sys_clk));
            clk_put(sys_clk);
    }

    Alternatively, you could add a function to the arch/arm/plat-omap/dmtimer.c to return the frequency ...

    long omap_dm_timer_freq(struct omap_dm_timer *timer)
    {
            if (timer && timer->fclk)
                    return clk_get_rate(timer->fclk);
    }

    Cheers
    Jon