[ECOS] Timer0 interrupt

Andrew Lunn andrew@lunn.ch
Sat Aug 18 10:21:00 GMT 2007


On Sat, Aug 18, 2007 at 03:31:57PM +0530, sandip wrote:
>  
> Dear Friends,
>  
> As you told I refer  timer_tc.c and clock.hxx. right now I am using inbuilt
> function of timer_tc.c
> but interrupt is not generated.I tried lot but I don't know where is the
> mistake.
> In ecos configuration tools I didn't change any thing or i dont know what to
> change.

timer_tc.c is there to provide the basic system clock in eCos. Also,
the default for the AT91SAM7X is not to use TC0 for the system clock,
it uses the PIT. So unless you have changed the default configuration,
you are not using TC0, you are actually using the PIT.

However, what you are doing in your code is not going to
work. hal_clock_initialize is supposed to be used by eCos, not the
application code. It is used to initialize the system clock. By
calling it from the application, especially with a different clock
period, you will upset all the system timers. All your alarm intervals
will be wrong, a tick will not last the expected 10ms or what ever you
have configured etc. I also expect that installing the interrupt
handler failed, since eCos already has claimed this interrupt vector.
If you enable assertions, which you probably want to do since you are
developing, i expect you will see an assertion failure.

I said look at timer_tc.c. I never said use it! Your old code looked
about right. I just suspect you are initialising TC0 wrongly. Compare
how timer_tc.c sets the registers to how you set the registers. Look
at the data sheet and understand what that code is doing. You can then
check if your code is correct, or if you need to copy some parts from
timer_tc.c

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list