[ECOS] Re: In trouble of timer operations

Paul D. DeRocco pderocco@ix.netcom.com
Wed Jun 4 10:06:00 GMT 2008

> From: ariga masahiro [mailto:ariga@link-lab.co.jp]
> I am afraid I dig up the same question but I think this is important,at
> least for me,
> so please forgive my inquiring again.
> The problem is return_time of cyg_thread_delay.I am determined to
> use TMU1
> as Free-Run Counter(0xffffffff-0)
> and made function(HAL_CLOCK_READ1) to read TMU1 clock count.I am affirmed
> it's working correctry.
> I used it to calculate return time in hipri_test() in timeslice2.c.
> I am baffled by the result.
> --testing code
> hipri_test(CYG_ADDRESS id)
> {
>     cyg_int32 start;
>     while( 1 )
>     {
>         HAL_CLOCK_READ1(&start);
>         diag_printf("id=hi 0x%x\n",start);
>         cyg_thread_delay(1);
>         cyg_thread_delay(2);
>     }
> }
> I calculated several cases.
> (1) I only used cyg_thread_delay(2)
> (2) I used Andrew's proposition of using
> cyg_thread_delay(1),cyg_thread_delay(2) like above code.
> (3) same as (2) except changed cyg_thread_delay(2) to cyg_thread_delay(20)
> (4) only used cyg_thread_delay(20)

It's possible that there's something wrong with the timer configuration.
However, you won't find it out very easily with diag_printf, because it
probably takes longer than 10ms to execute.

I don't know what hardware you're using, but most evaluation boards have
utility LEDs or output port pins. Instead of outputting a message, toggle a
port pin and look at it with a scope or a frequency counter.


Ciao,               Paul D. DeRocco
Paul                mailto:pderocco@ix.netcom.com

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