linux icon indicating copy to clipboard operation
linux copied to clipboard

moxa_timer reload issue

Open ya-mouse opened this issue 9 years ago • 1 comments

I observe an issue in the moxart_clkevt_next_event. Right after the timer has been disabled, the new value for MATCH1 register calculated based up on the current COUNT register. Regarding to the datasheet, after the timer disabled then it's counter's register have to be reloaded with a RELOAD register value. But it seems it is not. Seems like SoC need some cycles to reload. We read current value near the same as MATCH1 (we stops counting a little later). So, each round of clockevent gets a lesser value of MATCH1 (interval grows dramatically). For example, if we did a double read from a COUNT register, everything seems ok. If we disable then enable and disable TIMER1 again it's make a trick too. I suggest just set negated "cycles" value to the MATCH1 register. It is already known that the RELOAD value is all "ones" right after the one shot round.

ya-mouse avatar Oct 06 '16 06:10 ya-mouse

Another one approach – do not disable TIMER1 and just update MATCH1 based on current COUNT register (with a little waste of timer's tick). It works too.

ya-mouse avatar Oct 06 '16 07:10 ya-mouse