[En-Nut-Discussion] EVK1100 Timing Problem

Thiago A. Corrêa thiago.correa at gmail.com
Mon Oct 13 14:40:37 CEST 2014


On Mon, Oct 13, 2014 at 8:19 AM, Thiago A. Corrêa
<thiago.correa at gmail.com> wrote:
> On Mon, Oct 13, 2014 at 6:21 AM, Philippgl2 <mt1961 at thi.de> wrote:
>>> void NutRegisterTimer(void (*handler) (void *))
>>> {
>>>     /* Set compare value for the specified tick frequency. */
>>> //    Set_system_register(AVR32_COMPARE, NutGetCpuClock() / NUT_TICK_FREQ
>>> + Get_system_register(AVR32_COUNT));
>>>         Set_system_register(AVR32_COMPARE, NutGetCpuClock() /
>>> NUT_TICK_FREQ );
>>>
>>>     sig_sysCompare.ir_handler = handler;
>>>
>>>     register_interrupt(SystemCompareIrqEntry, AVR32_CORE_COMPARE_IRQ,
>>> AVR32_INTC_INT0);
>>> }
>

I didn't notice it was a line continuation, I thought it was a second
line. Forget what I said earlier.

What this is doing is offset the comparator to the current instruction count.
Given that the interrupt resets the comparator to it's previous value,
this is wrong, it should instead do:
         Set_system_register(AVR32_COMPARE, NutGetCpuClock() / NUT_TICK_FREQ );
         Set_system_register(AVR32_COUNT, 0);

Then it should be proper for the first and subsequent interrupts.


I'm not that familiar with the Timer functions, all I did was
implement whatever it dependend on.
The long boot time occurs with and without this modification is that
correct? Are you doing a NutRegisterDevice with the ethernet device?
EMAC driver will basically infinite loop until it gets a phy speed
negotiation.


More information about the En-Nut-Discussion mailing list