Part Number:PROCESSOR-SDK-AM335X
Tool/software: Linux
hi:
I want to make a timer in linux by use dmtimer drive,hardware is am335x.
the fclk is 24000000Hz。
when the couter an load value is (0xFFFFFFFF-500) ,the interrupt function could work ,but the frequece is 390kHz, the range of the value is to 0xFFFFFFFF-500 to 0xFFFFFFFF- 0x0000FFFF, the fre is always 390khz on the scope. when set the value to 0xFFFFFFFF - 0xFFFF0000 , can't measure wave on the scope.
so how to config the cpu register can mak the frequece work right?
the interrupt funciont is below
static irqreturn_t mytimer_interrupt(int irq, void *dev){
//printk(KERN_ERR"TIMER 7 is_running !!!!!!!!!!!!\n");
char gpio_v = !(gpio_get_value(GPIO_TO_PIN(3, 21)));
gpio_set_value(GPIO_TO_PIN(3, 21), gpio_v);
return IRQ_HANDLED;
}
the drivce init function is below:
timer = omap_dm_timer_request_specific(7); //得到定时器7
irq = omap_dm_timer_get_irq(timer); //得到中断号
ret = request_irq(irq,mytimer_interrupt, IRQF_DISABLED | IRQF_TIMER , "heat_timer_init",NULL);//注册中断
omap_dm_timer_set_load(timer, 0, 0xFFFFFFFF-500);
omap_dm_timer_write_counter(timer, 0xFFFFFFFF-500);
/* Enable overflow interrupt */
omap_dm_timer_set_int_enable(timer, OMAP_TIMER_INT_OVERFLOW);
/*
* Set counter value to overflow counter after
* one tick and start timer.
*/
//omap_dm_timer_set_load_start(timer, 0, load);
// start the timer!
omap_dm_timer_start(timer);
// stop the timer!
//omap_dm_timer_stop(timer);